Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot send 'large' SOAP requests with http2 #2585

Open
uncl01 opened this issue Jan 23, 2024 · 2 comments
Open

Cannot send 'large' SOAP requests with http2 #2585

uncl01 opened this issue Jan 23, 2024 · 2 comments
Labels

Comments

@uncl01
Copy link

uncl01 commented Jan 23, 2024

Proposal

During the migration to cxf 3.6.1 from 3.5.6 wiremock tests start failing. After investigation we found that larger requests (> 6800 characters) to the wiremock (2.35.0) server fail with several different exceptions:

  • java.io.EOFException: EOF reached while reading
  • java.io.IOException: Received RST_STREAM: Stream cancelled
  • GOAWAY http response received

These all occured in the HTTPConduit of cxf, using the java.net.http/jdk.internal.net.http.Http2Connection.

Configuring cxf to use HTTP1.1 immediately resolved all these exceptions and our requests went through to the server as normal.

Reproduction steps

HTTP-Client

HTTPClient client = HTTPClient.newBuilder().version(HTTP_2).cookieHandler(...).build()
client.send(request, responseBodyHandler);
Test

@wiremocktest
public class Testclass {

@test
public void test(WireMockRuntimeInfo info) {
WireMock.stubFor(post(urlEqualTo(...)).withRequestBody(...).willReturn(...));

 // create client and send soap request (issues started at xml with at least 6800 characters)
 // Exception occurs

}
}

References

The same issue has been reported in #2461 and #2459.
Both were closed by the reporter because they found some workaround on the bug. But their issues are unresolved.

Note that these issues are for Wiremock 3.2.0, so this is not contained to the wiremock 2!

@uncl01 uncl01 added the bug label Jan 23, 2024
@Stexxen
Copy link

Stexxen commented Jan 24, 2024

I also came across this problem while performing a java -> jakarta and spring Boot 2 -> 3 migration, which included the move from Wiremock 2 to Wiremock 3
Quite annoying how it only occurs once a certain payload size was met.

I got past the problem in Wiremock rather than CXF with the following new HttpServerFactory

public class JettyHttp11OnlyServerFactory implements HttpServerFactory {

  @Override
  public HttpServer buildHttpServer(Options options, AdminRequestHandler adminRequestHandler, StubRequestHandler stubRequestHandler) {
    return new JettyHttp11OnlyServer(options, adminRequestHandler, stubRequestHandler);
  }

  public static class JettyHttp11OnlyServer extends Jetty11HttpServer {

    public JettyHttp11OnlyServer(Options options, AdminRequestHandler adminRequestHandler, StubRequestHandler stubRequestHandler) {
      super(options, adminRequestHandler, stubRequestHandler);
    }

    @Override
    protected ServerConnector createHttpConnector(
      String bindAddress, int port, JettySettings jettySettings, NetworkTrafficListener listener) {

      HttpConfiguration httpConfig = createHttpConfig(jettySettings);

      return Jetty11Utils.createServerConnector(
        jettyServer,
        bindAddress,
        jettySettings,
        port,
        listener,
        new HttpConnectionFactory(httpConfig));
    }

  }
}

and set up the WireMockServer's in the following way

    WireMockConfiguration configuration = wireMockConfig()
      .httpServerFactory(new JettyHttp11OnlyServerFactory())
      .port(portNum);
    WireMockServer wireMockServer = new WireMockServer(configuration);

This extends the default Jetty11HttpServer but removes the http2 connectionFactory, so any wiremock Server only allows HTTP1 connections

It does not fix the problem of why large SOAP payloads over http2 breaks things, but TBH I just needed my tests to work properly once again.

@tomakehurst
Copy link
Member

This looks like a distinct problem from #2637 where the JDK HTTP client doesn't correctly handle connection upgrades over plain text, rather than it being related to anything specific about the payload contents.

Please could you share a reproducer project so we can dig into this a bit?

One option is that we just provide an option to disable HTTP/2, or possibly separate options for disabling it in plain text and TLS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants