[mapserver-commits] [MapServer/MapServer] 9e1ae0: mapserv: exit FastCGI loop promptly on SIGTERM/SIG...

Grant noreply at github.com
Wed May 13 05:42:37 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/MapServer/MapServer
  Commit: 9e1ae01f66e9070721a5a7b6882117cc022d7967
      https://github.com/MapServer/MapServer/commit/9e1ae01f66e9070721a5a7b6882117cc022d7967
  Author: Grant <github at firefishy.com>
  Date:   2026-05-13 (Wed, 13 May 2026)

  Changed paths:
    M src/apps/mapserv.c

  Log Message:
  -----------
  mapserv: exit FastCGI loop promptly on SIGTERM/SIGUSR1 (#7504)

When mapserv is built with FastCGI and is idle inside FCGI_Accept(),
SIGTERM only sets finish_process=1 and is masked by the SA_RESTART
default of signal(), so the blocking accept()/select() resumes and the
process appears hung until the next request arrives.

Call FCGX_ShutdownPending() from the handler (signal-safe; sets
libfcgi's internal shutdown flag) and install handlers via sigaction()
with sa_flags=0 so the syscall returns EINTR. libfcgi then returns -1
from FCGI_Accept() and the loop exits cleanly.

Assisted-by: GitHub Copilot (Claude Opus 4.7)

Co-authored-by: Even Rouault <even.rouault at spatialys.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MapServer/MapServer/settings/notifications


More information about the MapServer-commits mailing list