PG backend not canceled when ruby process is killed

Issue #224 wontfix
Former user created an issue

If a ruby process using ruby-pg > 0.17.1 is killed during a long queries by a SIGKILL (eg a Unicorn Timeout), the query is not canceled and continue to run in DB.

Before 0.17.1, the query was canceled when the process was killed.

Is there a solution to have this behaviour with 0.18.x ?

Comments (2)

  1. Lars Kanis

    Queries were canceled when a signal arrived in a blocking function. This was introduced in pg-0.16.0, but removed in 0.17.1 due to this discussion:

    Unfortunately this now delays signal processing until the currently running query is finished. This delay can be avoided by using non-blocking functions (async_exec instead of exec). Is it an option to change your program accordingly?

    However SIGKILL is not handled by the Ruby process, but by the OS, only. Therefore in theory, the OS should terminate the TCP- or UNIX socket connection and the DBMS should cancel the query eventually.

  2. Log in to comment