Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
messageChannels map memory leak with REGISTER over websocket connections #3
In NioWebSocketMessageChannel.processMessage() there's a call to NioTcpMessageProcessor.assignChannelToDestination() which ultimately adds an entry to ConnectionOrientedMessageProcessor.messageChannels with a key from the Contact header of the REGISTER request.
But this key never seems to be removed because the Channel's .getKey() returns a different key, and as far as I can tell the map is only cleaned up by removing the keys that the channels specify. The contact hostname is just some '.invalid' hostname so a key of, e.g. "wss:s03k4bate5k0.invalid:5060" is inserted into the map, but the channel's .getKey() returns "wss:127.0.0.1:40144".
And I believe an entry with the key "wss:127.0.0.1:40144" is inserted into the map by NioWebSocketMessageProcessor.CreateChannel() which is cleaned up because it matches the Channel's own idea of what its key is.
There should be no need for the stack to keep the mapping of Contact to socket connections as this should be done at the application level using RFC 5626 as described in RFC7118