Component
pygls/protocol/json_rpc.py
Summary
For every outgoing request, _result_types[msg_id] is populated but only removed when a response is received. If the remote peer never responds (due to timeout, crash, or network loss), the entry leaks indefinitely.
Steps to Reproduce
- Send a request to a peer that will never answer.
_result_types retains the mapping forever.
Expected Behavior
Entries should be cleaned up when the corresponding future is cancelled or garbage-collected.
Actual Behavior
Memory leak for every unanswered request.
Affected Code (pygls/protocol/json_rpc.py, ~L697-698)
self._request_futures[msg_id] = future
self._result_types[msg_id] = self.get_result_type(method)
Proposed Fix
Add a done-callback to future that pops the _result_types entry even when no response arrives.
Component
pygls/protocol/json_rpc.py
Summary
For every outgoing request,
_result_types[msg_id]is populated but only removed when a response is received. If the remote peer never responds (due to timeout, crash, or network loss), the entry leaks indefinitely.Steps to Reproduce
_result_typesretains the mapping forever.Expected Behavior
Entries should be cleaned up when the corresponding future is cancelled or garbage-collected.
Actual Behavior
Memory leak for every unanswered request.
Affected Code (
pygls/protocol/json_rpc.py, ~L697-698)Proposed Fix
Add a done-callback to
futurethat pops the_result_typesentry even when no response arrives.