Bug #2502

fastcgi process became a orphan process

Added by silence 12 months ago. Updated 11 months ago.

Status:FixedStart date:2013-08-06
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:core
Target version:1.4.33
Missing in 1.5.x:No

Description

When lighttpd is starting, mod_fastcgi spawns every fastcgi process.
If users stop the lighttpd when fastcgi is spawning..the spawned fastcgi processes became orphan processes..

Because the lighttpd haven't registered signal handler function before spawning fastcgi process. Once the lighttpd received SIGINT or SIGTERM, the lighttpd process will exit immediately without notifying fastcgi processes

lighttpd_SIGTERM.strace - send SIGTERM to stop lighttpd when spawning fastcgi process (27.5 KB) silence, 2013-08-06 11:07

lighttpd_notmal.strace - send SIGTERM to stop lighttpd when lighttpd is already started (167 KB) silence, 2013-08-06 11:07

Associated revisions

Revision 2901
Added by stbuehler 11 months ago

[core] set signal handlers before forking child processes in modules/plugins_call_set_defaults (fixes #2502)

From: Stefan B├╝hler <>

History

#1 Updated by stbuehler 12 months ago

  • Status changed from New to Need Feedback

show us a strace of lighttpd that proves your statement.

#2 Updated by silence 12 months ago

I uploaded 2 strace files:
1) lighttpd_SIGTERM.strace

send SIGTERM to stop lighttpd when spawning fastcgi process

2) lighttpd_normal.strace

send SIGTERM to stop lighttpd when lighttpd is already started

--------------------------------------------------------------------------------
The signal_handler function is not registered when spawning fastcgi process:

[server.c]
line 937 plugins_call_set_defaults()
           -> mod_fastcgi spawns fastcgi process

line 993 register signal by sigaction() till this line.

#3 Updated by stbuehler 12 months ago

Ok, thx. I'll have a closer look :)

Just two things for your setup (unrelated to the bug):

  • don't put sockets in /tmp - another user could create sockets in /tmp with the same names, and lighttpd would connect to them. use a directory that is only writable by lighttpd, if you spawn with lighttpd
  • your max-procs settings look very high. In such large setups it is probably worth the effort to use spawn-fcgi, perhaps combined with multiwatch

#4 Updated by stbuehler 12 months ago

  • Target version set to 1.4.33

#5 Updated by stbuehler 11 months ago

  • Status changed from Need Feedback to Assigned

#6 Updated by stbuehler 11 months ago

  • Status changed from Assigned to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2901.

Also available in: Atom