bugsnag / bugsnag-java

BugSnag error reporting for Java.
https://www.bugsnag.com/platforms/java/
MIT License
56 stars 34 forks source link

Remove use of daemon threads, fixing potential resource leak #143

Closed fractalwrench closed 5 years ago

fractalwrench commented 5 years ago

Goal

Users have reported that daemon threads are not stopped when an application is stopped in a standalone Tomcat server. In an embedded server such as Spring Boot this does not matter as the JVM will always terminate when the application server is brought down, but in a standalone server, this can lead to threads leaking and performance problems over time.

We should fix this behaviour so that threads terminate properly when the application is shut down.

Changeset

Tests

Installed a standalone Tomcat server locally, and deployed a plain Spring application integrated with Bugsnag. Started then stopped the Tomcat server, and inspected the logs, verifying that there were no messages about thread leaks when this changeset was applied.

I also verified that the application shutdown when a crash occurred on startup, to verify that the scenario in #121 has not resurfaced.