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

JAMES-3715 Graceful shutdown for Netty servers #898

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

chibenwa
Copy link
Contributor

Waits ongoing tasks being executed on Netty servers for a few seconds
before releasing underlying resources (like DB connections).

Especially on top of Cassandra components, this is a good first step
to minimize risks of shutdowns to cause inconsistencies.

The Netty4 migration enabled us to easily write such resilient
behaviour while it was not implemented for the previously existing
Netty 3 code. CF #886

@chibenwa
Copy link
Contributor Author

This code need to be reworked: the graceful shutdown process takes ~2 seconds and we don't want to wait that long in tests.

Solution -> make it configurable

@chibenwa chibenwa marked this pull request as draft February 27, 2022 13:54
@chibenwa
Copy link
Contributor Author

chibenwa commented Mar 1, 2022

Reminder to self: I still need to turn off graceful shutdown in mailet integration tests...

chibenwa added a commit to chibenwa/james-project that referenced this pull request Mar 21, 2022
chibenwa added a commit that referenced this pull request Mar 22, 2022
See #898 for graceful shutdown
@chibenwa chibenwa force-pushed the netty4-gracefull-shutdown branch from ff0891a to 089fc9c Compare March 22, 2022 02:27
@chibenwa chibenwa marked this pull request as ready for review March 22, 2022 02:27
@chibenwa chibenwa force-pushed the netty4-gracefull-shutdown branch from 089fc9c to d0575f1 Compare March 22, 2022 02:28
Waits ongoing tasks being executed on Netty servers for a few seconds
before releasing underlying resources (like DB connections).

Especially on top of Cassandra components, this is a good first step
to minimize risks of shutdowns to cause inconsistencies.

The Netty4 migration enabled us to easily write such resilient
behaviour while it was not implemented for the previously existing
Netty 3 code.
@chibenwa chibenwa force-pushed the netty4-gracefull-shutdown branch from d0575f1 to 5d86a5b Compare March 22, 2022 05:09
@glennosss
Copy link
Contributor

I think you'll find unbindNow() is a cleaner way of doing this - see: https://github.com/glennosss/james-project/blob/netty4-combo/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolServer.java#L67

@chibenwa
Copy link
Contributor Author

chibenwa commented Mar 22, 2022

Alreanative PR welcomed ;-)

(Likely welcoming that: chibenwa#31, please open it against the ASF repo)

@chibenwa chibenwa merged commit 8d6ede0 into apache:master Apr 4, 2022
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.

2 participants