Fix OpenLineage DeprecationWarning about fork() on Python 3.12+#70161
Closed
br413 wants to merge 2 commits into
Closed
Fix OpenLineage DeprecationWarning about fork() on Python 3.12+#70161br413 wants to merge 2 commits into
br413 wants to merge 2 commits into
Conversation
Contributor
|
This change looks odd to me. |
Remove os.fork-based task event emission and use forkserver for ProcessPoolExecutor to avoid DeprecationWarning in multi-threaded processes. Closes apache#47160
Extract metadata in the parent listener process and emit events via picklable _emit_task_instance_event() with forkserver-backed pool workers, preserving process isolation without os.fork() in multi-threaded processes.
br413
force-pushed
the
fix/openlineage-fork-py312
branch
from
July 22, 2026 07:33
5f79428 to
978ed8b
Compare
Author
|
Thanks for the review, @eladkal — fair question. The first version removed \os.fork()\ by calling lifecycle handlers inline, which dropped the process isolation the fork path provided. I've updated the approach to match what we already do for DAG-run listeners and manual state-change emissions:
This removes the Python 3.12 \DeprecationWarning\ without running OL transport code synchronously in the multi-threaded worker/scheduler process. Rebased onto latest \main\ and pushed. Happy to address any further feedback. |
Contributor
|
#68708 - should fix this issue rather than using forkserver |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
On Python 3.12+, the OpenLineage listener emits:
\
DeprecationWarning: This process is multi-threaded, use of fork() may lead to deadlocks in the child.
\\
This came from _fork_execute()\ calling \os.fork()\ during task lifecycle events, and from \ProcessPoolExecutor\ defaulting to the \ork\ start method on Linux.
Approach
Task lifecycle handlers (\on_running, \on_success, \on_failure, \on_skipped) follow the same two-phase pattern as DAG-run listeners:
This preserves process isolation for OL transport code without \os.fork()\ in multi-threaded worker/scheduler processes.
Test plan
Closes #47160