Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Deadlock publishing event while creating listener bean [SPR-12739] #17336
Publishing an application event in a second thread while creating an application event listener bean causes a deadlock.
The Reference URL points to a Github gist of a simple Spring Boot app that duplicates the deadlock.
Dump of the deadlocked threads:
"main@1" prio=5 tid=0x1 nid=NA waiting for monitor entry
"executor-1@2266" prio=5 tid=0xf nid=NA waiting for monitor entry
Affects: 3.2.13, 4.1.4
Reference URL: https://gist.github.com/mheath/547ce1044c282acd88e6
Backported to: 3.2.14
Juergen Hoeller commented
This has been introduced through #17148, trying to prevent the less of concurrently registered listeners in the cached retrievers.
Now addressed through using the same mutex object for locking, that is, the registry's singleton mutex is also being used by the event multicaster.
This will be available in the upcoming 4.2 snapshot and also in tomorrow's 4.1.6 and 3.2.14 snapshots. Please give it a try once available!