Futures returned by async socket.poll are not removed from socket._recv_futures if the future is cancelled before the event arrives. This is similar to #968, just in socket rather than poller. The sample code counts up to 10.
Code to reproduce bug
import zmq
import zmq.asyncio
import asyncio
context = zmq.asyncio.Context()
async def leak():
socket = context.socket(zmq.REP)
socket.bind('inproc://#1')
for _ in range(10):
future = socket.poll(flags=zmq.POLLIN)
future.cancel()
await asyncio.sleep(0) # allow callbacks to run
print(len(socket._recv_futures))
asyncio.run(leak())
What pyzmq version?
25.1.0
What libzmq version?
4.3.4
Python version (and how it was installed)
3.11.4
OS
openSUSE 15.4
What happened?
Futures returned by async socket.poll are not removed from socket._recv_futures if the future is cancelled before the event arrives. This is similar to #968, just in socket rather than poller. The sample code counts up to 10.
Code to reproduce bug
Traceback, if applicable
No response
More info
No response