Agent upload of artifacts fails to set Content-Length in HTTP/1.1
Symptoms
Your build is running on a remote agent and after the build, the artifact failed to get transferred to the server. The following appears in the log files:
NFO | jvm 1 | 2013/03/15 15:02:48 | 2013-03-15 15:02:48,669 ERROR [1-BAM::bamboo-agent1.seres.no::Agent:pool-3-thread-1] [BambooPluginUtils] Unable to publish artifact Shared artifact: [Clover Report (System)], pattern: [**/*.*] anchored at[/target/site/clover] for TESTA-TSTA-JOB1-26 via com.atlassian.bamboo.build.artifact.BambooRemoteArtifactHandler@2c582fc6
INFO | jvm 1 | 2013/03/15 15:02:48 | java.lang.RuntimeException: java.io.IOException: Unexpected HTTP status code: 411 Length Required
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.v2.build.agent.remote.sender.HttpMessageSender.send(HttpMessageSender.java:106)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.BambooRemoteArtifactHandler.publish(BambooRemoteArtifactHandler.java:35)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$2.call(AbstractArtifactManager.java:262)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$2.call(AbstractArtifactManager.java:255)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:82)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publishFileSet(AbstractArtifactManager.java:254)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publish(AbstractArtifactManager.java:154)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.artifact.BuildArtifactPostProcessor.call(BuildArtifactPostProcessor.java:81)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.performCustomBuildProcess(ExecuteBuildTask.java:164)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:90)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
INFO | jvm 1 | 2013/03/15 15:02:48 | at java.lang.Thread.run(Thread.java:722)
INFO | jvm 1 | 2013/03/15 15:02:48 | Caused by: java.io.IOException: Unexpected HTTP status code: 411 Length Required
INFO | jvm 1 | 2013/03/15 15:02:48 | at com.atlassian.bamboo.v2.build.agent.remote.sender.HttpMessageSender.send(HttpMessageSender.java:100)
INFO | jvm 1 | 2013/03/15 15:02:48 | ... 14 more
Cause
Bamboo Agent artifact upload uses HTTP/1.1 feature "Chunked Transfer Coding" (as defined in http://www.apps.ietf.org/rfc/rfc2616.html#sec-3.6.1).
According to specification header "Transfer-Encoding: chunked" is added to the stream and "Content-Length: " header is no longer needed.
Lighttpd and old versions of Nginx don't fully implement HTTP/1.1, so can't be used as a reverse proxy with Bamboo.
Resolution
Switch to a proxy server that fully supports HTTP/1.1.
Some options are Apache httpd, or Nginx version 1.3.9 or later.