Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Using Bosh in Matrix
Page: previous  1  2 
Avatar
Jro #16
Member since Feb 2010 · 27 posts
Group memberships: Members
Show profile · Link to this post
In reply to post ID 4829
No real change with respect to the exceptions.  Even changing the keep alive to the lowest setting of 30, I would see 4 empty xml messages (SEND: in the xml debug tab and only that) and then the web exception on the 2 minute mark.  Looks to be a coincidence in timing beforehand, so I suppose something specific to BOSH is triggering it.

At the very least, the exceptions do not cause any crashes but is simply an unexpected behavior (that can be avoided by calling something like SendPresence every minute).  Periodically the exception will cause a connection close though, although I suspect this may be a byproduct of the debugger.
Avatar
Alex #17
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The KeepAliveInterval is the interval in which MatriX is sending Keep Alive packets to prevent NAT timeouts. This is not necessary and why I suggested to set it to -1 to disable the keep alives.

Timed out WebRequests in BOSH are normal and by design when no data is sent or received for a while.

Alex
Avatar
Jro #18
Member since Feb 2010 · 27 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the clarification Alex and the quick responses.
Avatar
Alex #19
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I will remove the KeepAlives on BOSH connections by default with the next update.

Alex
Avatar
Jro #20
Member since Feb 2010 · 27 posts
Group memberships: Members
Show profile · Link to this post
I'm still fighting a similar problem in this previous use case. 

I am attempting to monitor for connection drops, but OnError doesn't fire on a Bosh connection during a connection drop (it did in the case of the non-Bosh approach - is this a bug?).  Instead, I only get the  OnClose event after a sequence of web exceptions (forcibly closed connections) within the library, leading to an eventual timeout (and subsequent 404 exceptions for any remaining xmpp calls being made in this timeframe) - this usually takes about 30 seconds from when I kill the XMPP server. 

I am fairly confidant something already in the library has realized that the connection died as soon as the server went down, but is possibly not propagating up to the OnError event?  If I re-stand the server before the OnClose event fires, then that event will not fire.  xmppClient ends up in a bad state at this point, and I have to manually restart connections.  Unfortunately, since no events fire from Matrix lib, and that the exceptions are occurring in the matrix threads, I am in an awkward position to effectively handle this edge case (I surmise I could do it myself by making my own connections to the bosh url and monitoring it myself but...)

Anyway, something seems weird here and I was wondering if there was a potential issue going on?  OnError not firing for forcibly closed connections and 404 exceptions gives me pause, as it used to fire for the non-Bosh connections.
Avatar
Alex #21
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This is by design. let me explain why.

BOSH was developed for constrained clients which can only speak HTTP, but also for unreliable networks. Depending on the server configuration the BOSH connection manager can keep alive the connection for a long time when you lost the network until its back.
This is the reason why it does not throw OnError events when a single or multiple WebRequest failed. It retries to connect until it reaches the inactivity time configured in the BOSH connection manager. If this fails then you get the OnClose.

Think about a Mobile device in your pocket. There you are hopping from access point to access point. But BOSH still keeps your connection alive when you don't use the network for an interval higher as the inactivity in BOSH.

I don't think it makes sense to throw an OnError for each failed WebRequest. But I am open to any suggestions and API changes when they make sense and help developers.

Alex
Avatar
Jro #22
Member since Feb 2010 · 27 posts
Group memberships: Members
Show profile · Link to this post
Thanks, that explanation helps me quite a bit.  Is there a client-side property to set for the interval in which the BOSH connection will attempt to reconnect, or is this set by the server side connection manager?

It appears one of my issues (my main issue) was the result of the Openfire inactivity value being defaulted to a very low level, and this particularly property is masked in the standard control panel (the property had to be added manually - xmpp.httpbind.client.idle).  This misled me more than I care to admit.

My second issue was that I incorrectly assumed a server crash case should behave identically to a loss of network.  The later behaves exactly as you described, but the server crash scenario immediately closes the connection on the server but the client cannot salvage the connection, and I have to wait for the interval to expire in order to wait for OnClose to eventually fire.
Avatar
Alex #23
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The inactivity is set by the server in the session response.
There is a way to pause sessions on request by the client in BOSH. But when I checked this feature the last time it wasn't supported by the most BOSH connection managers.

see also:
http://xmpp.org/extensions/xep-0124.html#inactive

Quote by Jro on 2010-05-15, 00:11:
1273871472

the server should not crash ;-). If it does there is no way to know if the sever crashed or the network went down, because WebRequests will fail in both cases.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page: previous  1  2