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

on setting HttpServer.idleTimeout(idleTimeoutInMs), no GOWAY packet is seen in tcpdump #2412

Closed
Sumi264 opened this issue Aug 2, 2022 · 3 comments · Fixed by #2414
Closed
Assignees
Labels
type/bug A general bug
Milestone

Comments

@Sumi264
Copy link

Sumi264 commented Aug 2, 2022

With reactor-netty-http:1.0.20 (with spring-webflux), on setting HttpServer.idleTimeout(idleTimeoutInMs), no GOWAY packet is seen in tcpdump.with protocol H2C, HTTP11, but directly a FIN packet at TCP level.

HttpServer.idleTimeout(idleTimeoutInMs) definition says, .idleTimeout => Specifies an idle timeout on the connection when it is waiting for an HTTP request (resolution: ms). Once the timeout is reached the connection will be closed.

This definition doesn't say anything about the level at which it sets the idletimeout, is it directly at TCP level or HTTP level. As per the observation from tcpdump, the idle connection termination is not graceful. The connection gets terminated on reaching the idle timeout, as seen by FIN packet at TCP level. But no GOAWAY packet is observed.

Need to configure idle timeout at HTTP level so that it is accompanied with a GOAWAY packet to terminate connection gracefully. Is there any other way of setting idletimeout for reactive netty httpserver at http level?

@Configuration
public class NettyServerFactoryConfig implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {

    @Value("${server.http.port}")
    private Integer httpPort;

    @Value("${server.idleTimeout}")
    private Integer idleTimeout;

    @Value("${server.settingsMaxConcurrentStreams}")
    private Integer settingsMaxConcurrentStreams;

    @Override
    public void customize(NettyReactiveWebServerFactory factory) {

        LoopResources resource = LoopResources.create("my-resource");
        ReactorResourceFactory reactorResourceFactory = new ReactorResourceFactory();
        reactorResourceFactory.setLoopResources(resource);
        reactorResourceFactory.setUseGlobalResources(false);
        factory.setResourceFactory(reactorResourceFactory);

        Http2 h2 = new Http2(); 
        h2.setEnabled(true);
        factory.setPort(httpPort);
        factory.setHttp2(h2);

        Consumer<Builder> h2Settings = s -> s.maxConcurrentStreams(settingsMaxConcurrentStreams);
        factory.addServerCustomizers(httpServer -> httpServer.http2Settings(h2Settings));
        factory.addServerCustomizers(httpServer -> httpServer.idleTimeout(Duration.ofMillis(idleTimeout)));
        factory.addServerCustomizers(builder -> builder.protocol(HttpProtocol.H2C, HttpProtocol.HTTP11));
        factory.setShutdown(Shutdown.GRACEFUL);
    }
}
@violetagg violetagg self-assigned this Aug 2, 2022
@violetagg violetagg added this to the 1.0.22 milestone Aug 2, 2022
@violetagg violetagg added the type/bug A general bug label Aug 2, 2022
violetagg added a commit that referenced this issue Aug 3, 2022
…1.1 and HTTP/2

Ensure GOAWAY is send in case of HTTP/2

https://www.rfc-editor.org/rfc/rfc9113.html#section-6.8

`The GOAWAY frame (type=0x07) is used to initiate shutdown of a connection`

Fixes #2412
@violetagg
Copy link
Member

@Sumi264 Thanks for the description of the issue, you should be able to test the fix with 1.0.22-SNAPSHOT version.

@Sumi264
Copy link
Author

Sumi264 commented Aug 3, 2022

@violetagg Thanks for promptly picking up this issue. I would like to test this. Could you please tell me from where can I pull this version 1.0.22-SNAPSHOT of reactor-netty-http, as this is not available in maven central? https://mvnrepository.com/artifact/io.projectreactor.netty/reactor-netty-http

@violetagg
Copy link
Member

@violetagg Thanks for promptly picking up this issue. I would like to test this. Could you please tell me from where can I pull this version 1.0.22-SNAPSHOT of reactor-netty-http, as this is not available in maven central? https://mvnrepository.com/artifact/io.projectreactor.netty/reactor-netty-http

The SNAPSHOTS are not published to Maven Central. You can use https://repo.spring.io/snapshot (for more information see https://github.com/reactor/reactor-netty/tree/1.0.x#getting-it). The plan for version 1.0.22 is to be released next week, once it is released it will be available from Maven Central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
3 participants