[
https://issues.apache.org/jira/browse/HTTPCLIENT-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16986432#comment-16986432
]
Eric Hubert commented on HTTPCLIENT-2032:
-----------------------------------------
Ah, what I wanted to add... I think Oleg is correct about closing this bug
report as "Not A Bug", but I disagree that this issue or an underlying issue is
unrelated to the project itself. To me such a wrong bug report already shows
the relation.
If there was no good chance of an upstream fix in OpenJDK restoring the good
old default retry behavior of HC, this issue atleast may have served to trigger
the creation of a (linked) follow-up improvement ticket, to compensate for the
OpenJDK change mitigating issues of no longer working retries HC users seem to
face unexpectedly after upgrading to recent OpenJDK versions. Nevertheless I'd
be more than happy if we see a fix for an upcoming major OpenJDK version plus a
backport to 11 LTS, keeping HC code free of workarounds.
[~CoderJon] From your last comment I was still not sure whether we could
properly transport the message, that the best a library like http client can do
for you and others, is offering some transparent, reasonable default retry
behavior (e.g. repeating idempotent requests after some potentially
recoverable, temporary IO error conditions - which can be caused by a magnitude
of different reasons like network infrastructure instabilities, handling of
persistent connections between intermediaries like proxies or load balancers,
overloaded or misbehaving servers or many others). This is not directly
"fixing" a bug or anything, it is just handling an error condition which can
occur. Whether those errors occur and in which frequency is depending on the
environment you are operating in. In addtion HC offers an extensible API which
allows users to fine-tune/adjust the retry behavior according to their
particular needs. Hope this may clarify something.
> Sometimes get a broken pipe error in Java 11 when trying to connect with
> HttpClient
> -----------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2032
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2032
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 4.5.10
> Reporter: Jonathan Smith
> Priority: Major
>
> Connecting with httpclient expecting to get a handshake and/or certificate
> error but sometimes get a broken pipe error (and sometimes I get the desired
> handshake / certificate error).
> It works perfectly fine in Java 8.
> {code:java}
> javax.net.ssl.SSLException: Broken pipe (Write failed) at
> java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
> at
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
> at
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
> at
> java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:258)
> at
> java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:988)
> at
> org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:124)
> at
> org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:136)
> at
> org.apache.http.impl.io.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:144)
> at
> org.apache.http.impl.BHttpConnectionBase.doFlush(BHttpConnectionBase.java:174)
> at
> org.apache.http.impl.DefaultBHttpClientConnection.flush(DefaultBHttpClientConnection.java:183)
> at org.apache.http.impl.conn.CPoolProxy.flush(CPoolProxy.java:167)
> at
> org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:241)
> at
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
> at
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
> at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)Caused
> by: java.net.SocketException: Broken pipe (Write failed)
> at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
> at
> java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
> at
> java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
> at
> java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:319)
> at
> java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:983)
> ... 36 more
> {code}
> As you can see, the SessionOutputBufferImpl tries to flush but hits the
> broken pipe. Could it be that the socket has already flushed itself sometimes
> and thus resulting in the connection/socket being closed before the explicit
> flush is called?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]