Skip to content

Conversation

@keithpine
Copy link
Contributor

What this PR does / why we need it

Adds exec to the entrypoint script so that the Graylog server process becomes PID 1. This allows the server to gracefaully handle Pod termination signals and shutdown quickly. Without the exec, the shell script swallows the signal (does not pass to child processes) and the Pod is forcibly terminated after the terminationGracePeriodSeconds setting (usually 2 minutes).

Compare to the upstream entrypoint script which already uses exec: https://github.com/Graylog2/graylog-docker/blob/1d774e6623d1cf34fb2c6a8fc72e22ee75787218/docker-entrypoint.sh#L91-L99

Graylog server Pod log with fix showing graceful shutdown:

{"instant":{"epochSecond":1758040439,"nanoOfSecond":194707442},"thread":"Thread-3","level":"INFO","loggerName":"org.graylog2.commands.Server","message":"SIGNAL received. Shutting down.","endOfBatch":false,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","threadId":148,"threadPriority":5}
{"instant":{"epochSecond":1758040439,"nanoOfSecond":198652166},"thread":"Thread-3","level":"INFO","loggerName":"org.graylog2.system.shutdown.GracefulShutdown","message":"Graceful shutdown initiated.","endOfBatch":false,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","threadId":148,"threadPriority":5}

There are no server logs without the graceful shutdown.

And k8s event logging, with fix, Pod is stopped and re-assigned in about 8 seconds:

2025-09-16T16:33:59Z   2025-09-16T16:33:59Z   1       kubelet             Normal   Killing     Stopping container graylog-server
2025-09-16T16:34:07Z   2025-09-16T16:34:07Z   1       default-scheduler   Normal   Scheduled   Successfully assigned logging/graylog-2 to <redacted>

Compared to no fix, Pod is stopped and re-assigned in 2 minutes after termination grace period:

2025-09-16T16:41:55Z   2025-09-16T16:41:55Z   1       kubelet             Normal    Killing     Stopping container graylog-server
2025-09-16T16:43:55Z   2025-09-16T16:43:55Z   1       default-scheduler   Normal    Scheduled   Successfully assigned logging/graylog-2 to <redacted>

Which issue this PR fixes

none

Special notes for your reviewer

none

Checklist

  • DCO signed
  • Chart Version bumped

@keithpine keithpine marked this pull request as ready for review September 16, 2025 16:58
@keithpine keithpine force-pushed the fix-graceful-termination branch from 4d6f2ce to 985c0ec Compare September 16, 2025 17:04
@keithpine keithpine force-pushed the fix-graceful-termination branch from 985c0ec to 5f694aa Compare September 16, 2025 17:06
Copy link
Owner

@KongZ KongZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you solve the conflict?

@KongZ KongZ merged commit 52e1298 into KongZ:main Sep 17, 2025
0 of 2 checks passed
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.

2 participants