Description
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:
- SockJs heartbeat causes deadlock with XHR polling [SPR-14833] #19399 SockJs heartbeat causes deadlock with XHR polling
Backported to: 4.2.9