Bug 50669

Summary: SIGWINCH kills Apache
Product: Apache httpd-2 Reporter: Chris Wilson (Aptivate) <chris+apache>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P2    
Version: 2.2.14   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Chris Wilson (Aptivate) 2011-01-27 07:02:20 UTC
If you're running Apache in a terminal, in the foreground, and you resize the window, this happens:

chris@fen-desktop2(dev)$ apache2 -f apache/dev.conf  -D FOREGROUND
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Thu Jan 27 12:01:35 2011] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.7 with Suhosin-Patch mod_wsgi/2.8 Python/2.6.5 configured -- resuming normal operations
[Thu Jan 27 12:01:40 2011] [notice] caught SIGWINCH, shutting down gracefully

SIGWINCH indicates a window size change, it should not be fatal.
Comment 1 Ruediger Pluem 2011-01-27 08:28:31 UTC
You are correct that SIGWINCH is used to signal a windows size change to the applications running on a terminal. Due to the lack of other signal numbers and given the fact that httpd normally runs detached from a terminal the SIGWINCH signal was chosen to instruct httpd to do a graceful shutdown. So this works as designed.
Comment 2 user 2016-07-24 13:05:28 UTC
Is there any workaround for this? 

It also affects downstream services, e.g. mod_wsgi which *are* run in the foreground. See f.ex. https://bz.apache.org/bugzilla/show_bug.cgi?id=50669.
Comment 3 user 2016-07-24 13:08:41 UTC
(In reply to user from comment #2)
> Is there any workaround for this? 
> 
> It also affects downstream services, e.g. mod_wsgi which *are* run in the
> foreground. See f.ex. https://bz.apache.org/bugzilla/show_bug.cgi?id=50669.

That URL was supposed to be https://github.com/GrahamDumpleton/mod_wsgi/issues/105 :-(
Comment 4 Olliver 2023-05-31 07:33:28 UTC
@rpluem is this still true 12 years later? Are there no other ways to signal apache without abusing SIGWINCH? Having apache exit after a window change is a bit odd.

One work-around could be, to actually determine the terminal window size, and if it has actually changed, not exit the daemon? That way, you could have both ways. If SIGWINCH is received without any window changes, do what you do now, but if there where window changes, ignore the signal?