Need workaround for increasing firefox ghost websocket connections count

349 views
Skip to first unread message

Vitaly Puzrin

unread,
Jun 26, 2012, 11:55:28 AM6/26/12
to faye-...@googlegroups.com
I have reproduceable bug with faye & firefox13. When page is refreshed multiple times, all websocket connections are left as ESTABLISHED (looked with netstat). Page close does not help. Connections exists until browsed closed. Is there any way to hang up those on server side?

James Coglan

unread,
Jul 1, 2012, 3:00:19 PM7/1/12
to faye-...@googlegroups.com
On 26 June 2012 16:55, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
I have reproduceable bug with faye & firefox13. When page is refreshed multiple times, all websocket connections are left as ESTABLISHED (looked with netstat). Page close does not help. Connections exists until browsed closed. Is there any way to hang up those on server side?

This ought to help -- the server should close the connection when the client is detected as being offline


Can you try it out for me? 

Vitaly Puzrin

unread,
Jul 1, 2012, 10:52:05 PM7/1/12
to faye-...@googlegroups.com
Added your patch.

1. If i open multiple tabs in FF, then close those those - everything seems ok.
2. If i refresh one tab - ghost connections appears, that don't disappear, when i close tab

May be, problem is, that we use the same secret publish/subscribe channels for communications for all tabs in client.
It's generated on server side, and then each browser cache it with page content. I know, that such cache is security hole,
but it's just a way to make the same IDs for the same users, until we did right authentication.

Vitaly.


воскресенье, 1 июля 2012 г., 23:00:19 UTC+4 пользователь James Coglan написал:

James Coglan

unread,
Jul 2, 2012, 5:24:17 AM7/2/12
to faye-...@googlegroups.com
On 2 July 2012 03:52, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
1. If i open multiple tabs in FF, then close those those - everything seems ok.
2. If i refresh one tab - ghost connections appears, that don't disappear, when i close tab

Can you tell me how I can see these for myself? Do you know if the clients are sending explicit disconnect messages, or are the stale sessions being timed out by the server? 

Vitaly Puzrin

unread,
Jul 2, 2012, 5:46:08 AM7/2/12
to faye-...@googlegroups.com
"netstat -n | grep YOUR_IP" (under linux)

State is ESTABLISHED - forever, until browser completely closed. Not TIMED_OUT or WAIT_FIN2
I think, you can easily reproduce those your self, with firefox & nodejs. Because issue exists in SocksJS tracker, and mozilla bugtracker.

https://bugzilla.mozilla.org/show_bug.cgi?id=696085
https://github.com/sockjs/sockjs-client/issues/28

What help do you need to reproduce problem? Under ubuntu 12.04, run nodejs app, where client subscribe to some channels. Open in filerox and refresh tab several time. You will  see, that connections, related to http files will expires soon, but each reload will increase ESTABLISHED connections count by 1.

If it's not enougth, and you need minimal example, i'll ask ixti to do one.

Vitaly

понедельник, 2 июля 2012 г., 13:24:17 UTC+4 пользователь James Coglan написал:

James Coglan

unread,
Jul 2, 2012, 4:29:26 PM7/2/12
to faye-...@googlegroups.com
On 2 July 2012 10:46, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
"netstat -n | grep YOUR_IP" (under linux)

State is ESTABLISHED - forever, until browser completely closed. Not TIMED_OUT or WAIT_FIN2
I think, you can easily reproduce those your self, with firefox & nodejs. Because issue exists in SocksJS tracker, and mozilla bugtracker.

https://bugzilla.mozilla.org/show_bug.cgi?id=696085
https://github.com/sockjs/sockjs-client/issues/28

What help do you need to reproduce problem? Under ubuntu 12.04, run nodejs app, where client subscribe to some channels. Open in filerox and refresh tab several time. You will  see, that connections, related to http files will expires soon, but each reload will increase ESTABLISHED connections count by 1.

I still can't reproduce this. Using current master, the number of lingering connections is better than on 0.8.2, but under neither version does the number of connections increase on every page load, and they don't hang around for ever -- if I leave the page open long enough the connections begin to drop off. Preventing WebSocket from connection after beforeunload has fired doesn't seem to make a difference. 

James Coglan

unread,
Jul 2, 2012, 4:53:58 PM7/2/12
to faye-...@googlegroups.com
On 2 July 2012 21:29, James Coglan <jco...@gmail.com> wrote:
On 2 July 2012 10:46, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
What help do you need to reproduce problem? Under ubuntu 12.04, run nodejs app, where client subscribe to some channels. Open in filerox and refresh tab several time. You will  see, that connections, related to http files will expires soon, but each reload will increase ESTABLISHED connections count by 1.

I still can't reproduce this.

I've committed this, it seems to make a bit of a difference for me. Can you try it out and let me know how it goes?

Vitaly Puzrin

unread,
Jul 3, 2012, 8:34:22 AM7/3/12
to faye-...@googlegroups.com
Applied your patch. We also updated timeouts according to your explanation, and did unique client_id on each reload, to exclude possible interference on app level. I noticed very small decrease of ghost connections count after page refresh (~10-20%), but this effect is not so significant in global, to celebrate victory :)

By the way, "online connections" counter is correct (it was also correct before patches). It does not increase after reload. Sorry, that missed such info earlier.
https://github.com/fontello/fontello/blob/master/lib/init/server/realtime.js#L189 - implementation, just 2 lines,

So problem is, that faye itself correctly tracks connections on app level (connect/disconnect events are ok), but fails to kill ws resources. Can it be helpeful?

Vitaly

вторник, 3 июля 2012 г., 0:53:58 UTC+4 пользователь James Coglan написал:

James Coglan

unread,
Jul 3, 2012, 8:38:17 AM7/3/12
to faye-...@googlegroups.com
On 3 July 2012 13:34, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
By the way, "online connections" counter is correct (it was also correct before patches). It does not increase after reload. Sorry, that missed such info earlier.
https://github.com/fontello/fontello/blob/master/lib/init/server/realtime.js#L189 - implementation, just 2 lines,

So problem is, that faye itself correctly tracks connections on app level (connect/disconnect events are ok), but fails to kill ws resources. Can it be helpeful?

Sorry, I'm not sure what you mean. What's the problem, how do I reproduce it, and how should Faye's behavious change? 

Vitaly Puzrin

unread,
Jul 3, 2012, 9:07:07 AM7/3/12
to faye-...@googlegroups.com
I mean, that faye correctly counts real active connections, and ghost one does not affect this counter. When i refresh page in firefox,
"online user" counter stays intact, while ghost connections increase.

Ok, James, I see, that it would be more productive to make a minimalistic sample for you, that will help to reproduce problem on your side.
Can we freeze it for 1 week? I'd like to finish some of our internal tasks before.

Vitaly.

вторник, 3 июля 2012 г., 16:38:17 UTC+4 пользователь James Coglan написал:

James Coglan

unread,
Jul 3, 2012, 3:04:39 PM7/3/12
to faye-...@googlegroups.com
On 3 July 2012 14:07, Vitaly Puzrin <vit...@rcdesign.ru> wrote:
I mean, that faye correctly counts real active connections, and ghost one does not affect this counter. When i refresh page in firefox,
"online user" counter stays intact, while ghost connections increase.

I'm still not sure what you mean -- Faye does not provide an API for counting connections.
 
Ok, James, I see, that it would be more productive to make a minimalistic sample for you, that will help to reproduce problem on your side.
Can we freeze it for 1 week? I'd like to finish some of our internal tasks before.

I just need you to clarify what the problem is, I thought the lingering connection problem had been fixed. 

Vitaly Puzrin

unread,
Jul 14, 2012, 6:21:39 AM7/14/12
to faye-...@googlegroups.com
James, I've  reinstalled faye modules from scratch, with your latest snapshots.

Can't reproduce those bug anymore on my ubuntu 12.04. The only difference was, that previous install
has patched serverside files, and new one - all generated with script.

Since problem is not reproduceable (or, at least, not noticeable), i think, we can mark it as solved.

вторник, 3 июля 2012 г., 23:04:39 UTC+4 пользователь James Coglan написал:
Reply all
Reply to author
Forward
0 new messages