Ivy deploy fails intermittently with "java.io.IOException: Error writing to server"

Symptom:

You're publishing artifacts to Nexus using Ivy, and it periodically fails with this error:

BUILD FAILED

/Users/rseddon/temp/test/build.xml:41: impossible to publish artifacts for test#jdbc7;12.1.0.1-SNAPSHOT: java.io.IOException: Error writing to server
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:263)
at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
at org.apache.ivy.util.FileUtil.copy(FileUtil.java:283)

Solution:

This failure happens because a "tcp window full" message is sent, and then Nexus/Jetty tries to negotiate a new TCP window size, but for some reason the deployer won't accept anything sent.

As far as we can tell this is a bug in the JDK URL classes Ivy uses by default when publishing artifacts. The solution is to configure Ivy to use HttpClient for publishing.

To do this, put the following jars on the classpath in addition to the ivy.jar file:

  • commons-codec.jar
  • commons-httpclient.jar
  • commons-logging.jar

The specific versions of these needed can be found in the "bin-with-deps" download at the Ivy download site:  http://ant.apache.org/ivy/download.cgi

It's a good idea to do this for other reasons, you'll likely find that the default Sun/Oracle URL classes will be problematic in other ways, here is one example:

https://issues.apache.org/jira/browse/IVY-1197

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk