[
https://issues.apache.org/jira/browse/WICKET-6965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511195#comment-17511195
]
ASF subversion and git services commented on WICKET-6965:
---------------------------------------------------------
Commit e63ed88ef6ba5335194d0839f4cd6f0e1fbba791 in wicket's branch
refs/heads/master from Martin Grigorov
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=e63ed88 ]
WICKET-6965 Memory leak in WicketEndpoint (#505)
* WICKET-6965 Memory leak in WicketEndpoint
Make WicketEndpoint#REGISTERED_LISTENERS a static field.
Unregister the listener at Application#onBeforeDestroyed()
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
* WICKET-6965 Memory leak in WicketEndpoint
Drop the usage of AtomicBoolean to track whether an application is
running or not. Use the same set for 'registered listeners' and `alive
applications'
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
> Memory leak in WicketEndpoint
> -----------------------------
>
> Key: WICKET-6965
> URL: https://issues.apache.org/jira/browse/WICKET-6965
> Project: Wicket
> Issue Type: Bug
> Components: wicket-native-websocket
> Affects Versions: 9.8.0
> Reporter: Thomas Heigl
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Attachments: image-2022-01-10-18-52-42-193.png,
> image-2022-03-21-16-27-37-798.png
>
>
> Our application OOMed yesterday after about 2-3 weeks of continuous uptime.
> We normally deploy every other day, so we never noticed this issue before.
> The heap dump identified the possible culprit as
> {{{}WicketEndpoint$ApplicationListener{}}}:
> !image-2022-01-10-18-52-42-193.png!
> Every new websocket connection registers a new instance of this application
> listener and after a while we ended up with millions of these listeners:
> {code:java}
> @Override
> public void onOpen(Session session, EndpointConfig endpointConfig)
> {
> String appName = getApplicationName(session);
> WebApplication app = (WebApplication) WebApplication.get(appName);
> app.getApplicationListeners().add(new
> ApplicationListener(applicationDestroyed));
> try
> {
> ThreadContext.setApplication(app);
> javaxWebSocketProcessor = new JavaxWebSocketProcessor(session, app,
> endpointConfig);
> }
> finally
> {
> ThreadContext.detach();
> }
> }
> {code}
> Instead of creating a new listener for every connection, the listener should
> be a singleton.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)