Fix web-socket timeout closure exceptions 62/104662/1
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>
Wed, 15 Feb 2023 13:58:40 +0000 (15:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Mar 2023 13:48:14 +0000 (14:48 +0100)
As noted in WebSocketSessionHandler.onWebSocketClosed(), there is no
guarantee the session reports isOpen(). Performing the same check in
AbstractCommonSubscriber.removeSubscriber() (via isConnected()) can
therefore result in an ISE.

Fix this by removing the check.

JIRA: NETCONF-970
Change-Id: I6e437d9821e698e3faca121402a97b88ac486229
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit 0d05f5be80762b833acc0b8337b68b353e4c673a)

restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java

index d83e15e63bb67206f020db6ba81ad5a634da7b79..644b49688bb6da67ab738514692548f3fa786b6c 100644 (file)
@@ -120,10 +120,8 @@ abstract class AbstractCommonSubscriber<P, T> extends AbstractNotificationsData
 
     @Override
     public synchronized void removeSubscriber(final StreamSessionHandler subscriber) {
-        final boolean isConnected = subscriber.isConnected();
-        checkState(isConnected);
-        LOG.debug("Subscriber {} is removed", subscriber);
         subscribers.remove(subscriber);
+        LOG.debug("Subscriber {} is removed", subscriber);
         if (!hasSubscribers()) {
             ListenersBroker.getInstance().removeAndCloseListener(this);
         }