getsentry / snuba

Search the seas for your lost treasure.
Other
338 stars 56 forks source link

rust-consumer does not receive signals #6031

Closed doc-sheet closed 1 month ago

doc-sheet commented 3 months ago

Environment

snuba 24.5.1 from https://github.com/getsentry/self-hosted

Steps to Reproduce

  1. run some rust-consumer, for example
    snuba rust-consumer --storage spans --consumer-group snuba-spans-consumers --auto-offset-reset=latest --max-batch-time-ms 1000 --no-strict-offset-reset
  2. send SIGTERM to main process with kill -s SIGTERM <pid> or just do docker stop snuba-spans-consumer
  3. check exit code / docker events

Expected Result

Consumer gracefully stops

Actual Result

Container killed by sigkill

Looks like master process does not propagate signals to rust consumer. For example python version has some handlers for it.

untitaker commented 3 months ago

The handler for Rust is here: https://github.com/getsentry/snuba/blob/869e1a7a063581ee5284bab315498630bff106df/rust_snuba/src/consumer.rs#L242

it seems it may only handle SIGINT and not SIGTERM, but it's not clear.

Patches welcome