Openfire http prebinding with JAXL - openfire

I am trying to implement converse.js in my project to use Openfire chat and am prebinding the user using JAXL. Its working fine on my cloud(VPS) server. when am try to publish the same code on my client server its not working. and getting the same problem when execute the same from my localhost. not working means prebind request remains (pending) for a while and ends with 500 internal server error.
we have checked the server configuration. seems to be fine. Can any one suggest me something to how to debug this one?
here is my jaxl config code.
$client = new JAXL(array(
'jid'=>$un,
'pass'=>$pwd,
'bosh_url' => 'http://xx.xx.xx.xx/http-bind',
'log_path' => __DIR__ . '/logs',
'log_level' => JAXL_INFO,
'strict' => false
));
Thanks in advance
-josan
UPDATE
here is my jaxl log from my client server.
1.jaxl:180 - 2014-11-05 10:47:47 - dns srv lookup for iz25pkf9c7hz
2.jaxl:189 - 2014-11-05 10:47:47 - including bosh xep
3.jaxl_fsm:61 - 2014-11-05 10:47:47 - calling state handler 'setup' for incoming event 'start_cb'
4.jaxl_fsm:71 - 2014-11-05 10:47:47 - current state 'wait_for_stream_features'
5.xep_0206:109 - 2014-11-05 10:47:47 - posting to http://182.92.156.24/http-bind body
6.<body xmlns="http://jabber.org/protocol/httpbind" content="text/xml; charset=utf-8"
to="iz25pkf9c7hz" route="xmpp:iz25pkf9c7hz:5222" secure="true" xml:lang="en"
xmpp:version="1.0" xmlns:xmpp="urn:xmpp:xbosh" hold="1" wait="30" rid="2280"
ver="1.10" from="bala101#iz25pkf9c7hz">
</body>
7.xep_0206:132 - 2014-11-05 10:47:47 - recving for 2280
8.xep_0206:132 - 2014-11-05 10:47:48 - recving for 2280
9.xep_0206:132 - 2014-11-05 10:47:48 - recving for 2280
10.xep_0206:132 - 2014-11-05 10:47:48 - recving for 2280
.
.
.
.
58854.xep_0206:132 - 2014-11-05 10:47:48 - recving for 2280
.
.
(Its just kept on adding for 5 or 3 mins)

At last we found the solution for this issue.
As i already mentioned in my comment the problem was caused of PHP versions
In JAXL
#135 $changed = curl_multi_select($this->mch, 0.1);
#137 if($changed == 0 && $running == 0) {
https://github.com/jaxl/JAXL/blob/v3.x/xep/xep_0206.php#L135
The curl_multi_select() function used there on line no #135 returning (-1) instead of (0) as the response when PHP versions are higher than 5.3.18
So i have changed the #137 as follows
#137 if(($changed == 0 || $changed == -1) && $running == 0) {
This thing fixes my problem.
ref https://bugs.php.net/bug.php?id=63411
Note: for PHP versions Greater than 5.3.x Do the migration check before using the JAXL in-to your project.
The below link having a shell script to found inconveniences
http://blog.waja.info/2013/09/15/migrating-from-php-5-dot-3-x-to-5-dot-4-x-and-finding-problematic-application-code/
Hope this could help someone on sometime.
Happy coding

Related

Webdav Lock request return "405 Method Not allowed" in asp .net core 6 hosted in IIS

I actually a migrate an old asp .net framework 4 web app to asp .net core 6.
This webapp was serving docx et xlsx files through IIS and webdav to allow end users edit directly files on the server
On the old app, the config was like that
a virtual directory on IIS to associate a virtual Path Webdav to a physical path
an IHttpModule which allow me to intercept all request on the server and add some authentication when the request point out /webdav (webdav don't support anonymous authentication)
HttpContext.Request.Headers.Remove("Authorization");
HttpContext.Request.Headers.Add("Authorization", "Basic " + base64string);
On the new app
the virtual directory is manage directly on the code (Startup)
var lOptions = new FileServerOptions
{
FileProvider = new PhysicalFileProvider(Sys.Web.AppliIs.Path_Webdav),
RequestPath = new PathString("/" + Sys.Web.AppliIs.WEBDAV_FOLDER),
EnableDirectoryBrowsing = false,
};
app.UseFileServer(lOptions);
i intercept the request to add my authentication in a custom middleware (called before the code above)
app.Use(async (context, next) =>
{
AppliGeckosSL.WriteLogDebug($"intercept {context.Request.Path}, Method : {context.Request.Method}", null);//just to log everything which arrived
var lFileInfo = lHostEnv.ContentRootFileProvider.GetFileInfo(context.Request.Path);
if (lFileInfo != null)
{
WebdavFileManager.HandleRequest(context, lFileInfo.PhysicalPath);
}
// Call the next delegate/middleware in the pipeline.
await next(context);
});
Whe i test the new code (opening a file stored in the server with word), it failed.
Whe i inspect the logs, i notice thow things :
On the IIS logs, i see my different request called by word
2022-03-23 11:20:31 ::1 OPTIONS /Webdav/ - 7520 - ::1 Microsoft+Office+Protocol+Discovery 200 0 0 47
2022-03-23 11:20:31 ::1 HEAD /Webdav/BeWise.docx - 7520 - ::1 Microsoft+Office+Existence+Discovery 200 0 0 4
2022-03-23 11:20:31 ::1 OPTIONS /Webdav/ - 7520 - ::1 Microsoft+Office+Existence+Discovery 200 0 0 5
2022-03-23 11:20:31 ::1 LOCK /Webdav/BeWise.docx - 7520 - ::1 Microsoft+Office+Core+Storage+Infrastructure/1.0 405 0 0 4
2022-03-23 11:20:31 ::1 GET /Webdav/BeWise.docx - 7520 - ::1 Microsoft+Office+Core+Storage+Infrastructure/1.0 404 0 3 2
we can see the Lock method finished in 405
We can also see the get finishing in 404 which i can't understand because the HEAD finished on 200 on the same file
The log of my middleware give me only this
23/03 12:20:32:023 [FW] intercept /Webdav/BeWise.docx, Method : HEAD
23/03 12:20:32:055 [FW] intercept /Webdav/, Method : OPTIONS
so we see the LOCK and the GET are not handle by my server
I see many solutions on this problem on this forum and others which recommand to disable webdav, solution which dont fit me because i want to use webdav
There is not a lot of documentations about .net core and webdav, im not even sure its supported.
I try to remove the virtual directory by code and set a virtual directory through IIS like the old app but still not working, in this case the lock not finish in 405 but in 401. I notice my middleware in not called, so i cant add my authentication. I suppose with this option we don't go through the asp .net core pipeline.
What do you think ? any suggestion on that ?
Thanks for your help !
I had some answers from microsoft, the IIS webdav module is no longer supported with .net core (they will update the docs for that because it was not clearly said). So there is no way i will be able to achieve what i want.
My solutions now :
implement myself the webdav protocol
buy a licence to IT HIT WEBDAV Server Engine
thanks anyway for your answers, the subject is closed

Aerospike - “n_bytes_memory went negative” with in memory-only namespace with ttl

We have a namespace configured to store data in memory only with couple of minutes default ttl. After starting putting some data into it, when expiration kicks in, we're getting these messages in the log (a lot, for ~30% of expired records):
WARNING (namespace): (namespace.c::762) set_id 1 - n_bytes_memory went negative!
I have simple client app with server config that can reproduce this: https://github.com/akkomar/aerospike-test (it's based on docker and is very easy to start)
Any advice what might be the reason?
Edit:
I checked this on versions 3.6.4, 3.7.0.1 and 3.7.4
Configuration file used for testing (from https://github.com/akkomar/aerospike-test/blob/master/etc/aerospike.conf):
service {
user root
group root
paxos-single-replica-limit 1
pidfile /var/run/aerospike/asd.pid
service-threads 4
transaction-queues 4
transaction-threads-per-queue 4
proto-fd-max 1024
}
logging {
file /var/log/aerospike/aerospike.log {
context any info
}
console {
context any info
context namespace detail
}
}
network {
service {
address any
port 3000
}
heartbeat {
mode mesh
port 3002
mesh-port 3002
interval 150
timeout 10
}
fabric {
port 3001
}
info {
port 3003
}
}
namespace test_ns {
replication-factor 2
memory-size 1G
default-ttl 10S
storage-engine memory
}
Edit2:
It seems that it's happening only if I update records via UDF. The simplest one that reproduces this:
local VAL_KEY = "v"
function add_data(rec, val_to_add, ttl_to_set)
if aerospike:exists(rec) then
rec[VAL_KEY] = val_to_add
aerospike:update(rec)
else
rec[VAL_KEY] = val_to_add
aerospike:create(rec)
end
end
When I execute the same operation via Java API - everything seems to work fine (example github repo mentioned earlier is updated with Java API example)
The meaning of the error message is that the space we have accounted for the set in memory went to a negative number which should not be possible.
This has been logged in our internal bug tracking system for resolution in future releases
It turned out it was a bug in Aerospike.
It's fixed in version 3.7.4.1 (detailed explanation in https://discuss.aerospike.com/t/problem-with-expiring-records-in-memory-only-namespace-n-bytes-memory-went-negative/2560/6)

Getting Service Insight to connect to Management Service

My OS is a Windows 2012 Essentials.
I installed NServiceBus 4 using the installer, then installed Service Insight.
Accepted the default settings.
When I start up Service Insight, there is an error about connecting to the management service. I've tried putting in http://localhost:3333 but that errors out to a 404. I've verified that the service "particular management" is running.
EDIT
As per Hadi's instructions, I've pasted the url he listed: http://localhost:33333/api into the Connect to Management Service -> Service URL text box, but it still has a 404 not found error. When I try putting the URL into google chrome, I also get a 404 (with graphics courtesy of the oatmeal).
I've verified that a service named Particular Management is running. The description of the service is Particular Management Service for NServiceBus (Version 4.0.5).
I've ran the installer again to get to the modify/repair/remove options and verified in the modify option that the management service is installed.
Is there supposed to be a different service called Management Service? Is this maybe an issue introduced with version 4.0.5?
EDIT 2
I've appended the extra / to the end of the url, still no dice. This here is the logging information.
2013-10-11 09:15:58,488 - [INFO ] - IManagementService - HTTP GET http://localhost:33333/api//
2013-10-11 09:15:58,501 - [DEBUG] - IManagementService - HTTP Status NotFound (404) (http://localhost:33333/api//http://localhost:33333/api)
2013-10-11 09:15:58,506 - [DEBUG] - IManagementService - Response Header: Transfer-Encoding : chunked
2013-10-11 09:15:58,507 - [DEBUG] - IManagementService - Response Header: X-Particular-Version : 1.0.0-unstable122
2013-10-11 09:15:58,508 - [DEBUG] - IManagementService - Response Header: Cache-Control : private, max-age=300, must-revalidate
2013-10-11 09:15:58,509 - [DEBUG] - IManagementService - Response Header: Content-Type : text/html
2013-10-11 09:15:58,529 - [DEBUG] - IManagementService - Response Header: Date : Fri, 11 Oct 2013 14:15:58 GMT
2013-10-11 09:15:58,533 - [DEBUG] - IManagementService - Response Header: Server : Microsoft-HTTPAPI/2.0
2013-10-11 09:15:58,536 - [ERROR] - IManagementService - Error executing the request: , Status code is NotFound
You need the slash at the end:
http://localhost:33333/api/
The Url to Service Control (a.k.a Management Service) also needs /api, e.g. http://localhost:33333/api (you missed a 3?). At the end of the day, it is also a NServiceBus host process, so you need to check and make sure it is actually running (using Task Manager, or Services).

Rails Webrick monitoring functionality in apache2?

Hi I'm wodering if it is possible to get the same webrick monitoring functionality in apache2. Doing a quick reseach on this site an goolge, I found that I can use tail -f to monitor the log realtime. But the info I need is not displayed on the access.log.
On Webrick I can see the complete request that came to the server, this includes all POST parameters that are sent to it. I'm developing a Phonegap aplication that is aiming to a production server with apache, and I need to doublecheck my REST request to the server (exactly as I did in my development environment in Rails with Webrick). That's why tail -f don't fit my needs.
Does anyone has a solution?
Thanks in advance.
I've got the solution. And it's a stupid answer. I was looking to the apache2 other_vhosts_access.log file, and the info I was getting was:
migtrace.com:80 89.131.219.51 - - [16/Sep/2013:12:14:14 +0200] "POST /api/reports.json HTTP/1.1" 200 964 "-" "curl/7.29.0"
But if I tail -f the rails production.log what I get is:
Started POST "/api/reports.json" for 89.131.219.51 at 2013-09-16 12:14:14 +0200
Processing by Api::ReportsController#create as JSON
Parameters: {"report"=>{"geo"=>["41.2058334", "1.697777"], "patient_id"=>"X", "patient_token"=>"XXXXXXXXXX", "lunch"=>"{\"pasta\",\"cheese\",\"chocolate\"}", "sex"=>"true"}}
Completed 200 OK in 522ms (Views: 2.3ms | ActiveRecord: 259.3ms)
That is exactly what I need.

Magento Soap Error - Premature end of data in tag definitions line 2

My client is using Unleashedsoftware.com to connect to a Magento Store. But it gives this error.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.domain.com/index.php/api/v2_soap/index/wsdl/1/' : Premature end of data in tag definitions line 2
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
When browsing http://www.domain.com/index.php/api/v2_soap/index/ Firebug gives me “500 Internal Service Error”.
When I browse http://www.domain.com/index.php/api/v2_soap/index/wsdl/1/, I am getting valid XML data.
I checked the server log files and it seems like:
[Thu Aug 30 22:22:25 2012] [warn] [client 92.92.92.92] mod_fcgid: stderr: in /home/doaminuser/public_html/lib/Zend/Soap/Server.php on line 762
I been searching for couple of days now and today I tried to duplicate the entire site to another test server, and it seems to be working! So that seems to be a server issue.
Please, anybody got any idea what could be the issue?
Is there any better way of debugging this issue, any sample code or debugging tips.
Magento version is 1.6.2
Thank you.
There's lots of times where Magento's SOAP API fails due to problems your Magento server has communicating with itself.
That is, PHP's SOAP implementation requires that the SOAP server itself fetch the WSDL file via http, and a local network configuration issue gets in the way of Magento fetching it's own WSDL.
You can debug this by SSHing into your Magento server, and running the following command
curl -l 'http://www.example.com/index.php/api/v2_soap/index/wsdl/1/' > /tmp/wsdl.xml
and then examining the wsdl.xml file. Because you're performing this from your web-server, you may get different results than when you're performing it from your local browser.
I had a similar problem when calling the URL
http://www.store.com/index.php/api/v2_soap/?wsdl
After some time I received the message 500 - Internal Server Error and a Premature end of script headers message in the apache error log.
After a whole day of research I figured out, that the Timeout-Directive of the Apache module (configured in httpd.conf on a Linux environment) was set to "20" which caused the server to send the 500 error after 20 seconds. The problem is, that in my case the Magento system needs a longer time to "crawl" through all wsdl.xml files in order to build the WSDL-output (if you are using Magento SOAPv2).
Maybe you should check your Timeout Directive..hope that helps.
"I have memories of this. What worked for me was to put the hostname
in /etc/hosts on the server plus the www alias on 127.0.0.1 However,
in this instance the server was in the building rather than in some
ISP place and the LAN had Windows computers on it. Windows users had
downloaded lots of trojan-virus-porn things that were spending the
whole time spamming the network so the real problem was with the
Windows computers on the network, not with the server or with Magento.
After fdisking the PC's the problem was solved."
Thank You I've been struggling for 2 days with this on magento 1.6 and Windows Server 2008 adding this line to the hosts file (C:\Windows\System32\drivers\etc) solved the issue for me:
127.0.0.1 www.Domain.com
also remember to fix your magento soap (role) because the Roles Resources doesn't save in 1.6 unless you fix this file:
MagentoRoot\app\code\core\Mage\Adminhtml\Block\Api\Tab\Rolesedit.php
replace this:
if (array_key_exists(strtolower($item->getResource_id()), $resources) && $item->getPermission() == 'allow') {
with this:
if (array_key_exists(strtolower($item->getResource_id()), $resources) && $item->getApiPermission() == 'allow') {
In my case the issue was the Mod_Security rule "PHP Easter Egg Access" was enabled.
Rule ID: 380800
Once disabled, the api access worked.
An indicator was in the Apache log file:
Jun 19 09:15:52 httpd[1024961]: [error] [client xyz.xyz.xyz.xyz] ModSecurity: [file "/usr/local/apache/conf/modsec/99_asl_jitp.conf"] [line "116"] [id "380800"] [rev "1"] [msg "Atomicorp.com WAF Rules - Virtual Just In Time Patch: PHP Easter Egg Access"] [data "phpe9568f35-d428-11d2-a769-00aa001acf42"] [severity "CRITICAL"] Access denied with code 403 (phase 2). Pattern match "php(?:e9568f3[56]-d428-11d2-a769-00aa001acf42|b8b5f2a0-3c92-11d3-a3a9-4c7b08c10000)" at REQUEST_URI. [hostname "www.yoursever.com"]...
Magento version: 1.7.0.2
PHP version: 5.3.26
More information about the PHP Easter Egg Access rule:
http://www.atomicorp.com/forums/viewtopic.php?f=3&t=5057
http://www.0php.com/php_easter_egg.php
For those wanting a quick test script to replicate the issue (useful when trying to convince your hosting provider that it's a problem on their end), use:
<?php
$server = new SoapServer("http://<url to your magento shop>/index.php/api/v2_soap/index/wsdl/1/");
?>
This is the line in /lib/Zend/Soap/Server.php that triggers the error.
In my case if you browsed to:
http://< url to your magento shop >/index.php/api/v2_soap/index/wsdl/1/
the xml was fine, but if you ran the above php script on the server, the error was given.
This error most often appeared for me while omitting www for domain given in Magento SOAP url. Url has to match base url specified in the Magento config.