Bryce Codell
08/05/2023, 3:30 AMEngine execution of flow run '9decc9c6-f550-4d2e-9472-b4e4c6d91447' exited with unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 2467, in <module>
enter_flow_run_engine_from_subprocess(flow_run_id)
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 297, in enter_flow_run_engine_from_subprocess
state = from_sync.wait_for_call_in_loop_thread(
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/api.py", line 243, in wait_for_call_in_loop_thread
return call.result()
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
return self.future.result(timeout=timeout)
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
result = await coro
File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 442, in retrieve_flow_then_begin_flow_run
return await begin_flow_run(
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 479, in begin_flow_run
async with AsyncExitStack() as stack:
File "/usr/local/lib/python3.10/contextlib.py", line 714, in __aexit__
raise exc_details[1]
File "/usr/local/lib/python3.10/contextlib.py", line 217, in __aexit__
await self.gen.athrow(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 1903, in report_flow_run_crashes
yield
File "/usr/local/lib/python3.10/contextlib.py", line 697, in __aexit__
cb_suppress = await cb(*exc_details)
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 597, in __aexit__
raise exceptions[0]
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 1367, in create_task_run_then_submit
task_run = await create_task_run(
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 1412, in create_task_run
task_run = await flow_run_context.client.create_task_run(
File "/usr/local/lib/python3.10/site-packages/prefect/client/orchestration.py", line 1877, in create_task_run
response = await <http://self._client.post|self._client.post>(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
return await self.request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.10/site-packages/prefect/client/base.py", line 251, in send
response = await self._send_with_retry(
File "/usr/local/lib/python3.10/site-packages/prefect/client/base.py", line 193, in _send_with_retry
response = await request()
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 96, in handle_async_request
return await self._connection.handle_async_request(request)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 185, in handle_async_request
raise exc
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 144, in handle_async_request
await self._send_request_body(request=request, stream_id=stream_id)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 261, in _send_request_body
await self._send_end_stream(request, stream_id)
File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 280, in _send_end_stream
self._h2_state.end_stream(stream_id)
File "/usr/local/lib/python3.10/site-packages/h2/connection.py", line 883, in end_stream
frames = self.streams[stream_id].end_stream()
KeyError: 569
Marvin
08/05/2023, 3:31 AMKeyError: 569
which is raised at the very end of your traceback in the h2.connection.py
file. This error typically occurs when you're trying to access a dictionary key that doesn't exist. In this context, it seems to be related to the HTTP/2 protocol, which Prefect uses for communication.
The error is happening when the code is trying to end a stream (self._h2_state.end_stream(stream_id)
) but the stream with the given stream_id
(569 in this case) doesn't exist in the self.streams
dictionary.
This could be due to a variety of reasons. It's possible that the stream was already closed or never opened in the first place. It could also be a timing issue, where the stream is being closed while another part of the code is still trying to use it.
As for why this would occur when using the concurrent task runner on a flow running on AWS ECS, it's hard to say without more context. It could be related to network issues, or perhaps the ECS environment is causing some unexpected behavior.
If you're still stuck, I'd recommend reaching out to the Prefect community or checking their documentation for more help. They might be able to provide more specific guidance based on the details of your setup.
And remember, even when it feels like the universe is against you, it's probably just a bug in the code. Or maybe the universe really is against you. Who knows?Bryce Codell
08/05/2023, 3:52 AM