fix: check subprocess exit codes in Java tracer#2064
Open
mashraf-222 wants to merge 1 commit intomainfrom
Open
fix: check subprocess exit codes in Java tracer#2064mashraf-222 wants to merge 1 commit intomainfrom
mashraf-222 wants to merge 1 commit intomainfrom
Conversation
_run_java_with_graceful_timeout() discarded the subprocess exit code in both the no-timeout and timeout paths. If Maven/Gradle failed (compilation error, OOM, etc.), the tracer silently continued with missing/stale data. Now returns the exit code. Stage 1 (JFR profiling) warns on failure but continues. Stage 2 (argument capture) raises RuntimeError since trace data is essential for replay test generation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
_run_java_with_graceful_timeout()intracer.pydiscarded the subprocess exit code entirely. In the no-timeout path,subprocess.run()was called withcheck=Falseand the result was thrown away. In the timeout path,proc.wait()was called butproc.returncodewas never checked.If Maven or Gradle failed (compilation error, OOM, missing dependency), the tracer silently continued with missing or stale data.
Root Cause
Two bugs in
_run_java_with_graceful_timeout():subprocess.run(java_command, env=env, check=False)— no result capturedproc.wait()called butproc.returncodenever inspectedFix
_run_java_with_graceful_timeout()now returnsint(exit code) instead ofNoneJavaTracer.trace()handles exit codes per stage:RuntimeError(trace data is essential)Test Coverage
10 new tests in
test_tracer_exit_codes.py:_run_java_with_graceful_timeout()return values (success, failure, OOM, timeout, SIGTERM/SIGKILL)JavaTracer.trace()caller behavior (Stage 1 fail continues, Stage 2 fail raises, both succeed)Testing