Repository navigation
Fixes #33514: serialize the DAG-scan fork so concurrent pipeline deploys don't fail - #33515
Merged
Merged
Conversation
…don't fail Every deploy forks a background DAG scan from the API server's request thread. filelock 3.32 (pinned by the Airflow 3.3.1 constraints) installs an os.fork audit hook that raises RuntimeError while another thread is inside its own fork, so two deploys landing together (bulk Re Deploy) failed one of them with a 500 after its DAG was already synced. Hold a module-level lock around Process.start(). Adds a regression test that forks scans from two threads; it fails without the lock. Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
had a problem deploying
to
test
September 17, 2026 14:23 — with
GitHub Actions
Error
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
ShaileshParmar11
temporarily deployed
to
test
September 17, 2026 14:55 — with
GitHub Actions
Inactive
TeddyCr
approved these changes
Sep 17, 2026
Contributor
✅ Playwright Results — workflow succeededValidated commit ✅ 4510 passed · ❌ 0 failed · 🟡 5 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 1h 0m 34s ⏱️ Max setup 4m 41s · max shard execution 23m 1s · max shard-job elapsed before upload 26m 39s · reporting 17s 🌐 219.31 requests/attempt · 2.23 app boots/UI scenario · 35.63% common-shard skew Optimization targets still in progress:
🟡 5 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
This branch was previously deployed
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.
Describe your changes:
Fixes #33514
Concurrent ingestion pipeline deploys (bulk Re Deploy) intermittently failed one pipeline with
airflow API returned Internal Server Error … "An unexpected problem occurred". This is also whyTestSuitePipelineRedeploy.spec.ts › Re-deploy all test-suite ingestion pipelinesfailed on every attempt in merge-queue runs 35178258079 and 35215269052.Root cause. Every deploy ends with
scan_dags_job_background(), which forks amultiprocessing.Processfrom the Airflow API server's request thread.filelock==3.32.2(pinned byingestion/airflow-constraints-3.3.1.txt) installs anos.forkaudit hook that raisesRuntimeError("os.fork is unsafe while filelock is changing descriptor ownership")while any other thread is inside its own fork. Two deploys arriving together fork at once, one raises, and the exception escapesDagDeployer.deploy()into the route's generic 500 handler, after that DAG was already written and synced.Fix. Hold a module-level
threading.Lockaroundprocess.start()inscan_dags_job_background, the plugin's only fork site. The lock covers the fork only; scans still run in parallel once started.Evidence:
/opt/airflow/logs/openmetadata_airflow_api.log, and CI collectsdocker logs.ingestion/Dockerfile.ci(Airflow 3.3.1, Python 3.12, filelock 3.32.2): 2 of 20 concurrent deploy pairs failed with the identical 400, and the plugin log showed theos.fork is unsafeerror for both.Processconcurrently: 85/200 rounds fail with filelock imported, 0/200 without it, 0/200 with the lock.Type of change:
High-level design:
N/A — small change (2 files).
Tests:
Use cases covered
Unit tests
test_concurrent_dag_scans_can_forkinopenmetadata-airflow-apis/tests/unit/test_helpers.py. It calls the realscan_dags_job_background()from two threads for 50 rounds, with filelock imported and a no-op scan body, and asserts no fork raised.tests/unit/test_helpers.pypassed 3/3 runs (4 tests, ~1s). Run inside the Airflow 3.3.1 ingestion container.scan_dags_job_background, which the new test executes.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
playwright/e2e/Features/TestSuitePipelineRedeploy.spec.tscovers this path end to end; this PR's Ingestion shard exercises it against a rebuilt Airflow image (openmetadata-airflow-apis/is part of the ingestion image fingerprint).Manual testing performed
docker/development/docker-compose.yml(Airflow 3.3.1 ingestion image).POST /api/v1/services/ingestionPipelines/deploy/{id}requests for two TestSuite pipelines: intermittent 400, andopenmetadata_airflow_api.logshowedInternal error deploying [...] due to [os.fork is unsafe while filelock is changing descriptor ownership].UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code
The PR appears safe to merge, with the concurrency fix covered by a platform-appropriate regression test.
Summary
This PR prevents concurrent ingestion-pipeline deployments from racing while starting DAG-scan child processes.
Process.start(), allowing the scans themselves to continue concurrently.fork, resolving the previous cross-platform test concern.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Concurrent deploy request A] --> L[Fork lock] B[Concurrent deploy request B] --> L L --> FA[Start DAG-scan process A] L --> FB[Start DAG-scan process B] FA --> SA[Scan A runs independently] FB --> SB[Scan B runs independently]Reviews (2) · Last reviewed commit: "test(airflow-apis): run the concurrent-f..."