We ran into an OutOfMemory Exception while stress testing our application, and it turned out that SimpleApplicationEventMulticaster retained 75% heap. From debugging the code it looks like the retrieverCache from AbstractApplicationEventMulticaster filled up with over 60,000 Elements. Each time our application publishes an ApplicationEvent it gets a different ListenerCacheKey and the map size grows by 1.
This only happens with Events which are not of type ApplicationEvent. See attached Unit Test to demonstrate the behaviour. Test "userEventTypeApplicationEventCaching" works and "userEventCaching" fails.
This turns out to be due to PayloadApplicationEvent's use of ResolvableType.forClassWithGenerics, which in turn exposes a SyntheticParameterizedType as of 4.2 (#17298)... and that one was missing an equals / hashCode implementation.
Fixed for 4.2.2 now, scheduled for release next week. Feel free to give the upcoming 4.2.2.BUILD-SNAPSHOT a try...
Peter Rosendahl opened SPR-13540 and commented
We ran into an OutOfMemory Exception while stress testing our application, and it turned out that SimpleApplicationEventMulticaster retained 75% heap. From debugging the code it looks like the retrieverCache from AbstractApplicationEventMulticaster filled up with over 60,000 Elements. Each time our application publishes an ApplicationEvent it gets a different ListenerCacheKey and the map size grows by 1.
This only happens with Events which are not of type ApplicationEvent. See attached Unit Test to demonstrate the behaviour. Test "userEventTypeApplicationEventCaching" works and "userEventCaching" fails.
Affects: 4.2.1
Attachments:
Issue Links:
Referenced from: commits 427767f
The text was updated successfully, but these errors were encountered: