-
Notifications
You must be signed in to change notification settings - Fork 646
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
HttpMetricsHandlerTests testServerConnectionsMicrometer still unstable #2421
HttpMetricsHandlerTests testServerConnectionsMicrometer still unstable #2421
Conversation
When we dispose a server we also dispose the connection pool. It happens here https://github.com/reactor/reactor-netty/blob/netty5/reactor-netty5-core/src/main/java/reactor/netty5/transport/ServerTransport.java#L528-L543. Do you think that the new test starts before server dispose? Or is there an issue with server dispose? |
When ServerTransport.dispose method call is done, the server connection is indeed closed (the server does not listen anymore on the server port), that's ok. But when the dispose method returns, I think that the server has not yet seen the client connection close, it will eventually see it, but not immediately. That's what I remember having observed with the debugger last week. |
(the failure CI test on windows is unrelated) |
…metrics like SERVER_CONNECTIONS_TOTAL. Do not dispose the server multiple times. The connection pool provider was disposed by some tests, that's not necessary.
I have tried to clean up the test, and I have validated it using the multipart PR which consistently reproduces the issue, can you please review it ? So, this PR does the following:
a first solution was to use a channelGroup, because when a server configured with a channelGroup it does a graceful shutdown at dispose time. But currently, pending client sockets are closed asynchronously, that's why the SERVER_CONNECTIONS_TOTAL meter may remain positive for a short amount of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering - do we need something like this:
private static final EventExecutor executor = new DefaultEventExecutor();
@AfterClass
public static void afterClass() throws Exception {
executor.shutdownGracefully()
.get(5, TimeUnit.SECONDS);
}
Indeed, I have updated the PR like in ITTracingHttpServerDecoratorTest PS: in HttpServerTests, the executor and the group don't seem to be closed, should something be fixed in HttpServerTests.java (with another PR) ? |
yes go ahead and fix them all |
The failed test on windows is not relevant to this PR. |
thanks for the review !! |
The HttpMetricsHandlerTests testServerConnectionsMicrometer is still unstable.
Sometimes, the following assertion fails because the SERVER_CONNECTIONS_TOTAL is 1, see this failing assertion
Reproduced the problem in github using netty5 branch while validating the multipart porting draft PR.
What I can imagine is the following probable scenario:
So, in testServerConnectionsMicrometer, this problem seems to be fully fixed when we dispose the client connection pool in case protocol is HTT2 and when we also wait for the server to see the H2 connection close.
Fixes #2368