Project

General

Profile

Bug #3029

closed

mod_wstunnel kills child on disconnect after idle-timeout from connection start

Added by LinAGKar 29 days ago. Updated 28 days ago.

Status:
Fixed
Priority:
Normal
Category:
mod_wstunnel
Target version:
ASK QUESTIONS IN Forums:
Yes

Description

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.

#1

Updated by gstrauss 29 days ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.x)

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.

#2

Updated by gstrauss 29 days ago

Instead, the child should be killed idle-timeout s after the it was actually used,

yes

maybe idle-timeout s after disconnect

no

or idle-timeout s after data was sent on the socket.

yes

#3

Updated by gstrauss 29 days ago

  • 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,

yes

which from what I understand is used when handling HTTP data.

no. 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 proc->last_used

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.

#4

Updated by gstrauss 28 days ago

  • Status changed from Patch Pending to Fixed

Also available in: Atom