Repository navigation
fix: agent hang on starter failure, and AWS client churn in results reporting - #596
Open
kevin-mcgoldrick wants to merge 2 commits into
Open
kevin-mcgoldrick wants to merge 2 commits into
kevin-mcgoldrick wants to merge 2 commits into
Conversation
Job 15636 on partner never ended: starter threads died with a ConcurrentModificationException from TPSMonitor.getTPSInfo, and TestPlanStarter left done=false on that path. APITestHarness waits for every starter to be done, so the agent never reported Completed and the controller never terminated its instances, even after a stop command or the simulation time elapsed. - TPSMonitor.getTPSInfo is synchronized, and hands the container a copy of its list. Each plan's starter and the status monitor call it concurrently, and each call appends to that list. - TestPlanStarter marks itself done in a finally, and done is volatile. - The two tests that asserted a failed starter is not done now assert the opposite; new tests cover the concurrent callers and both workload types failing in the metrics step. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Agents logged tens of thousands of "Unable to load credentials" and "Unable to load region" errors under load (jobs 15636 and 15637 on partner). Every timing-results batch called DataBaseFactory.getDatabase(), which built a new datasource and so new S3 and CloudWatch clients; each build looks up the region and credentials from the instance metadata service, and those lookups failed when many user threads sent at once. The failure then escaped into the user's request thread, which recorded it as a failed request and dropped the batch. - DatabaseResultsReporter sends through the datasource it made at construction, and logs a send failure instead of throwing it. - S3Datasource looks up the region and hostname once, keeps the per-send settings in locals now that one instance is shared, and drops a batch instead of throwing when the region can't be determined yet. - APITestHarness decides under a lock which thread sends when a send is due, so one does rather than many, and contains a failure from it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
1. Agent no longer hangs when a test plan starter fails
agents sat idle for hours after a stop command and after the simulation time elapsed, and the controller never terminated them.
Cause:
TPSMonitor.getTPSInfo()appends to a sharedArrayList, and every test plan's starter thread and the status monitor call it concurrently. TheTPSInfoContainerconstructor threwConcurrentModificationExceptionwhile iterating it, which killed the starter thread fromsendCloudWatchMetrics.TestPlanStarterleftdone = falseon that path, andAPITestHarnesswaits for every starter to be done. So the agent never logged "Test Complete", never reportedCompleted, andVMTerminatorImpl.terminatenever ran.Fix
TPSMonitor.getTPSInfo()is synchronized and returns a container built from a copy of its list.TestPlanStartersetsdone = truein afinally, anddoneisvolatile.Tests
getTPSInfocallers, and a failing metrics step for both the linear and nonlinear workloads.ConcurrentModificationException.2. Stop building AWS clients per results batch
On jobs 15636 and 15637, agents logged tens of thousands of
Unable to load credentialsandUnable to load regionerrors. Every timing-results batch calledDataBaseFactory.getDatabase(), which built new S3 and CloudWatch clients. Each build looks up region and credentials from the instance metadata service (IMDS), and those lookups failed when many user threads sent at once. The failure then escaped into the user's request thread, which recorded it as a failed request and dropped the batch.Fix
DatabaseResultsReportersends through the datasource built at construction, and logs a send failure instead of throwing it.S3Datasourcelooks up region and hostname once, keeps per-send settings in locals now that one instance is shared, and drops a batch instead of throwing if the region isn't known yet.APITestHarnessdecides under a lock which thread sends when a send is due, so one does rather than many, and contains a failure from the send.Tests
DatabaseResultsReporterTest, plus twoAPITestHarnessTesttests (one send among many threads; a reporter failure doesn't reach the calling thread).Not included / not verified
Completedonce simulation time is met and no user threads are alive.S3Datasourceitself has no unit test: its client is built in the constructor against real AWS config, so it is covered through the reporter./tank/agent/agent.logforUnable to load credentialsandUnable to load region.DataBaseFactorystill falls back toCloudWatchDataSourceif the configured provider fails to construct, and the reporter keeps whichever it got for the job.🤖 Generated with Claude Code