You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Matthew Blissett <mb...@gbif.org> on 2019/12/10 13:24:16 UTC

TruncatedChunkException with Java 8, not with Java 11

Hi,

Using HttpClient 4.5.10, and with a small modification to 
QuickStart.java to download the 3GB ZIP archive from 
https://ipt.artsdatabanken.no/archive.do?r=speciesobservationsservice2 , 
I see an exception when running under Java 8, but success when running 
under Java 11.

$ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -classpath 
.:httpcore-4.4.12.jar:commons-logging-1.2.jar:commons-codec-1.11.jar 
org.apache.http.client.examples.QuickStart

HTTP/1.1 200
Exception in thread "main" org.apache.http.TruncatedChunkException: 
Truncated chunk (expected size: 16,368; actual size: 12,147)
         at 
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:197)
         at 
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:210)
         at 
org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:312)
         at 
org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:142)
         at 
org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
         at 
org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:172)
         at org.apache.http.util.EntityUtils.consume(EntityUtils.java:90)
         at 
org.apache.http.client.examples.QuickStart.main(QuickStart.java:62)

The exception consistently occurs when around 1GB has been downloaded 
(the issue was discovered using entity.writeTo(fileOutputStream)), but 
the exact amount can differ by a few kB.

$ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -classpath 
.:httpcore-4.4.12.jar:commons-logging-1.2.jar:commons-codec-1.11.jar 
org.apache.http.client.examples.QuickStart
HTTP/1.1 200

I'm also able to download the file without a problem using Curl, Wget, 
Firefox and so on, so this seems like a problem in either HttpComponents 
or Java 8.  Does anyone have any ideas on what might be causing the 
problem?  In case it's relevant, a download using Java 11 (or Curl or 
Wget) runs at just over 800-900Mb/s, and the Java 8 download at 
150Mbit/s.  Using Wireshark, I see a TLS "Encrypted Alert" packet is 
received when using Java 8, but I don't really know what this means.

Thanks,

Matt Blissett


Java versions:

$ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -version
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

$ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, 
mixed mode, sharing)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: TruncatedChunkException with Java 8, not with Java 11

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2019-12-10 at 13:24 +0000, Matthew Blissett wrote:
> Hi,
> 
> Using HttpClient 4.5.10, and with a small modification to 
> QuickStart.java to download the 3GB ZIP archive from 
> 
https://ipt.artsdatabanken.no/archive.do?r=speciesobservationsservice2
>  , 
> I see an exception when running under Java 8, but success when
> running 
> under Java 11.
> 
> $ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -classpath 
> .:httpcore-4.4.12.jar:commons-logging-1.2.jar:commons-codec-1.11.jar 
> org.apache.http.client.examples.QuickStart
> 
> HTTP/1.1 200
> Exception in thread "main" org.apache.http.TruncatedChunkException: 
> Truncated chunk (expected size: 16,368; actual size: 12,147)
>          at 
> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.ja
> va:197)
>          at 
> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.ja
> va:210)
>          at 
> org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.j
> ava:312)
>          at 
> org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(Respo
> nseEntityProxy.java:142)
>          at 
> org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputSt
> ream.java:228)
>          at 
> org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.
> java:172)
>          at
> org.apache.http.util.EntityUtils.consume(EntityUtils.java:90)
>          at 
> org.apache.http.client.examples.QuickStart.main(QuickStart.java:62)
> 
> The exception consistently occurs when around 1GB has been
> downloaded 
> (the issue was discovered using entity.writeTo(fileOutputStream)),
> but 
> the exact amount can differ by a few kB.
> 
> $ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -classpath 
> .:httpcore-4.4.12.jar:commons-logging-1.2.jar:commons-codec-1.11.jar 
> org.apache.http.client.examples.QuickStart
> HTTP/1.1 200
> 
> I'm also able to download the file without a problem using Curl,
> Wget, 
> Firefox and so on, so this seems like a problem in either
> HttpComponents 
> or Java 8.  Does anyone have any ideas on what might be causing the 
> problem?  In case it's relevant, a download using Java 11 (or Curl
> or 
> Wget) runs at just over 800-900Mb/s, and the Java 8 download at 
> 150Mbit/s.  Using Wireshark, I see a TLS "Encrypted Alert" packet is 
> received when using Java 8, but I don't really know what this means.
> 
> Thanks,
> 
> Matt Blissett
> 

Hi Matt

Some TLS level issue would be my guess.

Oleg


> 
> Java versions:
> 
> $ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -version
> OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-
> 1ubuntu1~18.04.1-b10)
> OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
> 
> $ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version
> openjdk version "11.0.4" 2019-07-16
> OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-
> 1ubuntu218.04.3)
> OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-
> 1ubuntu218.04.3, 
> mixed mode, sharing)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org