Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractSockJsSession deadlock when tomcat WsSession is closing [SPR-14917] #19484

Closed
spring-projects-issues opened this issue Nov 17, 2016 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 17, 2016

Ekaterina Grebtsova opened SPR-14917 and commented

We are using spring version 4.2.8 and tomcat 7. And we got deadlock when tomcat started closing websocket session and in the same time AbstractSockJsSession started hearbeat task.

THREAD 1:
org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.HeartbeatTask
-> LOCK org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#responseLock LOCK
-> org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#sendHeartbeat
-> org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#writeFrame
-> org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession#disconnect
-> org.springframework.web.socket.adapter.AbstractWebSocketSession#close(org.springframework.web.socket.CloseStatus)
-> org.springframework.web.socket.adapter.standard.StandardWebSocketSession#closeInternal
-> org.apache.tomcat.websocket.WsSession#close(javax.websocket.CloseReason)
-> org.apache.tomcat.websocket.WsSession#doClose
-> DEADLOCK org.apache.tomcat.websocket.WsSession#stateLock DEADLOCK

THREAD 2:
org.apache.tomcat.websocket.WsSession#onClose
-> LOCK org.apache.tomcat.websocket.WsSession#stateLock LOCK
-> org.apache.tomcat.websocket.WsSession#fireEndpointOnClose
-> org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter#onClose
-> org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler#afterConnectionClosed
-> org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#delegateConnectionClosed
-> org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#cancelHeartbeat
-> DEADLOCK org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession#responseLock DEADLOCK


Affects: 4.2.8

Issue Links:

Backported to: 4.2.9

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

I've made a change that should fix this. Thanks for the report! Not sure how easy it is to test but it would be great if you could try it out.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants