Community
Participate
Working Groups
HttpUtil.getResponseBodyAsStream() uses a producer/consumer pattern to read streams with support for cancellation. The implementation spawns a thread that fills a buffer until the stream is closed or exhausted. With HttpCore this can cause problems when the end of the stream is reached and it is automatically closed by the entity. If the request is released concurrently by the thread reading from the buffer this will cause an NPE. https://hudson.eclipse.org/hudson/user/spingel/my-views/view/Mylyn/job/mylyn-builds-nightly/215/testReport/org.eclipse.mylyn.hudson.tests.client/HudsonClientTest/testValidateValidUrl/ java.lang.NullPointerException at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:153) at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:237) at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:186) at org.apache.http.util.EntityUtils.consume(EntityUtils.java:67) at org.eclipse.mylyn.commons.repositories.http.core.HttpUtil.release(HttpUtil.java:330) at org.eclipse.mylyn.internal.hudson.core.client.HudsonOperation.updateCrumb(HudsonOperation.java:128) at org.eclipse.mylyn.internal.hudson.core.client.HudsonOperation.authenticate(HudsonOperation.java:95) at org.eclipse.mylyn.commons.repositories.http.core.CommonHttpOperation.executeOnce(CommonHttpOperation.java:80) at org.eclipse.mylyn.commons.repositories.http.core.CommonHttpOperation.execute(CommonHttpOperation.java:64) at org.eclipse.mylyn.internal.hudson.core.client.RestfulHudsonClient$8.execute(RestfulHudsonClient.java:405) at org.eclipse.mylyn.internal.hudson.core.client.RestfulHudsonClient$8.execute(RestfulHudsonClient.java:1) at org.eclipse.mylyn.internal.hudson.core.client.HudsonOperation.run(HudsonOperation.java:134) at org.eclipse.mylyn.internal.hudson.core.client.RestfulHudsonClient.validate(RestfulHudsonClient.java:427) at org.eclipse.mylyn.hudson.tests.client.HudsonClientTest.testValidateValidUrl(HudsonClientTest.java:57)
I have committed a work-around in 6eba6ca65b76ed6589cc2f81c103d17e36fc055f to ignore the exception. This will need to get fixed properly though.
Created attachment 209648 [details] mylyn/context/zip
The NPE has been addressed through disabling support for cancellation for ongoing transfers in commit 1dd26ba24948eb518706d195cb76dd1514224f1d. Unfortunately there is no straight forward solution to provide cancellation in a thread-safe manner. I have opened bug 372332 to track that.