SocketException when downloading artifact to remote agent
Asked by James Howat:

We have a simple setup, one local agent, one remote agent. The build plan produces an artifact that consists of a folder hierarchy. When this is re-used in a another plan, it is downloaded with no problem on the local agent, but consistently fails on the remote agent. A SocketException (Connection reset) is reported in the logs.

It takes about 1m30 to fail, however it doesn't appear to be a slow network connection problem as the troubleshooting guide suggests.

We are running on Windows exclusively, Bamboo 5.2.

The logs look like this:

```
INFO   | jvm 6038 | 2013/10/29 04:00:11 | 2013-10-29 04:00:11,291 INFO [1-BAM::remoteagent.example.com::Agent:pool-3-thread-1] [TaskExecutorImpl] Starting task 'Artifact download' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'INFO   | jvm 6038 | 2013/10/29 04:01:39 | 2013-10-29 04:01:39,162 ERROR [1-BAM::remoteagent.example.com::Agent:pool-3-thread-1] [ArtifactTransferPayload] Failed to download artifact file E:\atlassian\bamboo-agent-home\xml-data\build-dir\EXAMPLE-FUNC-PACKAGE\CompileOutput\Example.Forum.Site\_PublishedWebsites\Example.Forum.Site\bin\AjaxControlToolkit.dllINFO   | jvm 6038 | 2013/10/29 04:01:39 | 2013-10-29 04:01:39,583 ERROR [1-BAM::remoteagent.example.com::Agent:pool-3-thread-1] [HttpMessageSender] Failed to send message.INFO   | jvm 6038 | 2013/10/29 04:01:39 | java.net.SocketException: Connection resetINFO   | jvm 6038 | 2013/10/29 04:01:39 | 	at java.net.SocketInputStream.read(Unknown Source)[...]INFO   | jvm 6038 | 2013/10/29 04:01:39 | 	at com.atlassian.bamboo.v2.build.agent.remote.sender.HttpMessageSender.deserializeResponse(HttpMessageSender.java:138)INFO   | jvm 6038 | 2013/10/29 04:01:39 | 	at com.atlassian.bamboo.v2.build.agent.remote.sender.HttpMessageSender.send(HttpMessageSender.java:92)INFO   | jvm 6038 | 2013/10/29 04:01:39 | 	at com.atlassian.bamboo.build.artifact.BambooRemoteArtifactHandler.internalRetrieve(BambooRemoteArtifactHandler.java:74)INFO   | jvm 6038 | 2013/10/29 04:01:39 | 	at com.atlassian.bamboo.build.artifact.BambooRemoteArtifactHandler.retrieve(BambooRemoteArtifactHandler.java:53)
```

Has anyone encountered this before? Is there a maximum size on artifacts, or a maximum number of files allowed?


Answers:
author: James Howat
body: We've had another plan fail in a similar manner when downloading an artifact.

The only difference is that the httpclient appears to actually be getting a response, albeit an unexpected one.

org.apache.commons.httpclient.ProtocolException: Unable to parse status code from status line: ' HTTP transport specific properties.'

Restarting the agent PC appears to fix the problem temporarily - I'm wondering if there's some Windows connection limit that's being hit?

Does the client open lots of connections simultaneously for individual files in the artifact?


author: Przemek Bruski
body: There are no limits Bamboo side. If you're fronting your Bamboo instance with a reverse proxy, it could cause a problem like this.

comments: author: James Howat
body: Thanks for the response. Yes, I have seen others with similar symptoms because of a reverse proxy, but we don't have one. The two servers are on the same network. I've checked as best as I can that the client is not trying to direct traffic through our internal corporate Internet proxy by mistake, and that doesn't seem to be the case - the connection is direct.


author: Przemek Bruski
body: Anything in the server logs?


author: James Howat
body: Nothing that I would recognise as a problem.

The server-side logs equivalent to the above remote logs look like this (from a different run, but consistent with the above):

```
2013-10-30 09:50:43,810 INFO [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-5] [BuildQueueManagerImpl] Example Application - Functional Tests - Build Deployment Packages #269 (EXAMPLE-FUNC-PACKAGE-269) added to queue.2013-10-30 09:50:43,825 INFO [bambooAgentMessageListenerConnector-1] [CurrentlyBuildingContainer] startBuildingOnAgent called for 'EXAMPLE-FUNC-PACKAGE-269'2013-10-30 09:51:29,963 INFO [QuartzScheduler_Worker-6] [ExpiryTickerImpl] Live expiry handlers: 02013-10-30 09:51:49,723 INFO [buildTailMessageListenerConnector-1] [LocalBuildResultProcessor] Processing build result EXAMPLE-FUNC-PACKAGE-269...2013-10-30 09:51:49,723 INFO [buildTailMessageListenerConnector-1] [ExecutionPhaseServiceImpl] Example Application - Functional Tests - Build Deployment Packages #269 (EXAMPLE-FUNC-PACKAGE-269) execution finished
```


Tags: artefact

remote-agent