Artifact upload socket write remains blocked after server timeout; build cancellation cannot release agent (TeamCity 2026.2)
Hello JetBrains Support,
We are investigating an iOS build that remained in “Publishing artifacts” for more than 50 hours. The server recorded an artifact upload read timeout, but the agent remained blocked writing the upload. Both the configured build timeout and subsequent manual cancellation failed to release the agent.
Environment
- TeamCity server: 2026.2, build 238924.
- Affected agent: mac-studio, macOS, Apple Silicon; OpenJDK 21.0.10.
- Agent JVM options include -Xmx2048m and -XX:+DisableAttachMechanism.
- Build configuration: IOS_Dev; build number 9832; internal build ID 65655.
- Server log timezone: UTC+7. Agent log timezone: EEST / UTC+3 (Asia/Nicosia). The two logs differ by four hours.
- Artifacts: an HTML test report and a dSYM ZIP, approximately 191 MB.
- Publication uses WebPublisher and ArtifactsCachePublisherImpl.
Observed sequence (20 September 2026; times below are UTC+7)
1. 20:14:11: build started.
2. 20:36:16: the Fastlane process exited successfully with code 0. The application upload to App Store Connect had also succeeded.
3. 20:36:23: publication of internal artifacts completed successfully.
4. 20:36:27: publication of the HTML report and dSYM ZIP started, after approximately three seconds of archive preprocessing.
5. 20:39:41: the server logged “Failed to upload artifact for build with id: 65655” and SocketTimeoutException for POST /httpAuth/artefactUpload.html. The nested stack trace shows Tomcat timing out while reading the request body.
6. 22:14:23: the agent's configured 120-minute build timeout fired. It interrupted artifact publication and advanced to FinishBuildOnAgentFStage, but did not complete build finalization.
7. Stop attempts continued approximately every ten minutes. Manual stopBuild commands on 22 September were received and acknowledged, but did not release the build. Attempt 298 was logged at 23:45:31 on 22 September.
Thread dump findings
We collected three agent JVM dumps on 22 September at 19:41:16, 19:41:26, and 19:41:36 EEST (23:41:16–23:41:36 UTC+7). All three show the same relevant stacks:
- The “Agent Log Proxy” thread is executing “Publishing 1 files to 'app.dSYM.zip'” for build 65655. Its stack is in WebPublisher -> multipart request body write -> SocketOutputStream.write -> NioSocketImpl.implWrite -> Net.poll.
- This thread holds monitor 0x000000037ff76a38 inside AgentLogProxyImpl$LaterExecutorTask.flushMessages.
- The build thread is BLOCKED waiting for the same monitor in AgentLogProxyImpl.hasPendingBuildFinishedCommand, called from BuildAgentImpl.ensureBuildFinishedDeliveredAndReleaseBuildData and FinishBuildOnAgentFStage.
This appears to explain why build finalization cannot proceed after cancellation. We are not claiming a cyclic Java deadlock: the observed dependency is a monitor held across a stalled socket write. The initial cause of the transfer stall remains unknown.
Additional evidence
- The server has two earlier artifact upload read timeouts: build 64111 on 7 September and build 64835 on 14 September. Both with TeamCity Agent 2026.1.3. We have not established that those incidents had the same cancellation failure.
Questions
1. Is this blocked WebPublisher / AgentLogProxyImpl cancellation behavior a known issue, and is there a fix or supported workaround?
2. Should cancellation or the upload timeout close the underlying upload socket so that the AgentLogProxyImpl monitor can be released?
3. Which supported timeout settings, debug logging categories, or diagnostics would you recommend for distinguishing a network stall from a server-side issue? We would prefer not to increase timeouts without understanding the cause.
4. What is the recommended recovery procedure for an agent stuck in FinishBuildOnAgentFStage after stopBuild has been acknowledged?
Attachments - Upload id: 2026_09_22_dteTR6fKGSvoesjwivrnnT (file: teamcity-support-evidence.zip)
- 01-server-upload-timeouts.txt: the full exception blocks for the three server-side upload failures, plus request error records.
- 02-agent-publication-and-cancellation.txt: internal artifact completion, user artifact publication start, timeout handling, and later stop attempts.
- 03-agent-thread-dump-excerpts.txt: both relevant threads from each of the three JVM dumps, preserving their monitor IDs.
These are selected excerpts from the original logs. Public IPs and the agent user's home directory have been replaced with placeholders. Build IDs, timestamps, method names, and monitor IDs are preserved. Full original logs and full thread dumps are available on request via a secure upload channel.
Thank you.
Please sign in to leave a comment.