What is in Apache 2 a "caught SIGWINCH" error?

Geries picture Geries · Apr 23, 2009 · Viewed 55.2k times · Source

My server (ubuntu 8.04) LAMP running drupal 6, when there is high traffic, it stops serving pages. A restart of apache2 will not work, so I have to restart the service.

I found this message in the apache2 error.log

[notice] caught SIGWINCH, shutting down gracefully

Also I notice that the process id of the apache2, was around 12000 when apache stops responding.

Update

The caught SIGWINCH, as you point out, is a notice of the apache service restarting. I played around with the max clients and keep alive. I set the MaxClients too low so I got a "server reached MaxClients setting, consider raising the MaxClients setting" error, but fixed that.

Regarding the PID, my installation has prefork module installed, so after MaxRequestPerChild is reached, it recycles the child process. That is why the PID is rising periodically. Still haven't figured out why after a while apache stops responding.

In the mean time will try to rise the MaxRequestPerChild so the PID dosen't reach PID max that fast. Current limit is 32768 (which is standard for new debian and ubuntu installations).

Here is more from the log:

[Fri Apr 24 01:48:56 2009] [notice] caught SIGWINCH, shutting down gracefully

[Fri Apr 24 01:50:07 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch configured -- resuming normal operations

[Fri Apr 24 17:13:35 2009] [error] [client 195.70.62.131] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

[Fri Apr 24 17:36:00 2009] [error] [client 212.188.33.4] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

[Sat Apr 25 20:05:07 2009] [error] [client 84.243.222.12] Invalid URI in request GET HTTP/1.1 HTTP/1.1

[Sat Apr 25 20:05:12 2009] [error] [client 84.243.222.12] script not found or unable to stat: /usr/lib/cgi-bin/twiki

[Sat Apr 25 20:05:12 2009] [error] [client 84.243.222.12] script not found or unable to stat: /usr/lib/cgi-bin/wiki

[Sat Apr 25 20:05:12 2009] [error] [client 84.243.222.12] script not found or unable to stat: /usr/lib/cgi-bin/wikis

[Sat Apr 25 21:46:46 2009] [error] [client 211.68.23.167] Invalid URI in request GET HTTP/1.1 HTTP/1.1

[Sun Apr 26 06:13:47 2009] [error] [client 86.39.154.89] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

[Sun Apr 26 06:53:07 2009] [notice] Graceful restart requested, doing restart

Answer

vaab picture vaab · Sep 18, 2015

SIGWINCH

As a matter of fact, @Stefano is right: SIGWINCH means SIGNAL WINDOWS CHANGE and is sent automatically when a terminal detects a change in it's windows size to allow for a redraw.

SIGWINCH for apache2

But unfortunately apache2 process poorly misuses this signal (in the way they divert its first meaning), but for their defense, they seems not to have a choice and had to resort to this due to a lack of signal (see bug report). One of their assumption is that apache2 process is always in background. So @mikl is also perfectly right also.

So, what to check ?

  • any automatic reason to restart gracefully apache2 (cron services, apt-get installations of related services...)
  • otherwise, do you run apache2 in foreground in an open tty ? If yes, this is not recommended (alas), and you'll probably easily hit this SIGWINCH gracefull shutdown quite easily when resizing your controlling terminal.