[NETCONF-664] The ConcurrentModificationException was found in the websocket test in restconf-nb-rfc8040. Created: 09/Apr/20  Updated: 03/May/20  Resolved: 21/Apr/20

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: Magnesium SR1, Aluminium, Sodium SR3

Type: Bug Priority: Medium
Reporter: wang senxiao Assignee: wang senxiao
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The specific code in AbstractCommonSubscriber.java is as follows. When the yang notification is monitored, the websocket message is sent.

/**code**/

synchronized void post(final String data) {

     for (final WebSocketSessionHandler subscriber : subscribers) {

             final Optional<InetSocketAddress> remoteEndpointAddress = subscriber.getRemoteEndpointAddress();

             if (remoteEndpointAddress.isPresent()) {

                       subscriber.sendDataMessage(data);

                       LOG.debug("Data was sent to subscriber {} on address {}:", this, remoteEndpointAddress.get());

             } else {

                        // removal is probably not necessary, because it will be removed explicitly soon after invocation of

                       // onWebSocketClosed(..) in handler; but just to be sure ...

                       subscribers.remove(subscriber);

                       LOG.debug("Subscriber for {} was removed - web-socket session is not open.", this);

             }

       }

}

In the process of traversing the set, delete the element, will cause ConcurrentModificationException.



 Comments   
Comment by Jamo Luhrsen [ 29/Apr/20 ]

wsx25289, can you provide a few more details to reproduce this issue? I know this is marked resolved with this patch
but I'm not sure the exact steps that I can create it in CSIT.

btw, it's weird that this JIRA didn't pick up your patch. I saw you put the correct JIRA: NETCONF-664 in the commit
message so I expected it to show up here under gerrit reviews.

Comment by wang senxiao [ 29/Apr/20 ]

Sorry, I will describe it later。

Comment by wang senxiao [ 03/May/20 ]

operation steps
1) First, complete the websocket subscription operation, and then use websocket client connect,
Trigger the yang notification reporting process, and the normal message can be received in the websocket client.
2) Then,Disconnect the websocket client at this time. Reconnect, trigger yang notification message to report,
ConcurrentModificationException will Occasional produce in post method

Generated at Wed Feb 07 20:15:35 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.