mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: SessionManager concurrency fix for session not active. Catch onSessionClosed event exceptions
parent
c4d2edf66e
commit
c43f211dd1
|
@ -286,7 +286,10 @@ public abstract class SessionManager {
|
|||
|
||||
public Session storeSessionNotActive(Session sessionNotActive) {
|
||||
final String sessionId = sessionNotActive.getSessionId();
|
||||
this.sessionsNotActive.put(sessionId, sessionNotActive);
|
||||
if (this.sessionsNotActive.putIfAbsent(sessionId, sessionNotActive) != null) {
|
||||
log.warn("Concurrent initialization of session {}", sessionId);
|
||||
return this.sessionsNotActive.get(sessionId);
|
||||
}
|
||||
this.initializeCollections(sessionId);
|
||||
return sessionNotActive;
|
||||
}
|
||||
|
@ -537,7 +540,12 @@ public abstract class SessionManager {
|
|||
final String mediaNodeId = session.getMediaNodeId();
|
||||
|
||||
if (session.close(reason)) {
|
||||
sessionEventsHandler.onSessionClosed(session.getSessionId(), reason);
|
||||
try {
|
||||
sessionEventsHandler.onSessionClosed(session.getSessionId(), reason);
|
||||
} catch (Exception e) {
|
||||
log.error("Error recording 'sessionDestroyed' event for session {}: {} - {}", session.getSessionId(),
|
||||
e.getClass().getName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
this.cleanCollections(session.getSessionId());
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RpcNotificationService {
|
|||
RpcConnection connection = new RpcConnection(t.getSession());
|
||||
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
|
||||
if (oldConnection != null) {
|
||||
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
|
||||
log.warn("Concurrent initialization of rpcSession {}", participantPrivateId);
|
||||
connection = oldConnection;
|
||||
}
|
||||
return connection;
|
||||
|
|
Loading…
Reference in New Issue