Skip to content

provide a way to log a stack trace upon abnormal termination #3385

@adk-swisstopo

Description

@adk-swisstopo

For troubleshooting purpose it is often useful to log a stack trace when a process is stuck in an abnormal state. AFAICT with gunicorn asynchronous workers, there is no good way to do that. In geoadmin/service-stac#558 we implemented our own worker class to override handle_exit and dump the stacks there. However that means we get stack traces for graceful terminations too. It would be nice if we could have a way to do that only when the worker exceeds the graceful_timeout upon termination.

One way to resolve this:

  • SIGTERM triggers graceful termination
  • wait graceful_timeout
  • (new) if worker has not completed, trigger a quick shutdown (SIGTINT/SIGQUIT) (handle_quit can be implemented to dump the stacks)
  • (new) wait quick_shutdown_timeout (new setting)
  • SIGKILL

The way Arbiter.stop is implemented currently, the worker only ever receive SIGTERM or SIGQUIT but never both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions