{"record":{"id":"14ba7ff93aff8233","repo":"spring-projects/spring-boot","slug":"interrupted-while-waiting-for-spring-boot-app-to-s","errorCode":null,"errorMessage":"Interrupted while waiting for Spring Boot app to start.","messagePattern":"Interrupted while waiting for Spring Boot app to start\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java","lineNumber":215,"sourceCode":"\t * @return the result\n\t * @throws Exception in case of execution errors\n\t */\n\tpublic <T> T execute(long wait, int maxAttempts, Callable<@Nullable T> callback) throws Exception {\n\t\tgetLog().debug(\"Waiting for spring application to start...\");\n\t\tfor (int i = 0; i < maxAttempts; i++) {\n\t\t\tT result = callback.call();\n\t\t\tif (result != null) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tString message = \"Spring application is not ready yet, waiting \" + wait + \"ms (attempt \" + (i + 1) + \")\";\n\t\t\tgetLog().debug(message);\n\t\t\tsynchronized (this.lock) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.lock.wait(wait);\n\t\t\t\t}\n\t\t\t\tcatch (InterruptedException ex) {\n\t\t\t\t\tThread.currentThread().interrupt();\n\t\t\t\t\tthrow new IllegalStateException(\"Interrupted while waiting for Spring Boot app to start.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow new MojoExecutionException(\n\t\t\t\t\"Spring application did not start before the configured timeout (\" + (wait * maxAttempts) + \"ms\");\n\t}\n\n\t@Override\n\tprotected TestClasspath testClasspath() {\n\t\tif (this.resolvedTestClasspath == null) {\n\t\t\tif (this.useTestClasspath != null) {\n\t\t\t\tgetLog().warn(\"useTestClasspath is deprecated, use testClasspath instead.\");\n\t\t\t\tthis.resolvedTestClasspath = (this.useTestClasspath) ? TestClasspath.DEPENDENCIES : TestClasspath.OFF;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.resolvedTestClasspath = TestClasspath.valueOf(this.testClasspath.toUpperCase(Locale.ROOT));\n\t\t\t}\n\t\t}","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java#L197-L233","documentation":"While sleeping between readiness retries via this.lock.wait(wait), InterruptedException indicates another thread interrupted the Maven build thread. The code restores the interrupt status (Thread.currentThread().interrupt()) and throws IllegalStateException, aborting the wait loop cleanly.","triggerScenarios":"IDE, CI watchdog, build timer, or user cancellation interrupting the Maven thread during the spring-boot:start wait loop.","commonSituations":"User cancelling the build mid-startup; CI job timeout firing; a parent process sending interrupt to the build thread.","solutions":["Avoid cancelling builds mid-startup when graceful start matters","Increase CI timeout for spring-boot:start goals so they are not interrupted","Do not run spring-boot:start in a thread you intend to interrupt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { waitForSpringApplication(); } catch (IllegalStateException ex) { if (Thread.currentThread().isInterrupted()) { log.warn(\"Build thread was interrupted during start wait\"); } throw ex; }","preventionTips":["Avoid cancelling builds mid-startup","Size CI timeouts generously for spring-boot:start","Do not run spring-boot:start in a thread you intend to interrupt"],"tags":["threading","maven-plugin","interruption"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}