You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
start_jvm: kill -TERM crashes the process (SIGSEGV in JPype's TERM handler), and the docs say it runs the shutdown hooks #185
With interrupt=False (the default since #133), kill -TERM on a Python process that started the JVM through the bindings crashes it instead of running the JVM's shutdown hooks. The JVM's "SIGTERM handler" thread, JPype's TERM handler, calls PyErr_SetInterruptEx without the GIL and hits SIGSEGV in PyObject_RichCompareBool: exit status -6 and ./log/hs_err_pid*.log written. It reproduced 4 out of 4 times, with a JVM only 0.5 s old and no databases, found while fixing #179.
A Python signal.signal(SIGTERM, handler) registered after start_jvm avoids the crash (the handler runs, exit 0).
The sentence "kill -TERM ... ends the process at once, through the JVM's shutdown hooks" in docs/api/jvm.md and in the start_jvm docstring is wrong as written. Needs: a reproduction test (start the JVM, send SIGTERM, assert a clean exit and no hs_err file), the fix (register a Python SIGTERM handler in start_jvm, or document the crash and the workaround), and the doc sentences corrected. The root cause is in JPype 1.7.1, so also a JPype issue (not filed yet).
The crash is JPype's: its TERM handler calls PyErr_SetInterruptEx without the GIL (tracked at jpype-project/jpype#1497). What was ours was the docs saying the shutdown hooks run, and #200 fixed that: the known-issues page now documents the SIGTERM crash with its workaround. Nothing else is actionable here until JPype fixes it, so closing; reopen if it still crashes after a JPype release that claims the fix.
Activity
tae898 commentedon Oct 10, 2026
The crash is JPype's: its TERM handler calls
PyErr_SetInterruptExwithout the GIL (tracked at jpype-project/jpype#1497). What was ours was the docs saying the shutdown hooks run, and #200 fixed that: the known-issues page now documents the SIGTERM crash with its workaround. Nothing else is actionable here until JPype fixes it, so closing; reopen if it still crashes after a JPype release that claims the fix.