mod_wstunnel kills child on disconnect after idle-timeout from connection start
gw_backend will kill a child process if it's been unused for more than idle-timeout s and is currently unused. The unused time is calculated based on last_used, however last_used is only updated when the child is spawned, when a client connects, and in gw_recv_response, which from what I understand is used when handling HTTP data. This works fine for something like mod_fastcgi were connections are brief and only handles a single request, however in mod_wstunnel you get long running connections, where the child is then considered to have been idle since the connection started, even though it was just used.
So if you reload a page using a websocket, the child is instantly killed on disconnect, and then immediately restarted when the page connects again. Instead, the child should be killed idle-timeout s after the it was actually used, maybe idle-timeout s after disconnect or idle-timeout s after data was sent on the socket.
- Status changed from New to Invalid
- Target version deleted (
mod_wstunnel connects to a backend socket.
As a convenience, mod_wstunnel can spawn a backend by configuring
"bin-path", and if you are using adaptive spawning, then set
"idle-timeout" appropriate to your use.
documentation: gw_backend - gateway *.server host options
The behavior of your backend, including how it handles signals, is your code, not lighttpd.
- Subject changed from mod_wstunnel instantly kills child on disconnect to mod_wstunnel kills child on disconnect after idle-timeout from connection start
- Status changed from Invalid to Patch Pending
- Target version set to 1.4.56
The unused time is calculated based on last_used, however last_used is only updated when the child is spawned, when a client connects, and in gw_recv_response,
which from what I understand is used when handling HTTP data.
gw_recv_response is used when reading data from the backend, not just for HTTP data.
I have added to
gw_recv_response some additional updates to
However, for long-running backends, it would be better for you to manage the backend(s) yourself, e.g. an independent daemon listening on a socket and not started by lighttpd.
Also available in: Atom