[ZEPPELIN-6561] Restore default SIGINT handler so python paragraph cancel works under daemon launch#5346
Open
HwangRock wants to merge 1 commit into
Open
[ZEPPELIN-6561] Restore default SIGINT handler so python paragraph cancel works under daemon launch#5346HwangRock wants to merge 1 commit into
HwangRock wants to merge 1 commit into
Conversation
…ncel works under daemon launch
jongyoul
approved these changes
Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
Cancelling a running
%pythonparagraph has no effect when Zeppelin is started viazeppelin-daemon.sh: the user code runs to completion and the result is recorded as SUCCESS while the job status becomes ABORT.The cancel plumbing itself works.
cancel()inPythonInterpretersends SIGINT to the correct python pid, and the interpreter log shows it. The problem is signal disposition inheritance:zeppelin-daemon.shstarts the server withnohup ... &from a non-interactive shell, so per POSIX the whole process chain (ZeppelinServer JVM, interpreter JVM, python) inherits SIGINT=SIG_IGN, and CPython keeps SIGINT ignored instead of installing the KeyboardInterrupt handler when it starts with the signal already ignored. The SIGINT sent bycancel()is then a no-op. Runningsignal.getsignal(signal.SIGINT)inside an affected interpreter printsHandlers.SIG_IGN.This cannot be fixed in the shell scripts, since POSIX forbids a non-interactive shell from resetting a signal that was ignored on entry. The fix restores the default SIGINT handler at the top of
zeppelin_python.pywhen the inherited disposition is SIG_IGN. Starting Zeppelin in the foreground withbin/zeppelin.shwas never affected, which is why cancellation appears to work in some environments and not in others.What type of PR is it?
Bug Fix
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6561
How should this be tested?
testSigintDefaultHandlerRestoredWhenInheritedIgnoredinPythonInterpreterTestlaunches the interpreter through a shell wrapper that ignores SIGINT before exec'ing python, reproducing the disposition of a daemon launch, and asserts the default handler is restored inside the interpreter process. Without the fix the assertion fails withHandlers.SIG_IGN. Unlike the disabledtestCancelIntp, it does not depend on timing.bin/zeppelin-daemon.sh start, run a%pythonparagraph such asfor i in range(1, 50): print(i); time.sleep(0.5), and cancel it a few seconds in. Before the fix it runs to 49 and stores SUCCESS. After the fix it stops immediately with a KeyboardInterrupt traceback and ERROR.Screenshots (if appropriate)
Before
2026-07-26.5.23.11.mov
After
2026-07-26.5.47.43.mov
Questions: