Skip to content

Instantly share code, notes, and snippets.

@graingert
Created Aug 24, 2021
Embed
What would you like to do?
amirouche-generator-stop
2021-08-24 09:11:54.057 | ERROR | __main__:get:51 - http get failed with exception url: https://hyper.dev, <class 'RuntimeError'>
Traceback (most recent call last):
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_backends/anyio.py", line 60, in read
return await self.stream.receive(n)
│ │ │ └ 65536
│ │ └ <function TLSStream.receive at 0x00007f0102d79920>
│ └ TLSStream(transport_stream=<anyio._backends._asyncio.SocketStream object at 0x00007f010434cb80>, standard_compatible=False, _...
<httpcore._backends.anyio.SocketStream object at 0x00005651a1184608>
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_backends/anyio.py", line 60, in read
return await self.stream.receive(n)
│ │ │ └ 65536
│ │ └ <function TLSStream.receive at 0x00007f0102d79920>
│ └ TLSStream(transport_stream=<anyio._backends._asyncio.SocketStream object at 0x00007f010434cb80>, standard_compatible=False, _...
<httpcore._backends.anyio.SocketStream object at 0x00005651a1184608>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/anyio/_core/_tasks.py", line 101, in __exit__
retval = self._cancel_scope.__exit__(exc_type, exc_val, exc_tb)
│ │ │ │ │ └ <traceback object at 0x00007f004b330b60>
│ │ │ │ └ GeneratorExit()
│ │ │ └ <class 'GeneratorExit'>
│ │ └ <function CancelScope.__exit__ at 0x00007f0102d08340>
│ └ <anyio._backends._asyncio.CancelScope object at 0x00005651a1184598>
<anyio._core._tasks.FailAfterContextManager object at 0x00005651a11854b0>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/anyio/_backends/_asyncio.py", line 290, in __exit__
raise RuntimeError('Attempted to exit cancel scope in a different task than it was '
RuntimeError: Attempted to exit cancel scope in a different task than it was entered in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "amirouche.py", line 78, in <module>
asyncio.run(main())
│ │ └ <function main at 0x00007f0103a260c0>
│ └ <function run at 0x00007f010474bd80>
<module 'asyncio' from '/usr/lib/pypy3/lib-python/3/asyncio/__init__.py'>
File "/usr/lib/pypy3/lib-python/3/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object main at 0x00007f0103a02188>
│ └ <function BaseEventLoop.run_until_complete at 0x00007f010467e7a0>
<_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/pypy3/lib-python/3/asyncio/base_events.py", line 574, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0x00007f010467e700>
<_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/pypy3/lib-python/3/asyncio/base_events.py", line 541, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x00007f0104680480>
<_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/pypy3/lib-python/3/asyncio/base_events.py", line 1786, in _run_once
handle._run()
│ └ <function Handle._run at 0x00007f0104792d40>
<Handle Task.__wakeup(<Future finished result=None>)>
File "/usr/lib/pypy3/lib-python/3/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member_descriptor object at 0x00007f0104789d60>
│ │ │ │ └ <Handle Task.__wakeup(<Future finished result=None>)>
│ │ │ └ <member_descriptor object at 0x00007f0104789d80>
│ │ └ <Handle Task.__wakeup(<Future finished result=None>)>
│ └ <member_descriptor object at 0x00007f0104789dc0>
<Handle Task.__wakeup(<Future finished result=None>)>
File "/usr/lib/pypy3/lib_pypy/_contextvars.py", line 41, in run
return callable(*args, **kwargs)
│ │ └ {}
│ └ (<Future finished result=None>,)
<bound method Task.__wakeup of <Task pending coro=<main() running at amirouche.py:75> cb=[_run_until_complete_cb() at /usr/li...
File "/usr/lib/pypy3/lib-python/3/asyncio/tasks.py", line 329, in __wakeup
self.__step()
<Task pending coro=<main() running at amirouche.py:75> cb=[_run_until_complete_cb() at /usr/lib/pypy3/lib-python/3/asyncio/ba...
File "/usr/lib/pypy3/lib-python/3/asyncio/tasks.py", line 249, in __step
result = coro.send(None)
│ └ <function coroutine.send at 0x00007f01087f3ca0>
<coroutine object main at 0x00007f0103a02188>
File "amirouche.py", line 75, in main
break
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/aiostream/aiter_utils.py", line 198, in __aexit__
await aclose()
<bound method async_generator.aclose of <async generator object base_combine.raw at 0x00007f0103a4a070>>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/aiostream/stream/advanced.py", line 96, in base_combine
manager.create_task(streamer)
│ │ └ <aiostream.core.Streamer object at 0x00005651a530c1e0>
│ └ <function StreamerManager.create_task at 0x00007f0104633ba0>
<aiostream.manager.StreamerManager object at 0x00007f0103a53b08>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/aiostream/manager.py", line 90, in __aexit__
return await self.stack.__aexit__(*args)
│ │ │ └ (<class 'GeneratorExit'>, GeneratorExit(), <traceback object at 0x00007f004b330a20>)
│ │ └ <function AsyncExitStack.__aexit__ at 0x00007f01046a1560>
│ └ <contextlib.AsyncExitStack object at 0x00007f0103a53bb0>
<aiostream.manager.StreamerManager object at 0x00007f0103a53b08>
File "/usr/lib/pypy3/lib-python/3/contextlib.py", line 661, in __aexit__
cb_suppress = await cb(*exc_details)
│ └ (<class 'GeneratorExit'>, GeneratorExit(), <traceback object at 0x00007f004b330a20>)
<function AsyncExitStack._create_async_exit_wrapper.<locals>._exit_wrapper at 0x00007f0104ca97e0>
File "/usr/lib/pypy3/lib-python/3/contextlib.py", line 552, in _exit_wrapper
return await cm_exit(cm, exc_type, exc, tb)
│ │ │ │ └ <traceback object at 0x00007f004b330a20>
│ │ │ └ GeneratorExit()
│ │ └ <class 'GeneratorExit'>
│ └ <aiostream.core.Streamer object at 0x00005651a530c330>
<function AsyncIteratorContext.__aexit__ at 0x00007f01046a1ba0>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/aiostream/aiter_utils.py", line 198, in __aexit__
await aclose()
<bound method async_generator.aclose of <async generator object call.raw at 0x00005651a11a5420>>
> File "amirouche.py", line 43, in get
response = await http.get(url)
│ │ └ 'https://hyper.dev'
│ └ <function AsyncClient.get at 0x00007f0103c95e20>
<httpx.AsyncClient object at 0x00005651a530cc28>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1748, in get
timeout=timeout,
<httpx._client.UseClientDefault object at 0x00007f0103d6ba28>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1495, in request
request, auth=auth, allow_redirects=allow_redirects, timeout=timeout
│ │ │ └ <httpx._client.UseClientDefault object at 0x00007f0103d6ba28>
│ │ └ <httpx._client.UseClientDefault object at 0x00007f0103d6ba28>
│ └ <httpx._client.UseClientDefault object at 0x00007f0103d6ba28>
<Request('GET', 'https://hyper.dev')>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1591, in send
history=[],
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1620, in _send_handling_auth
history=history,
└ []
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1655, in _send_handling_redirects
response = await self._send_single_request(request, timeout)
│ │ │ └ Timeout(timeout=5.0)
│ │ └ <Request('GET', 'https://hyper.dev')>
│ └ <function AsyncClient._send_single_request at 0x00007f0103c95d80>
<httpx.AsyncClient object at 0x00005651a530cc28>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_client.py", line 1704, in _send_single_request
extensions={"timeout": timeout.as_dict()},
│ └ <function Timeout.as_dict at 0x00007f0103dc67a0>
└ Timeout(timeout=5.0)
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpx/_transports/default.py", line 286, in handle_async_request
extensions=extensions,
└ {'timeout': {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}}
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_async/connection_pool.py", line 238, in handle_async_request
method, url, headers=headers, stream=stream, extensions=extensions
│ │ │ │ └ {'timeout': {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}}
│ │ │ └ <httpcore.AsyncIteratorByteStream object at 0x00005651a52e0138>
│ │ └ [(b'Host', b'hyper.dev'), (b'Accept', b'*/*'), (b'Accept-Encoding', b'gzip, deflate'), (b'Connection', b'keep-alive'), (b'Use...
│ └ (b'https', b'hyper.dev', None, b'/')
b'GET'
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_async/connection.py", line 149, in handle_async_request
method, url, headers, stream, extensions
│ │ │ │ └ {'timeout': {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}}
│ │ │ └ <httpcore.AsyncIteratorByteStream object at 0x00005651a52e0138>
│ │ └ [(b'Host', b'hyper.dev'), (b'Accept', b'*/*'), (b'Accept-Encoding', b'gzip, deflate'), (b'Connection', b'keep-alive'), (b'Use...
│ └ (b'https', b'hyper.dev', None, b'/')
b'GET'
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_async/http11.py", line 128, in handle_async_request
) = await self._receive_response(timeout)
│ │ └ {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}
│ └ <function AsyncHTTP11Connection._receive_response at 0x00007f0103d64480>
<AsyncHTTP11Connection [ACTIVE]>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_async/http11.py", line 189, in _receive_response
event = await self._receive_event(timeout)
│ │ └ {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}
│ └ <function AsyncHTTP11Connection._receive_event at 0x00007f0103d645c0>
<AsyncHTTP11Connection [ACTIVE]>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_async/http11.py", line 225, in _receive_event
data = await self.socket.read(self.READ_NUM_BYTES, timeout)
│ │ │ │ │ └ {'connect': 5.0, 'read': 5.0, 'write': 5.0, 'pool': 5.0}
│ │ │ │ └ 65536
│ │ │ └ <AsyncHTTP11Connection [ACTIVE]>
│ │ └ <function SocketStream.read at 0x00007f0102daed40>
│ └ <httpcore._backends.anyio.SocketStream object at 0x00005651a1184608>
<AsyncHTTP11Connection [ACTIVE]>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_backends/anyio.py", line 67, in read
return b""
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/anyio/_core/_synchronization.py", line 113, in __aexit__
self.release()
│ └ <function Lock.release at 0x00007f0102d76a20>
<anyio.Lock object at 0x00005651a1184758>
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/anyio/_core/_synchronization.py", line 156, in release
raise RuntimeError('The current task is not holding this lock')
RuntimeError: The current task is not holding this lock
@graingert
Copy link
Author

graingert commented Aug 24, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment