disconnect / apache-websocket

Apache WebSocket module
Apache License 2.0
196 stars 46 forks source link

Connection closed on Echo after a couple of seconds #8

Closed baberone closed 12 years ago

baberone commented 12 years ago

Hi, I've been testing your apache-websocket library and it has been up and running very smoothly! Nice work!

Still I have a couple of questions: when testing the echo exemple I noticed that the connection is closed after a couple of seconds (seems like around 10 seconds). I've been trying with FF 10 and Chrome 16 on Windows.

I've also updated the Apache2 config and have disabled KeepAlive and set KeepAliveTimeout to 60, but none of these seems to help. I've also looked at the javascript and c code but couldn't find anything (or a overlooked it). I've enabled both websocket and websocket_draft76... (Apache is running on Ubuntu (Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.1 with Suhosin-Patch configured) - could the Suhosin patch be part of the problem ?

Do you have any idea for to overcome this timeout or connection closing ?

Next I've been trying to play with the dumb-increment module but it just couldn't/wouldn't work. I've even put the test html file from libwebsockets and the apache (with some tuning to point to the /increment path) but didn't work. Do I have to use (read install and configure) the libwebsockets and enabled them in Apache to make this work ?

I'm looking to build my own plugin but I first would like to have both examples working :)

Thanks for any feedback !

disconnect commented 12 years ago

The connection closing after about 10 seconds seems pretty odd. Does it close the connection regardless to how much traffic it is seeing? Is the time of 10 seconds (or whatever it is exactly) pretty consistent? Have you tried running it from a browser on a different computer? You could try disabling the Suhosin patch to see if that makes a difference.

You should find out how the connection is being closed. Is the module shutting down the connection cleanly (add some debug messages) or is it possibly being killed by another process?

As for the dumb-increment plugin, I've added a sample test client that uses the protocol (increment.html in the examples directory). See if the connection is closed with this client. Also, does it close at the same time when it does close the connection?

baberone commented 12 years ago

Well I've done some extended testing and here is what I found out:

Dumb-increment plugin works great now. I've recompiled the modules and with that plugin it seems there is no disconnection. For the echo plugin, the disconnection is not always consistent: if i send a message per seconds, around 10-15seconds later I'm disconnected, even if the last message was a second ago. But if I hit quickly and repeatedly some characters and the enter key, I've been able to keep it open up to 80 seconds (wasn't easy :).

This being said, I've runned a grep on the Apache config files, looking for '10' and... found a hit in 'reqtimeout.conf".

I've changed the RequestReadTimeout body=10,minrate=500 to RequestReadTimeout body=120,minrate=500 and the disconnection occured only after 120seconds :)

I found why the hell it was disconnecting!

Thanks for the dumb-increment example ! The fact that this was working made me believe there was something odd on the Apache side!

ghost commented 9 years ago

To me remains unresolved the question of the timeout, forgive me if I missed something. Changing RequestReadTimeout only changes the timeout value, does not eliminate it. The connection is still closing after RequestReadTimeout seconds. Within the mod_websocket.c program, line 962, there is a command to disable the timeout: apr_socket_timeout_set (ap_get_module_config (r-> connection-> conn_config, & core_module) -1); which I think is the way to actually disable the timeout to websocket,right? if so, it is not working. Even the program going through this line (I checked it with debug), the timeout continues to exists as the RequestReadTimeout value. I am testing it via echo example, in FF 34.0 and Chrome 38.0.2125.111. Thanks in advance for any tips on how to eliminate the timeout in the websocket module.