-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fix connection retrieval in DagProcessorManager for bundle initialization
#57459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kaxil
merged 1 commit into
apache:main
from
dheerajturaga:bugfix/connections-missing-in-dag-processor
Oct 30, 2025
Merged
Fix connection retrieval in DagProcessorManager for bundle initialization
#57459
kaxil
merged 1 commit into
apache:main
from
dheerajturaga:bugfix/connections-missing-in-dag-processor
Oct 30, 2025
Conversation
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
Member
Author
|
cc: @kaxil this is a critical bug and we should aim for 3.1.2 |
kaxil
reviewed
Oct 29, 2025
…ontext
The dag_processor was unable to retrieve connections from the database,
causing GitHook (and other hooks) to fail with:
AirflowNotFoundException: The conn_id `<conn_id>` isn't defined
Root cause: dag_processor was running in FALLBACK context, which only
loads EnvironmentVariablesBackend, not MetastoreBackend. This meant
connections stored in the database were inaccessible.
The dag_processor is a server-side component that needs database access
for connection retrieval, similar to the scheduler and API server.
Fix: Set _AIRFLOW_PROCESS_CONTEXT=server in DagProcessorJobRunner._execute()
to enable MetastoreBackend, matching the pattern already used in:
- SchedulerJobRunner (scheduler_job_runner.py:1064)
- API FastAPI server (api_fastapi/main.py:24)
This ensures the dag_processor uses the correct secrets backend chain:
EnvironmentVariablesBackend → MetastoreBackend (database access)
Affects: DAG bundle processing with GitHook and any other hooks that
rely on database-stored connections during DAG parsing.
Signed-off-by: Kaxil Naik <kaxilnaik@gmail.com>
218f394 to
85dec24
Compare
DagProcessorManager for bundle initialization
kaxil
approved these changes
Oct 30, 2025
kaxil
pushed a commit
that referenced
this pull request
Oct 30, 2025
…zation (#57459) The dag_processor was unable to retrieve connections from the database, causing GitHook (and other hooks) to fail with: AirflowNotFoundException: The conn_id `<conn_id>` isn't defined Root cause: DagProcessorManager was running in FALLBACK context, which only loads EnvironmentVariablesBackend, not MetastoreBackend. This meant connections stored in the database were inaccessible. The `DagProcessorManager` (parent process) needs database access for connection retrieval during bundle initialization (e.g., `GitDagBundle.__init__` → `GitHook` needs git credentials). Child `DagFileProcessorProcess` instances run user code and should remain isolated from direct database access. This ensures correct secrets backend chains (when no external secrets backend is configured): - Manager (parent): `EnvironmentVariablesBackend` → `MetastoreBackend` (database access) - Parser (child): `EnvironmentVariablesBackend` Note: This is temporary until AIP-92 removes direct DB access from DagProcessorManager. Long-term, the manager should use the Execution API instead of direct database access. Affects: DAG bundle processing with GitHook and any other hooks that rely on database-stored connections during bundle initialization in the manager process. (cherry picked from commit ae2a4fd)
Member
Author
|
Thanks @kaxil ! |
Copilot AI
pushed a commit
to jason810496/airflow
that referenced
this pull request
Dec 5, 2025
…zation (apache#57459) The dag_processor was unable to retrieve connections from the database, causing GitHook (and other hooks) to fail with: AirflowNotFoundException: The conn_id `<conn_id>` isn't defined Root cause: DagProcessorManager was running in FALLBACK context, which only loads EnvironmentVariablesBackend, not MetastoreBackend. This meant connections stored in the database were inaccessible. The `DagProcessorManager` (parent process) needs database access for connection retrieval during bundle initialization (e.g., `GitDagBundle.__init__` → `GitHook` needs git credentials). Child `DagFileProcessorProcess` instances run user code and should remain isolated from direct database access. This ensures correct secrets backend chains (when no external secrets backend is configured): - Manager (parent): `EnvironmentVariablesBackend` → `MetastoreBackend` (database access) - Parser (child): `EnvironmentVariablesBackend` Note: This is temporary until AIP-92 removes direct DB access from DagProcessorManager. Long-term, the manager should use the Execution API instead of direct database access. Affects: DAG bundle processing with GitHook and any other hooks that rely on database-stored connections during bundle initialization in the manager process.
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.
The dag_processor was unable to retrieve connections from the database,
causing GitHook (and other hooks) to fail with:
AirflowNotFoundException: The conn_id
<conn_id>isn't definedRoot cause: DagProcessorManager was running in FALLBACK context, which only
loads EnvironmentVariablesBackend, not MetastoreBackend. This meant
connections stored in the database were inaccessible.
The
DagProcessorManager(parent process) needs database access for connectionretrieval during bundle initialization (e.g.,
GitDagBundle.__init__→GitHookneeds git credentials). Child
DagFileProcessorProcessinstances run user codeand should remain isolated from direct database access.
This ensures correct secrets backend chains (when no external secrets backend is configured):
EnvironmentVariablesBackend→MetastoreBackend(database access)EnvironmentVariablesBackendNote: This is temporary until AIP-92 removes direct DB access from DagProcessorManager.
Long-term, the manager should use the Execution API instead of direct database access.
Affects: DAG bundle processing with GitHook and any other hooks that rely on
database-stored connections during bundle initialization in the manager process.