Skip to content

[ZEPPELIN-6561] Restore default SIGINT handler so python paragraph cancel works under daemon launch#5346

Open
HwangRock wants to merge 1 commit into
apache:masterfrom
HwangRock:ZEPPELIN-6561
Open

[ZEPPELIN-6561] Restore default SIGINT handler so python paragraph cancel works under daemon launch#5346
HwangRock wants to merge 1 commit into
apache:masterfrom
HwangRock:ZEPPELIN-6561

Conversation

@HwangRock

@HwangRock HwangRock commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

Cancelling a running %python paragraph has no effect when Zeppelin is started via zeppelin-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() in PythonInterpreter sends SIGINT to the correct python pid, and the interpreter log shows it. The problem is signal disposition inheritance: zeppelin-daemon.sh starts the server with nohup ... & 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 by cancel() is then a no-op. Running signal.getsignal(signal.SIGINT) inside an affected interpreter prints Handlers.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.py when the inherited disposition is SIG_IGN. Starting Zeppelin in the foreground with bin/zeppelin.sh was 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?

  • Automated: testSigintDefaultHandlerRestoredWhenInheritedIgnored in PythonInterpreterTest launches 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 with Handlers.SIG_IGN. Unlike the disabled testCancelIntp, it does not depend on timing.
  • Manual: start Zeppelin with bin/zeppelin-daemon.sh start, run a %python paragraph such as for 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:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants