Skip to content

[ZEPPELIN-6482] guarantee system restoration when execution fails - #5418

Open
gyowoo1113 wants to merge 4 commits into
apache:masterfrom
gyowoo1113:ZEPPELIN-6482-guarantee-system-restoration-when-execution-fails
Open

[ZEPPELIN-6482] guarantee system restoration when execution fails#5418
gyowoo1113 wants to merge 4 commits into
apache:masterfrom
gyowoo1113:ZEPPELIN-6482-guarantee-system-restoration-when-execution-fails

Conversation

@gyowoo1113

Copy link
Copy Markdown
Contributor

What is this PR for?

StaticRepl.execute() temporarily redirects System.out and System.err to capture user program output. However, if compiler.getTask(...) or CompilationTask.call() throws an unexpected exception before the existing restoration logic is reached, the global streams can remain redirected.

This PR wraps the redirected-stream section in an outer try/finally so System.out and System.err are always restored to their original streams. A regression test was also added to verify that the streams are restored when CompilationTask.call() throws unexpectedly.

What type of PR is it?

Bug Fix

Todos

  • - Wrap stream redirection in an outer try/finally to guarantee restoration
  • - Add a compiler-injection overload for deterministic failure testing
  • - Add Mockito as a test dependency to the java module
  • - Add a regression test for CompilationTask.call() failure

What is the Jira issue?

[ZEPPELIN-6482]

How should this be tested?

./mvnw test -pl java passes successfully.

Screenshots (if appropriate)

N/A

Questions:

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

@gyowoo1113 gyowoo1113 changed the title Zeppelin 6482 guarantee system restoration when execution fails [ZEPPELIN-6482] guarantee system restoration when execution fails Aug 13, 2026
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.

1 participant