Closed daspilker closed 9 months ago
You might have to configure your ThreadPoolTaskExecutor
bean with acceptTasksAfterContextClose=true
or waitForTasksToCompleteOnShutdown=true
. As of 6.1, Spring's standard graceful shutdown arrangement does not accept new tasks after context close otherwise.
It looks like we need to revisit the stop phase interaction between SubProtocolWebSocketHandler
and the ThreadPoolTaskExecutor
that it delegates to, so that the former's stop step completes before the latter's stop phase begins.
I'm going with a different solution for resilient behavior in such a scenario: If the executor rejects a task (typically on shutdown but could also be due to a configured rejection policy on overload), we simply run that task locally if there is such a code path already. That's the case for ExecutorSubscribableChannel
as well as SimpleApplicationEventMulticaster
where the executor is optional to begin with. On shutdown, running tasks locally as a fallback (just like if no executor was configured) is definitely preferable to just dropping the affected tasks.
I tested the current 6.1.4-SNAPSHOT and can confirm that the exception is gone. Thank you!
Good to hear, thanks for checking!
After updating an application from Spring Boot 3.1.x to 3.2.2, an exception is logged when shutting down the application while a websocket client is connected. The exception is not logged when using 3.1.x.
This can be reproduced with the Stomp Messaging guide: