We're handling a number of KATCP transports behind the CASPER FPGA package and have always wrapped the fpga.transport.disconnect call in a try-except block. But the service ends up opening too many file descriptors and I've narrowed down the cause to the following error raised during disconnect (that was previously excepted):
...
File "/home/sonata/dev/nexus_otl/src/nexus_otl/server.py", line 169, in _disconnect_fengines
feng.fpga.transport.disconnect()
File "/opt/mnt/miniconda3/envs/ataobs/lib/python3.9/site-packages/casperfpga/transport_katcp.py", line 256, in disconnect
katcp.CallbackClient.disconnect(self)
File "/opt/mnt/miniconda3/envs/ataobs/lib/python3.9/site-packages/katcp/client.py", line 507, in disconnect
self._disconnect()
File "/opt/mnt/miniconda3/envs/ataobs/lib/python3.9/site-packages/katcp/client.py", line 512, in _disconnect
self._stream.close(exc_info=exc_info)
File "/opt/mnt/miniconda3/envs/ataobs/lib/python3.9/site-packages/tornado/iostream.py", line 442, in close
self.io_loop.remove_handler(self.fileno())
File "/opt/mnt/miniconda3/envs/ataobs/lib/python3.9/site-packages/tornado/platform/asyncio.py", line 106, in remove_handler
self.readers.remove(fd)
KeyError: 24
We're handling a number of KATCP transports behind the CASPER FPGA package and have always wrapped the
fpga.transport.disconnectcall in a try-except block. But the service ends up opening too many file descriptors and I've narrowed down the cause to the following error raised during disconnect (that was previously excepted):katcp==0.9.3
tornado==4.5.3
Python 3.9.23