Discussion:
Premature end of chunk exception
Marc Boorshtein
2017-10-25 15:12:19 UTC
Permalink
All,

I'm trying to connect to a resource over https and am getting the following
errors on occasion:

org.apache.http.ConnectionClosedException: Premature end of chunk coded
message body: closing chunk expected
at
org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:268)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:227)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:186)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
~[httpclient-4.5.2.jar:4.5.2]

There isn't much on the web on this one. Whats interesting is that when
this code runs in the same subnet as the target, no issues but when it
crosses some complex networking I will get this error on occasion. My
network team is saying there are no "issues" with the connections. Are
there some tuning parameters I can adjust for this?

Thanks
Oleg Kalnichevski
2017-10-26 11:31:24 UTC
Permalink
Post by Marc Boorshtein
All,
I'm trying to connect to a resource over https and am getting the following
org.apache.http.ConnectionClosedException: Premature end of chunk coded
message body: closing chunk expected
        at
org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputS
tream.java:268)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStre
am.java:227)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.ja
va:186)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.j
ava:137)
~[httpclient-4.5.2.jar:4.5.2]
There isn't much on the web on this one.  Whats interesting is that
when
this code runs in the same subnet as the target, no issues but when it
crosses some complex networking I will get this error on
occasion.  My
network team is saying there are no "issues" with the
connections.  Are
there some tuning parameters I can adjust for this?
You should try to capture a wire log of the message exchange that
exhibits the problem and see whether or not the closing chunk is indeed
missing.

Besides, it should be pretty safe to just
ignore ConnectionClosedException if you do not care about 100% HTTP
protocol compliance. HttpClient intentionally uses a specific exception
type so it could be caught and ignored if desired.

Hope this helps

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Marc Boorshtein
2017-10-26 13:42:15 UTC
Permalink
Thanks Oleg. Could the root cause of this exception cause performance
issues and more specifically connection retention? The symptoms we were
seeing was a lock while trying to get a connection from the pool. We got
around the issue by increasing the size of the pool but we're still seeing
significant performance issues on this network and I suspect its because
the response is hanging waiting for the final chunk.
Post by Oleg Kalnichevski
Post by Marc Boorshtein
All,
I'm trying to connect to a resource over https and am getting the following
org.apache.http.ConnectionClosedException: Premature end of chunk coded
message body: closing chunk expected
at
org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputS
tream.java:268)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStre
am.java:227)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.ja
va:186)
~[httpcore-4.4.4.jar:4.4.4]
at
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.j
ava:137)
~[httpclient-4.5.2.jar:4.5.2]
There isn't much on the web on this one. Whats interesting is that when
this code runs in the same subnet as the target, no issues but when it
crosses some complex networking I will get this error on
occasion. My
network team is saying there are no "issues" with the
connections. Are
there some tuning parameters I can adjust for this?
You should try to capture a wire log of the message exchange that
exhibits the problem and see whether or not the closing chunk is indeed
missing.
Besides, it should be pretty safe to just
ignore ConnectionClosedException if you do not care about 100% HTTP
protocol compliance. HttpClient intentionally uses a specific exception
type so it could be caught and ignored if desired.
Hope this helps
Oleg
---------------------------------------------------------------------
Oleg Kalnichevski
2017-10-26 15:12:50 UTC
Permalink
Thanks Oleg.  Could the root cause of this exception cause
performance
issues and more specifically connection retention?  The symptoms we
were
seeing was a lock while trying to get a connection from the pool.  We
got
around the issue by increasing the size of the pool but we're still seeing
significant performance issues on this network and I suspect its because
the response is hanging waiting for the final chunk.
No, those issues should be completely unrelated in my opinion.

Cheers

Oleg
Post by Oleg Kalnichevski
Post by Marc Boorshtein
All,
I'm trying to connect to a resource over https and am getting the following
org.apache.http.ConnectionClosedException: Premature end of chunk coded
message body: closing chunk expected
        at
org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedIn
putS
tream.java:268)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInput
Stre
am.java:227)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStrea
m.ja
va:186)
~[httpcore-4.4.4.jar:4.4.4]
        at
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStre
am.j
ava:137)
~[httpclient-4.5.2.jar:4.5.2]
There isn't much on the web on this one.  Whats interesting is that
when
this code runs in the same subnet as the target, no issues but
when
it
crosses some complex networking I will get this error on
occasion.  My
network team is saying there are no "issues" with the
connections.  Are
there some tuning parameters I can adjust for this?
You should try to capture a wire log of the message exchange that
exhibits the problem and see whether or not the closing chunk is indeed
missing.
Besides, it should be pretty safe to just
ignore ConnectionClosedException if you do not care about 100% HTTP
protocol compliance. HttpClient intentionally uses a specific exception
type so it could be caught and ignored if desired.
Hope this helps
Oleg
-----------------------------------------------------------------
----
g
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Loading...