Re: Fwd: websocket connections consume too much memory
Hello All, Maybe this behavior is caused by the fact defaultMaxSessionIdleTimeout is not set for websockets? Can be updated as follows final WsServerContainer sc = (WsServerContainer)getServletContext().getAttribute(SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE); if (sc != null) { sc.setDefaultMaxSessionIdleTimeout(60 * 1000L); } On Mon, 25 Feb 2019 at 22:04, Иналь Кятов wrote: > > I retest with > > > *8.5.38* > > ... > > > org.apache.tomcat.embed > tomcat-embed-websocket > ${tomcat-embedded.version} > > > org.apache.tomcat.embed > tomcat-embed-core > ${tomcat-embedded.version} > > > org.apache.tomcat.embed > tomcat-embed-el > ${tomcat-embedded.version} > > > org.apache.tomcat > tomcat-annotations-api > ${tomcat-embedded.version} > > > > The result is the same > > I also checked status of the sockets on server with the netstat command. > > The number of ESTABLISHED is constantly and rapidly growing. > > Note, the problem is reproduced as a result of load testing. > > > ср, 20 февр. 2019 г. в 01:40, Christopher Schultz < > ch...@christopherschultz.net>: > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA256 > > > > Иналь, > > > > On 2/19/19 12:12, Иналь Кятов wrote: > > > I encountered a problem with embedded tomcat 8.5.29 (part of spring > > > boot 1.5). > > > > Can you retest with the current version of 8.5.x? Current version is > > 8.5.38, released 2019-02-11. > > > > - -chris > > -BEGIN PGP SIGNATURE- > > Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ > > > > iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxshcsACgkQHPApP6U8 > > pFgaVg//TF4/DVpFjtTLk+d6Z/AOcFX7SEYg/0SEKjpKtxaUr5+19umt5mMi+Zqk > > UkkCSB19KRpqLUY8o53xlgqL9SqqBF14Wh0T2FYqpXtKSfV/Nv6tvsEV6Bd9LqTz > > /RSFcAmCTL+SDIwXQ4FzmW55aaPfous9lKgPYdZlYy4UwVvG7PP/EOD7swR470eU > > DmvjkkOKPJ87mSFra3LJ5MxrvLAw+9PgEACLc4nF6Tkceisn7kTIP/s7SGKb4Few > > PWXYKy7NfcBASMYfikS/SAdCHNbjD9Za+L6okTuUjjvlNwAQvM7BWnG2CurpX8wQ > > oEinp/4OsXaD0yZ/pi+dmUOUS/AwSuaxD4YZWembSEvTW658bc+5YgpfcOLivcO+ > > iB4/erdLHW8dLW07Nl2EafTXvKTOXHNlL4HIrTLzoi8SlJ2b+j4U3/9b5LBke2TG > > HpQSo7MxqVfllhDTiwsYMRIkPupZEqR41x8wG4CpcfpQjXJMmAvaeFpBQA0ZnVyn > > OkbYDi3IF9C8uAd0sbEx2npZ05ptb8zyHmU0mTawBDSL/e+3xbcFvZ2v0LNujgVB > > VqJdtXOJKRA66l6dN+nS377guMeL5BQJS4PeRMIapWotJbuCE2nYgcjcie3ipClq > > SP00v4Vd85g4D5XPAWewoWJXRiOPMp1dc5pTYwviTgG6FNGtoCE= > > =wHth > > -END PGP SIGNATURE- > > -- WBR Maxim aka solomax - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fwd: websocket connections consume too much memory
I retest with *8.5.38* ... org.apache.tomcat.embed tomcat-embed-websocket ${tomcat-embedded.version} org.apache.tomcat.embed tomcat-embed-core ${tomcat-embedded.version} org.apache.tomcat.embed tomcat-embed-el ${tomcat-embedded.version} org.apache.tomcat tomcat-annotations-api ${tomcat-embedded.version} The result is the same I also checked status of the sockets on server with the netstat command. The number of ESTABLISHED is constantly and rapidly growing. Note, the problem is reproduced as a result of load testing. ср, 20 февр. 2019 г. в 01:40, Christopher Schultz < ch...@christopherschultz.net>: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Иналь, > > On 2/19/19 12:12, Иналь Кятов wrote: > > I encountered a problem with embedded tomcat 8.5.29 (part of spring > > boot 1.5). > > Can you retest with the current version of 8.5.x? Current version is > 8.5.38, released 2019-02-11. > > - -chris > -BEGIN PGP SIGNATURE- > Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ > > iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxshcsACgkQHPApP6U8 > pFgaVg//TF4/DVpFjtTLk+d6Z/AOcFX7SEYg/0SEKjpKtxaUr5+19umt5mMi+Zqk > UkkCSB19KRpqLUY8o53xlgqL9SqqBF14Wh0T2FYqpXtKSfV/Nv6tvsEV6Bd9LqTz > /RSFcAmCTL+SDIwXQ4FzmW55aaPfous9lKgPYdZlYy4UwVvG7PP/EOD7swR470eU > DmvjkkOKPJ87mSFra3LJ5MxrvLAw+9PgEACLc4nF6Tkceisn7kTIP/s7SGKb4Few > PWXYKy7NfcBASMYfikS/SAdCHNbjD9Za+L6okTuUjjvlNwAQvM7BWnG2CurpX8wQ > oEinp/4OsXaD0yZ/pi+dmUOUS/AwSuaxD4YZWembSEvTW658bc+5YgpfcOLivcO+ > iB4/erdLHW8dLW07Nl2EafTXvKTOXHNlL4HIrTLzoi8SlJ2b+j4U3/9b5LBke2TG > HpQSo7MxqVfllhDTiwsYMRIkPupZEqR41x8wG4CpcfpQjXJMmAvaeFpBQA0ZnVyn > OkbYDi3IF9C8uAd0sbEx2npZ05ptb8zyHmU0mTawBDSL/e+3xbcFvZ2v0LNujgVB > VqJdtXOJKRA66l6dN+nS377guMeL5BQJS4PeRMIapWotJbuCE2nYgcjcie3ipClq > SP00v4Vd85g4D5XPAWewoWJXRiOPMp1dc5pTYwviTgG6FNGtoCE= > =wHth > -END PGP SIGNATURE- >
Re: Fwd: websocket connections consume too much memory
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Иналь, On 2/19/19 12:12, Иналь Кятов wrote: > I encountered a problem with embedded tomcat 8.5.29 (part of spring > boot 1.5). Can you retest with the current version of 8.5.x? Current version is 8.5.38, released 2019-02-11. - -chris -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxshcsACgkQHPApP6U8 pFgaVg//TF4/DVpFjtTLk+d6Z/AOcFX7SEYg/0SEKjpKtxaUr5+19umt5mMi+Zqk UkkCSB19KRpqLUY8o53xlgqL9SqqBF14Wh0T2FYqpXtKSfV/Nv6tvsEV6Bd9LqTz /RSFcAmCTL+SDIwXQ4FzmW55aaPfous9lKgPYdZlYy4UwVvG7PP/EOD7swR470eU DmvjkkOKPJ87mSFra3LJ5MxrvLAw+9PgEACLc4nF6Tkceisn7kTIP/s7SGKb4Few PWXYKy7NfcBASMYfikS/SAdCHNbjD9Za+L6okTuUjjvlNwAQvM7BWnG2CurpX8wQ oEinp/4OsXaD0yZ/pi+dmUOUS/AwSuaxD4YZWembSEvTW658bc+5YgpfcOLivcO+ iB4/erdLHW8dLW07Nl2EafTXvKTOXHNlL4HIrTLzoi8SlJ2b+j4U3/9b5LBke2TG HpQSo7MxqVfllhDTiwsYMRIkPupZEqR41x8wG4CpcfpQjXJMmAvaeFpBQA0ZnVyn OkbYDi3IF9C8uAd0sbEx2npZ05ptb8zyHmU0mTawBDSL/e+3xbcFvZ2v0LNujgVB VqJdtXOJKRA66l6dN+nS377guMeL5BQJS4PeRMIapWotJbuCE2nYgcjcie3ipClq SP00v4Vd85g4D5XPAWewoWJXRiOPMp1dc5pTYwviTgG6FNGtoCE= =wHth -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Fwd: websocket connections consume too much memory
Hi everyone! I encountered a problem with embedded tomcat 8.5.29 (part of spring boot 1.5). The number of websocket connections that are stored in a variable "*connections" (look below) *is increasing indefinitely. package org.apache.coyote; public abstract class AbstractProtocol implements ProtocolHandler, MBeanRegistration { ... protected static class ConnectionHandler implements AbstractEndpoint.Handler { ... private final Map connections = new ConcurrentHashMap<>(); // <-- The number of websocket connections that are stored in a variable is increasing indefinitely ... } ... } As a result websocket connections consume too much memory. I see the reason for the fact that the socket remains in the SocketState.UPGRADED state even after closing the websocket. Although expected SocketState.CLOSED. Log: 2019-02-18 13:22:12.741 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] org.apache.tomcat.websocket.WsSession: *Closing WebSocket session [{1}]* 2019-02-18 13:22:12.742 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.tomcat.util.net.SocketWrapperBase: Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@723dc871 :org.apache.tomcat.util.net.NioChannel@7587eeb9:java.nio.channels.SocketChannel[connected local=attachment-8559c85989-w9k5r/10.244.4.175:8080 remote=/10.244.2.25:44986]], Read from buffer: [0] 2019-02-18 13:22:12.742 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.c.h.u.UpgradeProcessorInternal : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@723dc871 :org.apache.tomcat.util.net.NioChannel@7587eeb9:java.nio.channels.SocketChannel[connected local=attachment-8559c85989-w9k5r/10.244.4.175:8080 remote=/10.244.2.25:44986]], Status in: [OPEN_READ], State out: [UPGRADED] Full log by request below (I disguised private data as ###): 2019-02-18 13:22:12.731 DEBUG [test-service,,,] 1 --- [nio-8080-exec-9] o.a.tomcat.util.net.SocketWrapperBase: Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@723dc871 :org.apache.tomcat.util.net.NioChannel@7587eeb9:java.nio.channels.SocketChannel[connected local=/10.244.4.175:8080 remote=/10.244.2.25:44986]], Read from buffer: [0] 2019-02-18 13:22:12.731 DEBUG [test-service,,,] 1 --- [nio-8080-exec-9] o.a.coyote.http11.Http11InputBuffer : Received [GET ### HTTP/1.1 X-Real-IP: 10.244.0.0 X-Forwarded-For: 10.244.0.0,10.244.6.23 Authorization: ### Origin: http://ptdbo2kbm251lv:32175 Referer: http://ptdbo2lre202v:8081/DigestProcessor/ User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0) Accept-Encoding: gzip, deflate Accept: */* Cookie: ### X-Forwarded-Proto: http X-Forwarded-Port: 80 X-Forwarded-Host: ### upgrade: websocket connection: upgrade sec-websocket-key: ### host: ptdbo2kbm251lv sec-websocket-origin: ### sec-websocket-version: 13 ] 2019-02-18 13:22:12.731 DEBUG [test-service,,,] 1 --- [nio-8080-exec-9] o.a.t.util.http.Rfc6265CookieProcessor : Cookies: Parsing b[]: ### 2019-02-18 13:22:12.733 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8 2019-02-18 13:22:12.734 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@723dc871 :org.apache.tomcat.util.net.NioChannel@7587eeb9:java.nio.channels.SocketChannel[connected local=attachment-8559c85989-w9k5r/10.244.4.175:8080 remote=/10.244.2.25:44986]], Status in: [OPEN_READ], State out: [UPGRADING] 2019-02-18 13:22:12.734 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] org.apache.tomcat.websocket.WsSession: Created WebSocket session [15f] 2019-02-18 13:22:12.734 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.t.websocket.server.WsFrameServer : wsFrameServer.onDataAvailable 2019-02-18 13:22:12.735 DEBUG [attachment,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.tomcat.util.net.SocketWrapperBase: Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@723dc871 :org.apache.tomcat.util.net.NioChannel@7587eeb9:java.nio.channels.SocketChannel[connected local=attachment-8559c85989-w9k5r/10.244.4.175:8080 remote=/10.244.2.25:44986]], Read from buffer: [0] 2019-02-18 13:22:12.735 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.t.websocket.server.WsFrameServer : Read [71] bytes into input buffer ready for processing 2019-02-18 13:22:12.735 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 --- [nio-8080-exec-9] o.a.t.websocket.server.WsFrameServer : WebSocket frame received. fin [true], rsv [0], OpCode [1], payload length [65] 2019-02-18 13:22:12.741 DEBUG [test-service,e248a18fb0789f6c,e248a18fb0789f6c,true] 1 ---