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

Sentry 6.12.0 causes Spring Boot Web application cannot be stopped #2477

Closed
razubuddy opened this issue Jan 17, 2023 · 7 comments · Fixed by #2478
Closed

Sentry 6.12.0 causes Spring Boot Web application cannot be stopped #2477

razubuddy opened this issue Jan 17, 2023 · 7 comments · Fixed by #2478
Assignees

Comments

@razubuddy
Copy link

razubuddy commented Jan 17, 2023

Integration

sentry-spring-boot-starter-jakarta

Java Version

17

Version

6.12.0

Steps to Reproduce

  1. Generate Spring Boot application (Spring Boot 3.0.1, Gradle, Java 17, Jar packaging) with https://start.spring.io/ and add Spring Web dependency
  2. Add sentry-spring-boot-starter-jakarta dependency
implementation 'io.sentry:sentry-spring-boot-starter-jakarta:6.12.0'
  1. Add property to application.properties
sentry.dsn=${SENTRY_DSN:}
  1. Modify application entry point to close application on "exit" argument
@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args) {
		var app = SpringApplication.run(DemoApplication.class, args);
		if (args.length > 0 && "exit".equals(args[0])) {
			app.close();
		}
	}

}
  1. Run application with gradle
./gradlew bootRun --args=exit

Expected Result

Application should stop without error as it does with sentry <= 6.11.0

Actual Result

Application hangs on Stopping service [Tomcat]
Logs:

2023-01-17T07:42:50.257+01:00  INFO 1020706 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2023-01-17T07:42:50.754+01:00  INFO 1020706 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-01-17T07:42:50.762+01:00  INFO 1020706 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-01-17T07:42:50.762+01:00  INFO 1020706 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.4]
2023-01-17T07:42:50.822+01:00  INFO 1020706 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-01-17T07:42:50.824+01:00  INFO 1020706 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 529 ms
2023-01-17T07:42:51.068+01:00  INFO 1020706 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-01-17T07:42:51.074+01:00  INFO 1020706 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 1.053 seconds (process running for 1.237)
2023-01-17T07:42:51.079+01:00  INFO 1020706 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-01-17T07:42:51.082+01:00  WARN 1020706 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 [email protected]/java.lang.Object.wait(Native Method)
 [email protected]/java.lang.Object.wait(Object.java:338)
 [email protected]/java.util.TimerThread.mainLoop(Timer.java:537)
 [email protected]/java.util.TimerThread.run(Timer.java:516)
2023-01-17T07:42:51.082+01:00  WARN 1020706 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 [email protected]/java.lang.Object.wait(Native Method)
 [email protected]/java.lang.Object.wait(Object.java:338)
 [email protected]/java.util.TimerThread.mainLoop(Timer.java:537)
 [email protected]/java.util.TimerThread.run(Timer.java:516)
@adinauer
Copy link
Member

Thanks @razubuddy for the report, I'll take a look.

Add sentry-spring-boot-starter-jakarta dependency

implementation 'io.sentry:sentry-spring-boot-starter:6.12.0'

I assume you only made a mistake when pasting the dependency name in this issue and are actually using:

implementation 'io.sentry:sentry-spring-boot-starter-jakarta:6.12.0'

instead, correct?

@razubuddy
Copy link
Author

Thanks @razubuddy for the report, I'll take a look.

Add sentry-spring-boot-starter-jakarta dependency

implementation 'io.sentry:sentry-spring-boot-starter:6.12.0'

I assume you only made a mistake when pasting the dependency name in this issue and are actually using:

implementation 'io.sentry:sentry-spring-boot-starter-jakarta:6.12.0'

instead, correct?

corrected, that was a copy-paste mistake because i was also checking spring boot 2.7.x

@adinauer adinauer self-assigned this Jan 17, 2023
@adinauer
Copy link
Member

corrected, that was a copy-paste mistake because i was also checking spring boot 2.7.x

Is Spring Boot 2 also affected?

@razubuddy
Copy link
Author

Yes, Spring Boot 2.7.x is also affected

@adinauer
Copy link
Member

Thanks, I'm able to reproduce. Will try to fix and send a PR.

@adinauer
Copy link
Member

#2130 would be a better solution. I'll opt for a quickfix now and look at a better approach at a later point.

@adinauer
Copy link
Member

Just triggered a release (6.12.1), containing a fix, should be out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants