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

Grant noreply at github.com
Wed May 13 05:43:20 PDT 2026


  Branch: refs/heads/backport-7504-to-branch-8-6
  Home:   https://github.com/MapServer/MapServer
  Commit: 86cb0ec38adb9d75b01a32e5cc8dbd06fa3ca82c
      https://github.com/MapServer/MapServer/commit/86cb0ec38adb9d75b01a32e5cc8dbd06fa3ca82c
  Author: Grant Slater <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

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