Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.

A Ctrl-C that makes JPype fail with "Fatal error occurred" is a KeyboardInterrupt - #438

Merged
tae898 merged 1 commit into
mainfrom
sigint-udf-interrupt
Oct 21, 2026
Merged

tae898 merged 1 commit into
mainfrom
sigint-udf-interrupt

Conversation

@tae898

@tae898 tae898 commented Oct 21, 2026

Copy link
Copy Markdown

Closes #437.

A Ctrl-C during a statement that calls a Python function reached the caller as ArcadeDBError: Query failed: Fatal error occurred in about 5% of runs, which is the intermittent CI failure of test_sigint_during_a_query_that_calls_python_is_a_keyboard_interrupt (main 9d4db4b darwin/arm64 3.13, PR #407 linux/amd64 3.14). Cause: JPype interrupts the Java thread before it tells Python about the SIGINT (jpype-project/jpype#1496), so its conversion of the engine's exception fails and it raises a plain RuntimeError("Fatal error occurred"). When the KeyboardInterrupt was raised on entering the callback, the bindings had recorded nothing and the RuntimeError is not a Java exception, so it stayed an ArcadeDBError.

The fix is in raise_pending_interrupt: JPype's RuntimeError: Fatal error occurred is treated as the Ctrl-C it means (the callback already did this for an error raised inside the function, now through one shared helper), raised as KeyboardInterrupt with the ArcadeDBError that holds the JPype text as its cause. A test with a stand-in Java database covers query() and command() deterministically and fails on the base every time; a statement that fails for another reason is still an ArcadeDBError. The docs (api/database.md, known-issues.md, development/testing.md) say what a user sees.

Measured on the laptop (linux/amd64, Python 3.14, merged-main wheel, one pytest process per run, two concurrent loops on cores 12-13 and 14-15 under nice -n 10 taskset): the real-signal test failed 15 of 300 runs on the base and 0 of 300 with the fix. Also run: test_python_function_interrupt.py and test_interrupt_hygiene.py (all pass), uvx pre-commit run --files on the changed files, and the strict mkdocs build as in docs-build.yml.

🤖 Generated with Claude Code

…ardInterrupt (#437)

raise_pending_interrupt now maps JPype's RuntimeError("Fatal error occurred") to the KeyboardInterrupt it means, chained from the ArcadeDBError. A KeyboardInterrupt raised on entering a Python function's callback left nothing for the bindings to read, so the statement ended as ArcadeDBError in about 5% of runs of the SIGINT test (15 of 300 before, 0 of 300 after).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898
tae898 merged commit 086614d into main Oct 21, 2026
42 of 44 checks passed
@tae898
tae898 deleted the sigint-udf-interrupt branch October 21, 2026 22:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Ctrl-C during a statement that calls a Python function can arrive as ArcadeDBError: Fatal error occurred

1 participant