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

Wait for complete disposal of Reactor Netty resources in ReactorResourceFactory #23631

Closed
bclozel opened this issue Sep 12, 2019 · 4 comments
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 12, 2019

While chatting with @violetagg about #23594, we noticed that ReactorResourceFactory, when disposing of HTTP resources, is using the "void returning" variants of the APIs (for example, see ConnectionProvider.dispose() in reactor-netty).

Those variants are returning a void type but aren't synchronous and are not waiting for the operation to complete. Under the hood, they're calling the reactive version and subscribing to it, even sometimes in an elastic scheduler.

Spring Framework should in this case use disposeLater().block(); to ensure that resources have been cleaned up before the method returns. This might explain part of the problem in #23594 if the resources aren't cleaned completely before the server shuts down.

@bclozel bclozel added the type: bug A general bug label Sep 12, 2019
@bclozel bclozel added this to the 5.1.10 milestone Sep 12, 2019
@bclozel bclozel self-assigned this Sep 12, 2019
@jhoeller jhoeller added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 16, 2019
@quaff
Copy link
Contributor

quaff commented Sep 23, 2019

after commit ca2b2f5 , webflux-http-kqueue-* is destroyed after context closed, but there is a thread named globalEventExecutor-1-1 not destroyed immediately, should wait for 1 second.

@violetagg
Copy link
Member

@quaff This thread is used to notify that termination was completed.
https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L106
The termination of the event loop group is configured with 2s quiet time and 15s timeout.

@violetagg
Copy link
Member

@quaff the quiet period that I mentioned was for stopping the event loop. While this thread - yep it will be stopped when there is no task pending in the task queue for 1s
https://github.com/netty/netty/blob/c83904a12a603fe340477447d086674439ca8ac7/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java#L34-L36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants