Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1692

External selectable does not work on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • proton-c-0.18.1
    • None
    • proton-c
    • 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

        1. proton-c.patch
          3 kB
          Xin Chen

        Issue Links

          Activity

            People

              Unassigned Unassigned
              xinchen Xin Chen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: