XHR polling sometimes create double connections. #140

Open
googletorp opened this Issue Sep 19, 2011 · 9 comments

Comments

Projects
None yet
5 participants

I have not been able to nail, what exactly is causing this.

It seems that sometimes people using XHR polling, will be able to open two connections with one page load. When they disconnect, however, only one (the latter) of the connections will be disconnected. I was able to produce this problem, with a fairly simple setup - a static html file and nowjs logging to the browser every x second.

I need to react when people close the last tab to my site (in case of several tabs open), effectively shutting down all connection to nowjs. I had been doing this by keeping track on connections via user profiles, but the above bug cause this to break, as sometimes people will become ghosts, appearing to be connected, but in reality having disconnected a long time ago. I have been able to create a workaround for now, by reacting to any disconnect event, but this may lead to bad behavior for people running multiple tabs open in the browser.

Contributor

ericz commented Sep 22, 2011

Does this happen in any particular browser?

I have been able to reproduce this problem with firefox 3.6, I tried out with Firefox 5.x where I wasn't able to reproduce. This is however only 5 minutes test or so. The problem happened twice on firefox 3.6 which could be in the order 0f 1-5% of the connects I made. I haven't done intensive browser testing, but it was a pretty obvious problem with some hundreds users on the site.

mikl commented Sep 23, 2011

It's kinda hard to reproduce, but it a big headache if you have a lot of users on a Now instance…

I have seen this also in firefox using XHR on linux. Occasionally I get my on.('connect') firing twice for the same user.

Contributor

ericz commented Sep 27, 2011

Ok this is a tricky one to debug.

I'll try to see if theres anything I can do to consistently reproduce =\

On Mon, Sep 26, 2011 at 2:37 PM, Mark Willis <
reply@reply.github.com>wrote:

I have seen this also in firefox using XHR on linux. Occasionally I get my
on.('connect') firing twice for the same user.

Reply to this email directly or view it on GitHub:
#140 (comment)

510-691-3951
EECS Student at UC Berkeley
http://ericzhang.com

Contributor

ericz commented Jan 16, 2012

Are you guys still experience this issue? I have been unsuccessful in reproducing

mikl commented Jan 16, 2012

I'll check with @googletorp to see if he can still reproduce…

I have same problem with XHR polling with Chrome and Safari.
In my tests (with an code)...

1st atempt:
USER CONNECTION> userID=350140591735413215 (a)

2nd atempt:
USER CONNECTION> userID=1708755676295389347 (b)

3rd atempt:
USER CONNECTION> userID=2146661529538663578 (c)
USER CONNECTION> userID=7482988231805102238 (d)

Users 'c' and 'd' are same client. After this, I call methods as if both.
The important part of code: http://pastebin.com/G3rJLG9f

With WebSocket or FlashSocket my code works fine. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment