atmosphere-extensions icon indicating copy to clipboard operation
atmosphere-extensions copied to clipboard

Socket IO Module - Hanging on Shutdown

Open dshurt opened this issue 9 years ago • 8 comments

Environment: Atmosphere-Runtime 2.3.5 Atmosphere-Socket 2.3.2

running in a webapp on Tomcat 7.55

Issue: On shutdown of Tomcat...Tomcat hangs and never terminates

Cause: (As far as the issue has been traced)

SocketIOSessionManagerImpl used an executor that doesn't get property shutdown. So the heartbeat is preventing shutdown.

Suggested Fix:

Shutdown the executor when the AtmosphereFramework destroys the interceptor.

dshurt avatar Oct 23 '15 15:10 dshurt

@dshurt Pull request welcomed!

jfarcand avatar Oct 23 '15 16:10 jfarcand

Alright, I'll see what I can do.

dshurt avatar Oct 23 '15 22:10 dshurt

Could you tell me more about your case? Recently I'm looking for a way to integrate the socket.io and tomcat .But I'm facing this problem here when i start up tomcat :

javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable

I'm not sure what did that mean.At first I think it looks like Atmosphere-extensions for SocketIO cann't running in tomcat,but now it seems like you did it.So I'm looking for some help here,THx

2efPer avatar Apr 15 '16 07:04 2efPer

Sounds like that exception is about websocket support. Tomcat 7+ should have websocket support. However, some older version may have a custom version. (check your tomcat lib dir for websocket-api.jar, and tomcat7-websocket.jar or equivalent) I didn't have issue with websocket with tomcat but I did have issue with long poll (comet) support. My issue, I believed, stems from a library call Stripes framework which has some filters that don't support async calls.

This issue however was all about the shutdown of tomcat. The socket io extension opens a thread pool which wasn't shutdown properly. I created a pull request to correct that. I'm currently using this solution. I used the socket io library (0.98 version) on the client for websocket and atmosphere on the server. Keep mind, if your server sits behind a proxy (Eg. Apache, nginx...etc) they must be setup to support websocket or it won't work. In my case, I detect that and fall back to client-side polling since long poll didn't work.

Hopefully that's helpful.

dshurt avatar Apr 16 '16 03:04 dshurt

@dshurt Where is your pull request? Do it again and I will merge and release.

jfarcand avatar Apr 17 '16 22:04 jfarcand

It was merged several months ago. However, I don't know if was released.
See https://github.com/Atmosphere/atmosphere-extensions/pull/212

dshurt avatar Apr 19 '16 21:04 dshurt

Hi, I was looking into the code and only 'extensions-2.3.x' branch includes these changes but 'extensions-2.4.x' and 'master' don't.

Just check out destroy() method of org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor on these branches.

Is that ok?

jcstarna avatar Mar 31 '17 21:03 jcstarna

@jcstarna Pull request welcomed :-)

jfarcand avatar Apr 02 '17 23:04 jfarcand