Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24960] YSQL: Fix pg shutdown handling issue due to incorrect signal…
… blocking Summary: Postgres runs each process with a single thread (mostly), but in yb, each process process starts several yb threads. These threads are meant to block the typical pg signals like `SIGINT`, `SIGTERM` and `SIGQUIT`. However in mac release builds the threads under `ev_run` are unblocking `SIGTERM` causing incorrect handling of the process shutdown. Also in production scenarios pg is never gracefully shutdown. Instead yb-tserver is killed which causes PG to receive `YB_PG_PDEATHSIG` which is `SIGQUIT` (Immediate Shutdown). Whereas in the tests we use `SIGINT` (Fast Shutdown). This means the tests are not actually validating the pg shutdown behavior used in production. This change addresses both issues by switching the graceful yb shutdown to also use `SIGQUIT`. PG also uses `SIGALRM`, which yb threads should block. This has also been addressed. `ProcessSupervisor::Stop` was unnecessarily issuing `SIGINT` several time when the process fails to exit, and only after 1 min uses `SIGQUIT`. With the above changes this logic no longer makes sense, so switching to log warning every 10s and force killing the process with `SIGKILL` after 1min. Changed the `DFATAL` in `YBCInterruptPgGate` and ` `YBCDestroyPgGate` to `FATAL` since if we continue execution there is a high probability of hitting SIGSEGV. Fixes #24960 Jira: DB-14096 Test Plan: Jenkins Reviewers: smishra, telgersma Reviewed By: telgersma Subscribers: yql, svc_phabricator, ybase Differential Revision: https://phorge.dev.yugabyte.com/D40676
- Loading branch information