The Spring Boot starter has a feature that creates a task filter during startup. E.g. in application.yml:
When we have a cluster of Spring Boot nodes that share the same database, this feature is not resilient and can let the application startup fail. In particular, the logic is essentially like this:
- Check if there is a filter with the given name
- If not, create it
This procedure is not synchronized across a cluster, e.g. there is no unique constraint on filter names. So there are race conditions that allow multiple filters with this name to be created, and this will subsequent application starts.
Step 1 in above sequence makes a #singleResult query. When two nodes see 0 such filters, they each create a new filter. On next startup, a node will find two filters, which lets #singleResult fail.
Make the feature more resilient such that it does not fail if there are two or more existing filters with the configured name. Document that this setting is not recommended for production settings, because you can end up with multiple filters.