The 4.4.1 code doesn't seem to help.
I have been able to reproduce the issue more regularly now. It seems to have
to do with keep-alives and if the client takes longer to read the message than
the keep alive value.
In my test case I open the connection, read all the data, sleep for a while,
then close the connection.
If my sleep is a bit longer than the keep-alive value, I will get a
org.apache.http.NoHttpResponseException. If my sleep value is larger, I will
get a java.net.SocketException.
(Keep-Alive is 5000 millis. If I sleep for 6000, I will get a
NoHttpResponseException. If I sleep for 11000, I will get a SocketException.
If I use the NoConnectionReuseStrategy, the problem goes away.
Is something set up for my keep alives? I put some breakpoints in CPool.java.
I can see connections being created, but the validate() method of CPool is
never getting called.
I am curious this part of AbstractConnPool.java. This seems like if the server
invalidated a connection early, the validate check would never happen.
} else if (this.validateAfterInactivity > 0) {
if (entry.getUpdated() + this.validateAfterInactivity
<= System.currentTimeMillis()) {
if (!validate(entry)) {
entry.close();
}
}
}
Scenario:
Server sends data.
Client reads packet, processes it for 6 seconds
Server senses that inactivity for 5 seconds, closes connection
Client closes connection and places entry back in the pool
Connection immediately leased to another thread
Time between release and close is almost nothing
Pool releases stale connection.
---- (1) ---- Throwable - Class (class java.net.SocketException)
Message (Software caused connection abort: socket write error)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
at
sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:864)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:835)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at
org.apache.http.impl.conn.LoggingOutputStream.write(LoggingOutputStream.java:77)
at
org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:126)
at
org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:138)
at
org.apache.http.impl.io.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:146)
---- (1) ---- Throwable - Class (class
org.apache.http.NoHttpResponseException)
Message (The target server failed to respond)
at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at
org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
Mark Claassen
Senior Software Engineer
Donnell Systems, Inc.
130 South Main Street
Leighton Plaza Suite 375
South Bend, IN 46601
E-mail: mailto:[email protected]
Voice: (574)232-3784
Fax: (574)232-4014
-------------------------------------------
Confidentiality Notice: OCIESERVICE
-------------------------------------------
The contents of this e-mail message and any attachments are intended solely for
the addressee(s) named in this message. This communication is intended to be
and to remain confidential. If you are not the intended recipient of this
message, or if this message has been addressed to you in error, please
immediately alert the sender by reply e-mail and then delete this message and
its attachments. Do not deliver, distribute, copy, disclose the contents or
take any action in reliance upon the information contained in the communication
or any attachments.
-----Original Message-----
From: Oleg Kalnichevski [mailto:[email protected]]
Sent: Wednesday, May 13, 2015 3:25 AM
To: HttpClient User Discussion
Subject: Re: Strange SSL error
On Tue, 2015-05-12 at 20:28 +0000, Mark A. Claassen wrote:
> I was looking at the change log for 4.4 and 4.4.1. Count HTTPCLIENT-1609 be
> causing this?
The issue was about detection of half-closed connections. If
NoHttpResponseException you have been seeing is a result of the connection
getting closed by the opposite endpoint, upgrading to 4.4.1
might help resolve the issue.
Oleg
> Or does it have to be something on the network closing the connection?
>
> * [HTTPCLIENT-1609] Stale connection check in
> PoolingHttpClientConnectionManager has no effect.
> Internal connection pool does not correctly implement connection validation.
> Contributed by Charles Lip <rene1 at singnet.com.sg>
>
>
> Mark Claassen
> Senior Software Engineer
>
> Donnell Systems, Inc.
> 130 South Main Street
> Leighton Plaza Suite 375
> South Bend, IN 46601
> E-mail: mailto:[email protected]
> Voice: (574)232-3784
> Fax: (574)232-4014
>
> -------------------------------------------
> Confidentiality Notice: OCIESERVICE
> -------------------------------------------
> The contents of this e-mail message and any attachments are intended solely
> for the addressee(s) named in this message. This communication is intended to
> be and to remain confidential. If you are not the intended recipient of this
> message, or if this message has been addressed to you in error, please
> immediately alert the sender by reply e-mail and then delete this message and
> its attachments. Do not deliver, distribute, copy, disclose the contents or
> take any action in reliance upon the information contained in the
> communication or any attachments.
>
>
> -----Original Message-----
> From: Mark A. Claassen [mailto:[email protected]]
> Sent: Tuesday, May 12, 2015 8:58 AM
> To: HttpClient User Discussion
> Subject: RE: Strange SSL error
>
> The scenario is that he logs in to our Swing application, there is a burst of
> transactions, maybe a slight pause, and then the next one fails. The whole
> process probably takes around 10 seconds. I was actually wondering if this
> had something to do with bad connections in the pool, but it is hard to say
> since I can't reproduce it reliably.
>
> The communication is over SSL, and consists of readable XML and binary data.
> Most of the messages are < 10K, some bigger. We checked the firewall wall
> logs (since there is a firewall involved) and there is nothing. I connect
> through the same route and this never happens to me.
>
> Thanks again,
>
> Mark Claassen
> Senior Software Engineer
>
> Donnell Systems, Inc.
> 130 South Main Street
> Leighton Plaza Suite 375
> South Bend, IN 46601
> E-mail: mailto:[email protected]
> Voice: (574)232-3784
> Fax: (574)232-4014
>
> -------------------------------------------
> Confidentiality Notice: OCIESERVICE
> -------------------------------------------
> The contents of this e-mail message and any attachments are intended solely
> for the addressee(s) named in this message. This communication is intended to
> be and to remain confidential. If you are not the intended recipient of this
> message, or if this message has been addressed to you in error, please
> immediately alert the sender by reply e-mail and then delete this message and
> its attachments. Do not deliver, distribute, copy, disclose the contents or
> take any action in reliance upon the information contained in the
> communication or any attachments.
>
> -----Original Message-----
> From: Stefan Magnus Landrø [mailto:[email protected]]
> Sent: Monday, May 11, 2015 5:15 PM
> To: HttpClient User Discussion
> Subject: Re: Strange SSL error
>
> What kind of data is being transfered? Do you tend to keep connections open
> for a long time? Firewall killing connections?
>
> Sendt fra min iPhone
>
> > Den 11. mai 2015 kl. 21.36 skrev Mark A. Claassen <[email protected]>:
> >
> > What would cause the reset, and what would make it so seemingly random? Is
> > there something I am doing wrong? Is there a setting I can set so that
> > this doesn't randomly happen to him? It is not too often, but often enough
> > to be annoying and look like a failure in the application.
> >
> > Thanks
> >
> > Mark Claassen
> > Senior Software Engineer
> >
> > Donnell Systems, Inc.
> > 130 South Main Street
> > Leighton Plaza Suite 375
> > South Bend, IN 46601
> > E-mail: mailto:[email protected]
> > Voice: (574)232-3784
> > Fax: (574)232-4014
> >
> >
> > -----Original Message-----
> > From: Stefan Magnus Landrø [mailto:[email protected]]
> > Sent: Friday, May 08, 2015 5:20 PM
> > To: HttpClient User Discussion
> > Subject: Re: Strange SSL error
> >
> > Looks like a tcp reset to me
> >
> > Sendt fra min iPhone
> >
> >> Den 8. mai 2015 kl. 22.49 skrev Mark A. Claassen <[email protected]>:
> >>
> >> We are having one user that is getting this sporadically. No one else can
> >> reproduce it. Any idea what might be causing it? Because it is hard to
> >> reproduce, I am having trouble knowing where to start? Everyone else who
> >> tries has no issues. He logs into our application, which involves lots of
> >> small network transactions, and then the next thing he does often causes
> >> this. I think the situation would be that there is a lot of transactions
> >> very quickly, then a slight delay. After this, the next transaction
> >> fails, and then it will be fine. Any ideas?
> >>
> >>
> >> ---- (1) ---- Throwable - Class (class
> >> org.apache.http.NoHttpResponseException)
> >> Message (portal.cpfs.com:443 failed to respond)
> >> at
> >> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
> >> at
> >> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
> >> at
> >> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
> >> at
> >> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
> >> at
> >> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
> >> at
> >> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
> >> at
> >> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
> >> at
> >> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
> >> at
> >> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
> >> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
> >> at
> >> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
> >> at
> >> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
> >> at
> >> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
> >> at
> >> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
> >> at
> >> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHt
> >> tpClient.java:55)
> >> Mark Claassen
> >> Senior Software Engineer
> >>
> >> Donnell Systems, Inc.
> >> 130 South Main Street
> >> Leighton Plaza Suite 375
> >> South Bend, IN 46601
> >> E-mail: mailto:[email protected]
> >> Voice: (574)232-3784
> >> Fax: (574)232-4014
> >>
> >> -------------------------------------------
> >> Confidentiality Notice: OCIESERVICE
> >> -------------------------------------------
> >> The contents of this e-mail message and any attachments are intended
> >> solely for the addressee(s) named in this message. This communication is
> >> intended to be and to remain confidential. If you are not the intended
> >> recipient of this message, or if this message has been addressed to you in
> >> error, please immediately alert the sender by reply e-mail and then delete
> >> this message and its attachments. Do not deliver, distribute, copy,
> >> disclose the contents or take any action in reliance upon the information
> >> contained in the communication or any attachments.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
> KCB [ X ܚX KK[XZ[
> Y[
> ]\ \ ][ X ܚX P˘\X K ܙ B ܈Y][ۘ[ [X[ K[XZ[
> Y[
> ]\ \ Z[˘\X K ܙ B B
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]