Fix web-socket timeout closure exceptions 23/104423/6
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 12:52:30 +0000 (13:52 +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>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java

index 75cba43a70dac8287ace8a742172b97e478db67e..e5fe75261feaedd7780bc80569b91fa21473b69c 100644 (file)
@@ -120,10 +120,8 @@ abstract class AbstractCommonSubscriber<T> extends AbstractNotificationsData imp
 
     @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);
         }