Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Question regarding Websocket and MappedByteBufferPool behavior

Hi,

I wanted to ask about how MappedByteBufferPool behaves when held by WebSocketClient. 

From what I can see, Jetty is instantiating a MappedByteBufferPool which serves as a buffer that is used by all WebSocketClient threads. 

Using heapdump/threaddump analysis I can see that websocket messages that are sent from clients (inbound messages) are stored in that buffer. I can also see that there are multiple threads in RUNNABLE state, which point to that buffer. However, when those clients disconnect the websocket, I can see those WebScocket threads change their state to TIMED_WAITING (All but onem which stays RUNNABLE) but the buffer does not clear itself up nor gets cleared by GC, because there is still a single thread pointing to it, and eventually causing our application to run out of memory.

Is this the expected behavior when working with websocket? Are we doing something wrong? Is there some way to configure that BufferPool or the buffers inside, so they are cleared once a connection is closed?

Our app is running on Jetty 9.4.18 via Spring-Boot 1.5.21.

Attached some screenshots.

Many thanks in advance,

Ofir Prizat
Senior Soft. Developer
Liveperson Inc.

Attachment: Screen Shot 2019-07-30 at 12.11.17.png
Description: PNG image

Attachment: Screen Shot 2019-07-30 at 12.19.44.png
Description: PNG image


Back to the top