uProxy gets weird after my computer goes to sleep (uProxy doesn't know user is logged out of XMPP)
If I log into uProxy, then let my MacBook go to sleep, when I wake up my MacBook and open uProxy things seem to be in a weird state (one hypothesis: I am logged out of XMPP but this isn't reflected the UI).
Needs research into what's happening; marking as ready for work.
Just left myself signed into uProxy with GTalk overnight, and this morning I see this error from socialprovider.js (freedom-social-xmpp):
received unhandled offline event
And also many warnings like:
User status request to [email protected]/messaging-lcsw_hangoutsE8386BB1 dropped, no client available.
Also, the uProxy UI still shows me being signed (buddylist is populated), however when I sign in/out on other accounts, it's not reflected in the buddylist I was logged into yesterday, i.e. it looks like I've gone offline but uProxy doesn't know it.
@salomegeo has a pending pull request that causes the unhandled offline event error to instead actually sign you out. If you see that error already, it sounds like we're in good shape here!
https://github.com/freedomjs/freedom-social-xmpp/pull/67
Cool - I think we may need to add some extra event or logic in uProxy to also log out of the social network in this case (clear the buddylist, show an error, etc)
On Wed Nov 19 2014 at 12:09:57 PM Will [email protected] wrote:
@salomegeo https://github.com/salomegeo has a pending pull request that causes the unhandled offline event error to instead actually sign you out. If you see that error already, it sounds like we're in good shape here!
freedomjs/freedom-social-xmpp#67 https://github.com/freedomjs/freedom-social-xmpp/pull/67
— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/270#issuecomment-63675613.
@dborkan tells me @salomegeo is working on this. So I've marked as active and assigned.
I'm not actively working on this.
Only part that's left here is adding tcp keep alive method.
I thought you were working on updating uProxy to detect when a user has been logged out of XMPP?
On Wed Dec 17 2014 at 4:39:31 PM salomegeo [email protected] wrote:
I'm not actively working on this.
Only part that's left here is adding tcp keep alive method.
— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/270#issuecomment-67399301.
Yeah that's done in #643, but when your computer goes to sleep or when you're disconnected from the network, tcp socket stays open, so disconnect event is not raised and xmpp client doesn't know that it's been disconnected, even though, you're disconnected.
I'm thinking that if we don't get notified of the disconnect due to the socket remaining open, we should implement something to periodically ping the XMPP server (maybe some simple request like getting a user's state). Then if the XMPP server doesn't respond in some number of seconds, we can assume the user is logged out of the social network, emit that event to uProxy, and cleanup all the state. That should handle all the varieties of disconnect, including when the computer goes to sleep, or the internet connection breaks, or the XMPP server is unavailable.
Lally looked into chrome sockets, and it has setKeepAlive method that pretty much does what we need, we just have to call it. We don't know what the behavior is on firefox.
So this is blocked on #722
Just discussed with @bemasc and @willscott : we don't actually know if XMPP is robust to errors here: if XMPP internally generates presence messages the failure of which results in disconnect (thanks to the new wiring that @salomegeo wrote for this), then we don't actually have any (user-impacting) issue.
@klazizpro Can you do a test to see if this is an issue. I think the test is unplug ethernet from a uproxy connected to a social network and see if uProxy realizes the problem after a minute or two or 5.
This is definitely still an issue - not sure how best to fix it but there is some bug here. I can replicate easily in the freedom chat demo by:
- Sign into GTalk
- Successfully send a messages to a user
- Disable WiFi (I'm not plugged into the internet)
- Re-enable + connect to WiFi
- Try to send a message again
- This time the message doesn't send, although there is no notification of failure from the XMPP client object or failure response from the server. Also we don't get any 'error', 'offline', 'close', or 'end' event from the XMPP client object.
Thanks for testing @dborkan ! So this tells us that XMPP, now with code to pass error's back up the stack, does not have any kind of keep-alive test (or our code to pass error's up the stack is not complete).
@dborkan This seems like a top priority reliability issue. I'm de-assigning @klazizpro for the testing here as you've done it, and I think it's time to now re-assign to someone who has cycles to fix it.
The suggested fix we discussed previously was to add keep-alive functionality to the tcp-provider and use the failure message from that to trigger failure of the xmpp connection. That's one approach that seems good to me. Other ideas?
I don't object to fixing this at the tcp-provider level, but if that proves too time consuming (e.g. if we have to fix it in Chrome code), or if it differs across platforms, another option is to put logic in the social provider (socialprovider.js or some module we provide to it) that periodically pings the XMPP server with some idempotent request - then if we don't get a reply back in X seconds we can assume we are disconnected. The advantage of that approach is that it would detect disconnect for any reason and should work across platforms.
On Mon Jan 26 2015 at 7:54:13 PM iislucas [email protected] wrote:
Thanks for testing @dborkan https://github.com/dborkan ! So this tells us that XMPP, now with code to pass error's back up the stack, does not have any kind of keep-alive test (or our code to pass error's up the stack is not complete).
@dborkan https://github.com/dborkan This seems like a top priority reliability issue. I'm de-assigning @klazizpro https://github.com/klazizpro for the testing here as you've done it, and I think it's time to now re-assign to someone who has cycles to fix it.
The suggested fix we discussed previously was to add keep-alive functionality to the tcp-provider and use the failure message from that to trigger failure of the xmpp connection. That's one approach that seems good to me. Other ideas?
— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/270#issuecomment-71570620.
Yes, I think those are the two natural directions.
Idempotent is not the property you're after as much as something that doesn't affect the state. An IQ stanza would probably work to a server ping (e.g. http://xmpp.org/extensions/xep-0199.html)
We may want to do this because it's probably quite quick and easy, while I think the tcp change would require extended the tcp provider's interface. The downside is that it probably eats up some of our pre-abuse message quota.
@willscott @trevj thoughts/preferences/other-arguments?
Presumably quota is only a minimal issue since these pings would only get sent when there isn't other activity going on.
While keepalive seems like a very useful thing to add to the TCP provider, I agree with @iislucas that we wouldn't underestimate how long it will take to implement and with @willscott that we shouldn't worry about quota for pings.
Yes, with a little more work, you can send only when you haven't received anything in a while. And we'd need to bear in mind that quota is usually on outgoing traffic, not incoming. It takes up to 2 minutes to realize a TCP socket timed out. Either way, a ping is a small amount of traffic, and can be done relatively infrequently so isn't a significant issue independently of being smart about timings of them, so I don't think I'd even worry about trying to be clever here.
@dborkan did you see XMPP realizing it had lost TCP connection after 2 minutes? If not, then we either have bugs in TCP sockets still, or XMPP provider is still failing to pass TCP socket failure up the stack. I'd like to know and make sure we have issues for it :)
We should certainly be fixing the TCP socket behavior. But a higher level XMPP ping will probably give us needed user-experience quickly.
So far I haven't seen it ever realize it was disconnected but there are a few more things we can test to learn more:
- Waiting several minutes after disconnect/re-connect to see if the social provider or TCP socket ever emits any sort of disconnect/error/etc
- Test in Firefox to see if we get different behavior
- Also add some debugging as low-level as possible in our JS (probably where the freedom tcpsocket interacts with the browser API) to see if anything happens within a few minutes of disconnect/re-connect
On Tue Jan 27 2015 at 12:43:31 PM iislucas [email protected] wrote:
Yes, with a little more work, you can send only when you haven't received anything in a while. And we'd need to bear in mind that quota is usually on outgoing traffic, not incoming. It takes up to 2 minutes to realize a TCP socket timed out. Either way, a ping is a small amount of traffic, and can be done relatively infrequently so isn't a significant issue independently of being smart about timings of them, so I don't think I'd even worry about trying to be clever here.
@dborkan https://github.com/dborkan did you see XMPP realizing it had lost TCP connection after 2 minutes? If not, then we either have bugs in TCP sockets still, or XMPP provider is still failing to pass TCP socket failure up the stack. I'd like to know and make sure we have issues for it :)
We should certainly be fixing the TCP socket behavior. But a higher level XMPP ping will probably give us needed user-experience quickly.
— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/270#issuecomment-71692162.