SEVERE errors: [CLOSED] HTTP protocol exception: null

Article ID:115004022307
1 minute readKnowledge base

Issue

In Jenkins logs you are seeing a lot of occurences of these errors

Feb 23, 2017 10:50:09 PM org.apache.http.impl.nio.client.LoggingAsyncRequestExecutor exception
SEVERE: http-outgoing-XX [CLOSED] HTTP protocol exception: null
java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureReadOpen(SocketChannelImpl.java:257)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:300)
at org.apache.http.nio.reactor.ssl.SSLIOSession.receiveEncryptedData(SSLIOSession.java:346)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:377)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:118)
at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:220)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:284)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:613)
at java.lang.Thread.run(Thread.java:745)

Environment

Resolution

Context

This problem comes from a bug in the library Apache HTTP Components HttpAsyncClient.

A known user of this buggy library is the Jira Rest Java Client which is used in the Jenkins Jira plugin. Atlassian is using a fork of this buggy library:

[INFO] org.jenkins-ci.plugins:jira:hpi:2.4-SNAPSHOT
...
[INFO] +- com.atlassian.jira:jira-rest-java-client-core:jar:3.0.0:compile
...
[INFO] |  \- com.atlassian.httpclient:atlassian-httpclient-apache-httpcomponents:jar:0.13.2:compile
...
[INFO] |     +- org.apache.httpcomponents:httpasyncclient-cache:jar:4.0-beta3-atlassian-1:compile
...

This issue is tracked in the Jenkins community as: https://issues.jenkins.io/browse/JENKINS-34774 This problem could come from others plugins by for now the Jenkins Jira plugin is the only one to have been clearly identified.

How to fix

JENKINS-34774 is listed as fixed in jira-plugin 2.5.2, so upgrading to that version or newer should be a first step. If the issue is still happening, the issue is likely invalid certificates in HTTPS connections. There are two known root causes and fixes :

1 - Your Jira Server is deployed using HTTPS and its certificate is invalid (expired, …​). Solution: You need to fix the certificate on the Jira Server side.
2 - Your Jira Server is deployed using HTTPS with a self-signed certificate. Solution: You need to install this certificate in your controller JVM keystore

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.