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

Sending async emails with and without the Batch module causes lingering threads (preventing the JVM from shutting down) #246

Closed
bbottema opened this issue Jan 31, 2020 · 3 comments
Assignees
Milestone

Comments

@bbottema
Copy link
Owner

bbottema commented Jan 31, 2020

There are a couple of issues all of the same type:

  1. The aggregate future task that waits for all connection pools to shut down is itself not being executed
  2. The loop inside the aggregate future task is broken and loops forever so even if it is executed, it doesn't finish
  3. There are a few instances where a default executor service instance is created and used but never shut down internally.

These all block the JVM from shutting down. The connection pools and threads properly die, the management around these threads don't.

Part of issue 3 is that when mailer.shutdownConnectionPool() is invoked, the executor service is not shutdown. This is part of the bug, but it should only do so when the executor service was not manually provided by the user.

@bbottema bbottema added this to the 6.0.2 milestone Jan 31, 2020
@bbottema bbottema self-assigned this Jan 31, 2020
bbottema added a commit that referenced this issue Jan 31, 2020
…n the executor service has already been shut down (which is possible if it was provided by the user)
bbottema added a commit that referenced this issue Jan 31, 2020
…ly implements the aggregate shutdown loop and shuts down default executor services
bbottema added a commit that referenced this issue Jan 31, 2020
…rvice and if not, shut it down together with the connection pool to prevent a JVM shutdown from being blocked.
bbottema added a commit that referenced this issue Jan 31, 2020
@bbottema
Copy link
Owner Author

bbottema commented Jan 31, 2020

All the issues are fixed, but I can't release because OSS Sonatype isn't syncing properly to Maven Central currently. The smtp-connection-pool library isn't showing up...

@petarov
Copy link

petarov commented Jan 31, 2020

Just did a quick test with org.simplejavamail:smtp-connection-pool:1.1.0. Looks good! No more blocking.

@bbottema bbottema changed the title Sending async emails with and without the Batch module cause lingering threads Sending async emails with and without the Batch module causes lingering threads Feb 1, 2020
@bbottema
Copy link
Owner Author

bbottema commented Feb 1, 2020

Fixed in 6.0.2

@bbottema bbottema closed this as completed Feb 1, 2020
@bbottema bbottema changed the title Sending async emails with and without the Batch module causes lingering threads Sending async emails with and without the Batch module causes lingering threads (preventing the JVM from shutting down) Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants