Petko
02/01/2024, 9:18 AMMarvin
02/01/2024, 9:18 AMAsync context manager in flow causes RuntimeError: Event loop is closed
error (#9412). This error occurred in flows that utilized external libraries (httpx in the reported case) with async context managers. The reported bug was tied to Prefect versions higher than v2.8.4, and the flow behaved as expected when not utilizing tasks (thus not invoking Prefect's concurrency management).
Here's a general troubleshooting suggestion for the non-zero status code -7 you're encountering:
1. Inspect Logs: Check Prefect's logs for more detailed error messages surrounding the status code -7 exit.
2. Review Code: Look for async context managers and ensure they are properly managed within tasks and subflows.
3. Test Version Downgrade: Consider downgrading Prefect to a version before the reported issues appeared (below v2.8.7) and see if the error persists.
4. Flow Control: If you're running parallel subflows, like in issue #10991, monitor the parent flow's status throughout the run.
5. Seek Help on GitHub: If you suspect this to be a new or related issue, open a GitHub issue with details including the output, logs, and flow setup.
Remember to follow this up with the Prefect community or support if you find this issue to be persistent or indicative of a broader problem with Prefect's internal handling of async operations.