Skip to content

Triopg crashes on windows due to "TypeError: need a stdlib socket" #31

Closed
@touilleMan

Description

@touilleMan

TrioPG (trio wrapper of asyncpg based on trio-asyncio) is crashing on windows:

fut = <Task cancelled coro=<BaseEventLoop.create_connection() done, defined at C:\Python36-x64\lib\asyncio\base_events.py:681>>
timeout = 60
    @coroutine
    def wait_for(fut, timeout, *, loop=None):
        """Wait for the single Future or coroutine to complete, with timeout.
    
        Coroutine will be wrapped in Task.
    
        Returns result of the Future or coroutine.  When a timeout occurs,
        it cancels the task and raises TimeoutError.  To avoid the task
        cancellation, wrap it in shield().
    
        If the wait is cancelled, the task is also cancelled.
    
        This function is a coroutine.
        """
        if loop is None:
            loop = events.get_event_loop()
    
        if timeout is None:
            return (yield from fut)
    
        waiter = loop.create_future()
        timeout_handle = loop.call_later(timeout, _release_waiter, waiter)
        cb = functools.partial(_release_waiter, waiter)
    
        fut = ensure_future(fut, loop=loop)
        fut.add_done_callback(cb)
    
        try:
            # wait until the future completes or the timeout
            try:
                yield from waiter
            except futures.CancelledError:
                fut.remove_done_callback(cb)
                fut.cancel()
                raise
    
            if fut.done():
                return fut.result()
            else:
                fut.remove_done_callback(cb)
                fut.cancel()
>               raise futures.TimeoutError()
E               concurrent.futures._base.TimeoutError
C:\Python36-x64\lib\asyncio\tasks.py:362: TimeoutError
------------------------------ Captured log call ------------------------------
base_events.py            1299 ERROR    Exception in default exception handler
Traceback (most recent call last):
  File "C:\Python36-x64\lib\asyncio\base_events.py", line 1293, in call_exception_handler
    self.default_exception_handler(context)
  File "C:\Python36-x64\lib\site-packages\trio_asyncio\async_.py", line 50, in default_exception_handler
    raise exception
  File "C:\Python36-x64\lib\site-packages\trio_asyncio\base.py", line 600, in _writer_loop
    await _wait_writable(fd)
  File "C:\Python36-x64\lib\site-packages\trio\_core\_io_windows.py", line 371, in wait_socket_writable
    await self._wait_socket("write", sock)
  File "C:\Python36-x64\lib\site-packages\trio\_core\_io_windows.py", line 350, in _wait_socket
    raise TypeError("need a stdlib socket")
TypeError: need a stdlib socket

see full CI logs here: https://ci.appveyor.com/project/touilleMan/triopg/build/job/mi2fi495cgvurjb8#L533

Error is the same than reported in #22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions