Hi @pratik Thanks for reaching out. This seems to be an ongoing issue from the product end. The fix will be rolled out in 2-4weeks from now but Rebooting the APIM VMs is the only workaround we can apply for now.
RCA: Issue is that there were cases where a close socket event was invoked on an active websocket channel if the websocket was processing of msg received events. This would lead to cases where if the receive event was cancelled, the cancellation event is not being propagated to the close connection event, even when the same cancellation token was passed. In order to mitigate the issue, we added a handler to forcibly close the websocket connection on a close event to ensure connections are closed.
let me know incase of further queries, I would be happy to assist you.
Please 'Accept as answer' and ‘Upvote’ if it helped.
Accepting answers will help increase the visibility of this question and the solution for anyone else who may run into the same issue. Thank you for helping to improve Microsoft Q&A!