graphql-python/gql

set_wakeup_fd exception running in pywin32 service

code-is-art opened this issue · 2 comments

When running with async transport AIOHTTPTransport within a pywin32 Windows server 2019 service in python 3.10.9 I get a "set_wakeup_fd only works in main thread of the main interpreter" exception. I had to switch to a sync transport to get it to work. Currently using RequestsHTTPTransport with no problem. Here is the relevant part of the trace.

result = self.gql_client.execute(
  File "C:\Program Files\Python310\lib\site-packages\gql\client.py", line 378, in execute
    loop = asyncio.get_event_loop()
  File "C:\Program Files\Python310\lib\asyncio\events.py", line 668, in get_event_loop
    self.set_event_loop(self.new_event_loop())
  File "C:\Program Files\Python310\lib\asyncio\events.py", line 688, in new_event_loop
    return self._loop_factory()
  File "C:\Program Files\Python310\lib\asyncio\windows_events.py", line 315, in __init__
    super().__init__(proactor)
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 639, in __init__
    signal.set_wakeup_fd(self._csock.fileno())
ValueError: set_wakeup_fd only works in main thread of the main interpreter

From my research it has to do with the way python handles asyncio after 3.7 and its preference for ProactorEventLoop. This would be on the gql 3.4.0 release.

I just verified and all the tests are passing on Windows with Python version 3.10.9 so your problem is probably related to that pywin32 service.
Could you please post a minimal reproducible code example to be able to reproduce your problem?

Closing this issue as it cannot be reproduced.
This issue could be reopened if we have more information.