epics-base / p4p

Python bindings for the PVAccess network client and server.
BSD 3-Clause "New" or "Revised" License
24 stars 37 forks source link

"_write_to_self" Resource temporarily unavailable #143

Open mdavidsaver opened 3 months ago

mdavidsaver commented 3 months ago

With py3.11 using P4P with asyncio. Connecting to a large number of channels too longer than I expected. Turning on asyncio debugging shows many repetitions of:

DEBUG:asyncio:Fail to write a null byte into the self-pipe socket
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 139, in _write_to_self
    csock.send(b'\0')
BlockingIOError: [Errno 11] Resource temporarily unavailable

@coretl Does this look familiar? I recall your mentioning seeing a scalability issue with asyncio call_soon_threadsafe().

coretl commented 3 months ago

I haven't seen this before, but I do recall performance issues when doing large numbers of call_soon_threadsafe(). My strategy was to copy the wakeup code from cothread and adapt for asyncio.