GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `KqueueSelector` miscounts max events · Issue #110038 · python/cpython Closed Labels DescriptionBug reportBug description:
kqueue requires to register two filters, one for read and one for write. But KqueueSelector.select() calls kqueue.control() counting the number of registered fds, not the filters. As a result a single call to select() won't return all the available events. >>> import socket, selectors >>> sel = selectors.KqueueSelector() >>> s1, s2 = socket.socketpair() >>> sel.register(s1, selectors.EVENT_READ | selectors.EVENT_WRITE) SelectorKey(fileobj=<socket.socket fd=4, family=1, type=1, proto=0>, fd=4, events=3, data=None) >>> s2.send(b"foo") 3 >>> sel.select() [(SelectorKey(fileobj=<socket.socket fd=4, family=1, type=1, proto=0>, fd=4, events=3, data=None), 2)] >>> sel.select() [(SelectorKey(fileobj=<socket.socket fd=4, family=1, type=1, proto=0>, fd=4, events=3, data=None), 1)] (Note that the two events are only visible on two subsequent selects) For users like asyncio, this might mean missing a loop cycle or more (depending on number of registered readers/writers and ready events) before an event is seen. I previously said that this might cause deadlocks but I could not produce an example where a read/write event is never seen. CPython versions tested on:3.11, 3.12, CPython main branch Operating systems tested on:macOS, Other Linked PRsActivity
MetadataMetadataAssigneesLabelsProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |