Fix mobile gaming release validation background process cleanup for Java 21 compatibility - #39657
Closed
damccorm wants to merge 1 commit into
Closed
Fix mobile gaming release validation background process cleanup for Java 21 compatibility#39657damccorm wants to merge 1 commit into
damccorm wants to merge 1 commit into
Conversation
…ava 21 compatibility In Java 20+, Thread.stop() unconditionally throws UnsupportedOperationException. This caused mobile gaming validation scripts to fail when stopping background injector and leaderboard threads, leaving the child processes running as orphans and causing the nightly snapshot validation workflow to hang and time out at 6 hours. This change introduces Process-based background execution and cleanup in TestScripts to properly terminate background processes across Java versions.
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.
Description
In Java 20+,
Thread.stop()unconditionally throwsjava.lang.UnsupportedOperationException(JEP 421).Following the CI upgrade to Java 21 in #39205, the
beam_PostRelease_NightlySnapshotvalidation workflow began timing out at 6 hours becausemobilegaming-java-direct.groovyandmobilegaming-java-dataflow.groovyrelied onThread.stop()to stop background injector and leaderboard threads.When
Thread.stop()threwUnsupportedOperationException, the main test thread crashed and left the backgroundInjectorprocess running indefinitely as an orphan, publishing messages to Pub/Sub and hanging the build until the 6-hour execution timeout was hit.This change:
runBackground,stopProcess, andstopAllBackgroundProcessestoTestScripts.groovyto manage and cleanly terminate child background processes (and their process trees) using Java'sProcessHandleAPIs.TestScriptsto guarantee all spawned background processes are forcibly destroyed when the script finishes or exits.mobilegaming-java-direct.groovyandmobilegaming-java-dataflow.groovyto uset.runBackgroundandt.stopProcess.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.