Excessive Memory usage from Atmosphere Cache

Dear Community. I am working on my first Vaadin project. Until now I have been able to solve all major problems I came across.
Now there is one thing I can’t figure out in any way. So I hope to find some help in the community.

Our application is fetching data from a REST service every five seconds. This is done with a ScheduledThreadPool. The data is then Pushed to a JavascriptComponent on the UI in an “access - Runnable” like described in the Vaadin Wiki.
Everything works fine for some time. So after letting it running and refreshing the UI for a weekend, I noticed some strange behaviour and latency with things like click and other updates in the UI. The loading indicator is being shown in every thing we do in the UI.

I have seen that Memory usage of the JVM raised to about 1.6GB and did a Heap Dump with Memory Analyzer in Eclipse.
Only supicious is UUIDBroadcasterCache.

Class Name: org.atmosphere.cache.UUIDBroadcasterCache @ 0x6c1f7c9b8
Shallow Heap: 64
Retained Heap: 1’714’818’136 bytes (~1.59GB)

Inside there is a ConcurrentHashMap which holds all the messages pushed to the UI as strings.
There are more than 360’000 char open at the time of the Heap Dump.

Class Name: char
Objects : 367’378
Shallow Heap 1’688’787’136 bytes

I upgraded to the latest Version of Vaadin 7

Vaadin / Vaadin Plugin Version: 7.7.10
Jetty Plugin Version: 9.4.6.v20170531

Other Problem is Websocket which doesn’t work. So until now I just tested with long polling
I get this SEVERE log entry on Jetty start:

Jul 10, 2017 2:17:41 PM org.atmosphere.cpr.DefaultAsyncSupportResolver newCometSupport
SCHWERWIEGEND: Failed to create comet support class: class org.atmosphere.container.Jetty9AsyncSupportWithWebSocket, error: null
Jul 10, 2017 2:17:41 PM org.atmosphere.cpr.DefaultAsyncSupportResolver newCometSupport
SCHWERWIEGEND: Switching to BlockingIO

Maybe this is related with my other problem!

If there is any other information you need just ask…

Thank you very much in advance

Daniel

Additional Information:

Websocket Error in Chrome is the follwing:

WebSocket connection to ‘ws://localhost:8080/PUSH?v-uiId=0&v-csrfToken=ce344e3b-2009-4a68-a567-92551f7a9714&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.13.vaadin5-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true’ failed: Error during WebSocket handshake: Unexpected response code: 501

Thanks… Daniel

Today the problem with PUSH happened after some minutes of testing.

An other Error I see in the Chrome Console is this ones.

SEVERE: Trying to start a new request while another is active

WARNING: Gave up waiting for message 3565 from the server

The UI gets laggy and the Loading Indicator shows up everytime something is clickend in the UI.
What could be the cause for this?

Thanks

Sounds like you’ve got some sort of memory leak. Those are pretty hard to debug remotely. Some memory profiler might help you to find the spot.

My first guess would be that all your UIs (also those that are no more in use) stay referenced from some commonly used data structure.

cheers,
matti