Skip to content

Fix flaky stderr race condition in ExternalParserTest nightly integration test#1280

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-integration-test-suite-failure
Draft

Fix flaky stderr race condition in ExternalParserTest nightly integration test#1280
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-integration-test-suite-failure

Conversation

Copilot AI commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

ExternalParserTest.testInFileOutFile was intermittently failing with expected: <StdErrAfter> but was: <null> because SystemCommand reads stdout and stderr on separate threads, and execute() can return before the stderr listener thread has finished draining its final line.

Root cause

assertMetadata already had a retry loop for field2 (stdout_after) to tolerate this race, but field4 (stderr_after) had no such guard. Even after the stdout retry loop resolves field2, the stderr thread may still be processing StdErrAfter:field4.

Fix

Added an equivalent retry loop for field4 in assertMetadata:

// existing pattern for field2 (stdout_after)
var field2 = meta.getString("field2");
var maxAttempts = 10;
while (field2 == null && --maxAttempts >= 0) { Thread.sleep(50); ... }
Assertions.assertEquals("StdoutAfter", field2);

// new: same pattern for field4 (stderr_after)
var field4 = meta.getString("field4");
var maxAttemptsField4 = 10;
while (field4 == null && --maxAttemptsField4 >= 0) { Thread.sleep(50); ... }
Assertions.assertEquals("StdErrAfter", field4);

Copilot AI changed the title [WIP] Fix failing GitHub Actions job Integration Test Suite (Nightly) Fix flaky stderr race condition in ExternalParserTest nightly integration test Jun 28, 2026
Copilot AI requested a review from essiembre June 28, 2026 04:08
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