ef-labs / vertx-jersey

Run jersey in vert.x
MIT License
150 stars 47 forks source link

Server socket timeout control #73

Open potatopankakes opened 6 years ago

potatopankakes commented 6 years ago

I am running into issues w/the jersey server sockets not closing out. The file handles seem to be accumulating and not closing out. I see the accumulation when I run lsof. All of my REST methods are async, and so take @Suspended final AsyncResponse asyncResponse, and I believe all code paths call asyncResponse.resume()... which is backed up by clients always getting their response. Despite that, the Jersey server's sockets don't seem to close out w/in the OS, but I see little if no memory leaks/accumulation. Would configuration of socket timeouts be configured in Jersey, Vert.x, or maybe Netty?

adrianluisgonzalez commented 6 years ago

I would guess socket timeouts would be configured via vert.x (which then passes configuration on to netty).

If you are calling asyncResponse.resume() that should end the response and close the connection for you. You could check to see if there is any functional difference between calling ServerWebSocket#close and HttpServerResponse#end.

It might be worth stepping through the code to confirm the web socket is in fact closing as expected. https://github.com/ef-labs/vertx-jersey/blob/develop/vertx-jersey/src/main/java/com/englishtown/vertx/jersey/impl/VertxResponseWriter.java#L348