Fwd: File descriptors leak when using websocket client

2019-01-23 Thread vtarasov

Hello!

We have file descriptors leak when we use websocket client.

Our environment:

1. spring-boot 2.0.6

2. tomcat-embed 8.5.34

3. ubuntu 16.04

How to reproduce:

1. Connect to websocket server with using of WsWebSocketContainer (after 
this step we will have WsSession and WsRemoteEndpointImplClient to send 
messages)


2. Check the file descriptors usage (on my Ubuntu: lsof -p  | 
wc -l)


3. Reboot websocket server or stop it

4. Have result = -1 at WsFrameClientCompletionHandler.completed(...) 
because of async channel was broken


5. At this method WsSession.close(...) and 
WsSession.sendCloseMessage(...) will be called


6. At method WsSession.sendCloseMessage(...) will be called 
wsRemoteEndpoint.sendMessageBlock(Constants.OPCODE_CLOSE, msg, true); 
and sometimes it will be completed successful (without IOException 
broken pipe) therefore async channel will not be closed and it's file 
descriptor will not be released because of code block will not be reached:


}catch (IOException | WritePendingException e) {
...
wsRemoteEndpoint.close();
...
}

The problem is repeated often when we have many reconnect attemption 
(when websocket server connection is constantly broken).


Thanks!



Tomcat WebSocket client file descriptors leak

2019-01-24 Thread vtarasov

Hello!

We found the leak of Tomcat WebSocket client file descriptors. File 
descriptors are not closed when the connection between server and client 
is broken abnormally (from the server side if the server process is 
killed for example).


Test project and how to reproduce you can find in my repo on GitHub: 
https://github.com/vatarasov/wstest


Thanks!

Tarasov Vladimir,

Java Dev,  Naumen



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Tomcat WebSocket client file descriptors leak

2019-01-28 Thread vtarasov

Thank you very much!

We will waiting this fix commit. After this i will test it and will 
write you the results.



Tarasov Vladimir, Senior Java Developer, Naumen


28.01.2019 22:20, Mark Thomas пишет:

On 24/01/2019 10:57, vtarasov wrote:

Hello!

We found the leak of Tomcat WebSocket client file descriptors. File
descriptors are not closed when the connection between server and client
is broken abnormally (from the server side if the server process is
killed for example).

Test project and how to reproduce you can find in my repo on GitHub:
https://github.com/vatarasov/wstest

Thanks for the test case (and the previously supplied analysis).

I have a patch for this and - after updating the client fat JAR to
include the new Tomcat JARs, the open file count is constant.

I'll commit the patch shortly (I needs a little cleaning up).

If you are able to confirm the fix once I have committed it, that would
be very helpful.

Kind regards,

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org