Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
proton-c-0.18.1
-
None
-
None
-
Windows
Description
In Python binding the built-in EventInjector does not work on Windows.
https://issues.apache.org/jira/browse/PROTON-1071
So I needed to implement one using a socket pair. I can set one socket as selectable on reactor. The on_selectable_init and on_selectable_readable events are filed once correctly when I trigger an event by sending a byte to the selectable socket. The problem is that the on_selectable_readable event is fired again without any triggering bytes. When i do a recv call on the socket, reactor hangs because there is no data available to read.
The problem happens because how selectables are implemented on Windows. The selectable handles are bound to the iocp and readable events are generated when the zero-byte read completes. This works for internal handles because pni_iocp_recv is called to get data and a new begin_zero_byte_read is issued after the recv call. For external selectable the recv call is made outside of protoc-c engine so no more read call is issued. in selector.c the triggered_list_head is not cleared and the event loop will fire the same event again. I didn't find a good way to fix this, and end up with a workaround by using pn_selector_update to generate a read loop on the socket. See the attached patch for the workaround.
Attachments
Attachments
Issue Links
- is duplicated by
-
PROTON-2286 Container.selectable(EventInjector) in python on Windows causes "OSError: [WinError 10038] An operation was attempted on something that is not a socket", eliminating use of custom events
- Closed
- is related to
-
PROTON-1071 EventInjector hangs on Windows
- Open