bvolpato opened a new pull request, #39621: URL: https://github.com/apache/beam/pull/39621
`ExampleEchoPipelineTest` intermittently fails on Linux while launching a freshly copied shell executable: ``` java.io.IOException: Cannot run program ".../test-EchoAgain....sh": Exec failed, error: 26 (Text file busy) ``` This occurred twice in scheduled Java precommit runs, including https://github.com/apache/beam/actions/runs/30802709511. `FileUtils.copyFileFromGCSToWorker` currently copies directly to the executable's final path. Its in-process lock does not protect separate classloaders or worker processes sharing that path, so another process can try to execute the destination while it is still open for writing. This change stages each executable in a temporary sibling file, makes the staged file executable, then atomically replaces the destination. Readers therefore see either the previous complete executable or the new complete executable. Launch retries are intentionally avoided so unrelated `ProcessBuilder` failures remain visible. ## Reproduction A focused Linux regression test holds the previous destination inode open for writing while publishing its replacement, then launches the destination path. Before this change it fails deterministically with `error=26, Text file busy`; after this change it succeeds. ## Testing - `FileUtilsTest` and `ExampleEchoPipelineTest`: 10 consecutive passes - `./gradlew :examples:java:spotlessCheck :examples:java:checkstyleMain :examples:java:checkstyleTest --no-build-cache` - Full `:examples:java:test` attempted: 69 tests passed; unrelated `KafkaToPubsubE2ETest` class setup could not start because Docker is unavailable locally -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
