Skip to content

fix(tls): install the SIGHUP handler before the listener is announced - #489

Merged
ndreno merged 2 commits into
mainfrom
fix/tls-reload-signal
Nov 26, 2026
Merged

ndreno merged 2 commits into
mainfrom
fix/tls-reload-signal

Conversation

@ndreno

@ndreno ndreno commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

listener_tls.rs's files_that_do_not_load_leave_the_previous_configuration failed once on CI (#485's run): the gateway never logged the reload failure the test waits for after its SIGHUP.

Cause. tls::reload registered its SIGHUP handler and took the files' fingerprint on its first poll, and serve spawned it after printing listening on. The test sends SIGHUP as soon as that line appears, so the signal could arrive before the handler existed. On CI the runner ignores SIGHUP, so the signal was dropped; elsewhere the default action ends the process, so a SIGHUP right after startup stopped the gateway.

Fix.

  • tls::reload sets up the handler and the fingerprint when it is called and returns the watch loop as a future.
  • serve calls it right after building the TLS configuration, before the listener is announced.

Test. a_sighup_before_the_first_poll_reloads (unit, Unix) calls reload, sends SIGHUP to the test process before the future first runs, then polls it and expects the configuration to be replaced. With the setup moved back into the future, the test process dies of SIGHUP.

Ran locally: tls::tests (4) and listener_tls (7).

The TLS reload task registered its SIGHUP handler and took the files'
fingerprint on its first poll, after `listening on` was printed. A SIGHUP
sent in between was lost (CI, where the runner ignores SIGHUP) or ended
the process (the default action), and `files_that_do_not_load_leave_the_
previous_configuration` failed now and then. `tls::reload` now sets both
up when called, and serve calls it before announcing the listener.

a_sighup_before_the_first_poll_reloads raises SIGHUP between the call and
the first poll; with the setup moved back into the future the test process
dies of SIGHUP.
@ndreno
ndreno merged commit 7774e9f into main Nov 26, 2026
31 checks passed
@ndreno
ndreno deleted the fix/tls-reload-signal branch November 26, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant