Skip to content

Fix restart-under-load test race - #7976

Open
jantekb wants to merge 1 commit into
masterfrom
bugfix/7974
Open

jantekb wants to merge 1 commit into
masterfrom
bugfix/7974

Conversation

@jantekb

@jantekb jantekb commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

#7974

What changed

  • Wait for sudo service antmedia restart to complete before reading the process exit code.
  • Make the load-thread coordination flags visible across threads.
  • Always stop the HTTP load thread in a finally block.
  • Close HTTP clients and responses created by the load thread.

Root cause

AppFunctionalV2Test.execute() returns once the Process object is created, but testRestartServerUnderHttpLoad() immediately called exitValue(). If the restart was still running, Java threw IllegalThreadStateException. The asynchronous restart then continued and caused cascading failures in later tests while AMS was initializing or enforcing its restored IP filter settings.

Validation

  • mvn -DskipTests test-compile -Dgpg.skip=true -Djarsigner.skip=true -Dmaven.javadoc.skip=true
  • git diff --check

The full integration method was not run locally because it invokes sudo service antmedia restart against the installed server.

Fixes #7974

@jantekb
jantekb marked this pull request as ready for review July 23, 2026 12:20
Process process = AppFunctionalV2Test.execute("sudo service antmedia restart");
assertEquals(0, process.exitValue());
Process process = AppFunctionalV2Test.execute("sudo service antmedia restart");
Awaitility.await().atMost(60, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the main point of the fix, adding a wait time until the command itself finishes

@jantekb jantekb left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@jantekb
jantekb requested a review from burak-58 July 23, 2026 12:26
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

Flaky test: testRestartServerUnderHttpLoad checks exitValue before restart completes

1 participant