Skip to content

Lock acquired on object responseLock in method sendMessageInternal of class AbstractHttpSockJsSession is not released in some error condition resulting in deadlock [SPR-13449] #18029

Closed
@spring-projects-issues

Description

@spring-projects-issues

Chandan opened SPR-13449 and commented

We are using spring version 4.1.5 and container is websphere(WAS). On server side we are using webscoket with SockJs -need fallback mechanism as WAS do not support websockets. Client is sockjs client -but instead of using messaging protocol (STOMP) over socket, we use JSON RPC. there could be more than 10 XHR requests per second. While doing some more load testing and negative scenarios -like abruptly closing browsers, idle period in browsers etc. we run in scenario where one of thread to send message acquire lock on object responseLock in method sendMessageInternal of class AbstractHttpSockJsSession -resulting in blocked state.
As perconnection handler is being used, subsequent requests are served but over period cpu usage increases as number of blocked threads increase.

Waiting for Monitor Lock on java/lang/Object@0x0000000022416F08 (This is object lock while sending message)
at org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.sendMessageInternal(AbstractHttpSockJsSession.java:279(Compiled Code)) 
at org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.sendMessage(AbstractSockJsSession.java:161(Compiled Code)) 
at com/avaya/cecobrowsega/cobrowse/service/handler/AgentConnectionHandlerImpl.send(AgentConnectionHandlerImpl.java:579(Compiled Code)) 

The send message is like this

@Override
public void send(String data) throws IOException {
    webSocketSession.sendMessage(new TextMessage(data));
}

synchronzing the "webSocketSession" helps alleviate the issue -but I am not very sure what is happening here. Do we need to handle threading issue in our handler implementation or is there a contention at AbstractHttpSockJsSession

I saw a similar issue @ #17911 but then it was specific to STOMP


Affects: 4.1.5

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions