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

fix instant RST/FIN after SYN/SYN-ACK/ACK #12554

Merged
merged 1 commit into from
May 22, 2023
Merged

Conversation

adiantek
Copy link
Contributor

@adiantek adiantek commented Jul 4, 2022

Motivation:

If you close the connection before the backend connects, the backend will keep connected until timeout. If you add logging, you will have sth like that:

12:57:57.398 ProxyFrontendHandler channelActive
12:57:57.405 ProxyFrontendHandler channelInactive
12:57:57.431 ProxyBackendHandler channelActive

Ping between backend and frontend was about 50 ms, and the time difference between connecting and disconnecting was about 1 ms.
Example code in Java to test frontend/backend:

        while (true) {
            System.out.println("tick");
            try {
                Socket socket = new Socket();
                socket.connect(new InetSocketAddress("127.0.0.1", 8443), 3000);
                socket.close();
                Thread.sleep(100);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

PS. Why ChannelFuture from new Bootstrap().connect is not cancellable? In epoll you can simply close FD.

Modification:

Close backend connection if inbound is not active.

@normanmaurer normanmaurer merged commit 2822dfd into netty:4.1 May 22, 2023
@normanmaurer
Copy link
Member

Thanks!

@normanmaurer normanmaurer added this to the 4.1.93.Final milestone May 22, 2023
normanmaurer pushed a commit that referenced this pull request May 22, 2023
Motivation:

If you close the connection before the backend connects, the backend
will keep connected until timeout. If you add logging, you will have sth
like that:
```
12:57:57.398 ProxyFrontendHandler channelActive
12:57:57.405 ProxyFrontendHandler channelInactive
12:57:57.431 ProxyBackendHandler channelActive
```
Ping between backend and frontend was about 50 ms, and the time
difference between connecting and disconnecting was about 1 ms.
Example code in Java to test frontend/backend:
```
        while (true) {
            System.out.println("tick");
            try {
                Socket socket = new Socket();
                socket.connect(new InetSocketAddress("127.0.0.1", 8443), 3000);
                socket.close();
                Thread.sleep(100);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
```


Modification:

Close backend connection if inbound is not active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants