quarkus: FormPost request using go 1.13 & HTTP/2 causes resteasy exception with TLS in 2.7.6.Final

Describe the bug

When I do a POST request from go 1.13 on a quarkus 2.7.6 resteasy classic endpoint that consumes MediaType.APPLICATION_FORM_URLENCODED and uses SSL/TLS, the request causes an exception. See the added reproducer for more details.

Expected behavior

Response is sent normally, no exception occurs.

Actual behavior

Exception:

Caused by: java.lang.RuntimeException: java.io.IOException: Underlying input stream returned zero bytes
	at org.jboss.resteasy.plugins.server.BaseHttpRequest.getFormParameters(BaseHttpRequest.java:61)
	at org.jboss.resteasy.plugins.server.BaseHttpRequest.getDecodedFormParameters(BaseHttpRequest.java:74)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:166)
	at com.sun.proxy.$Proxy45.getDecodedFormParameters(Unknown Source)
	at com.example.ExampleResource.processPostFormRequest(ExampleResource.java:67)
	at com.example.ExampleResource_Subclass.processPostFormRequest$$superforward1(Unknown Source)
	at com.example.ExampleResource_Subclass$$function$$4.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
	at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
	at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
	...
	
Caused by: java.io.IOException: Underlying input stream returned zero bytes
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:288)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:181)
	at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.base/java.io.BufferedReader.read1(BufferedReader.java:212)
	at java.base/java.io.BufferedReader.read(BufferedReader.java:287)
	at org.jboss.resteasy.plugins.providers.FormUrlEncodedProvider.parseForm(FormUrlEncodedProvider.java:88)
	at org.jboss.resteasy.plugins.server.BaseHttpRequest.getFormParameters(BaseHttpRequest.java:57)
	... 48 more

, response not sent.

How to Reproduce?

Reproducer: https://github.com/DGuhr/reproducer/tree/formPostRequest_ssl_exception

Steps: See Readme.md on that branch

Output of uname -a or ver

Darwin dguhr-mac 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:45 PDT 2022; root:xnu-7195.141.29~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version “11.0.15” 2022-04-19 OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10) OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)

GraalVM version (if different from Java)

Quarkus version or git rev

2.7.6.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

The error is not happening with a newer go version like 1.16, but over at Keycloak we had some other issues not related to go but with the same exception, that I will list here, so maybe worth looking into it to make quarkus SSL / HTTP2 “more compatible”:

Apart from that: Not sure if somehow related to #26878 but may be by chance that I found 2 HTTPS/SSL-related bugs in that short time frame 🥲

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

I don’t think this is related to Quarkus so maybe it makes more sense to open a RESTEasy issue? /cc @jamezp as he will know better.