You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "wangxiaojun1990 (via GitHub)" <gi...@apache.org> on 2026/03/13 17:39:21 UTC
[I] [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state [airflow]
wangxiaojun1990 opened a new issue, #63551:
URL: https://github.com/apache/airflow/issues/63551
### Apache Airflow version
3.1.8
### What happened
When deploying Airflow 3.1.8 with a fresh database (no existing `default_pool` in the `pool` table), tasks are stuck in `scheduled` state and never transition to `queued` or `running`. The scheduler logs show "All pools are full!" even though no pools exist in the database.
### Root Cause Analysis
The scheduler's `slots_stats()` method queries the `pool` table and returns an empty dictionary when no pools exist:
```python
# airflow/jobs/scheduler_job_runner.py:363-371
pools = Pool.slots_stats(lock_rows=True, session=session)
pool_slots_free = sum(max(0, pool["open"]) for pool in pools.values())
if pool_slots_free == 0:
self.log.debug("All pools are full!")
return [] # No tasks are scheduled
```
The configuration `default_pool_task_slot_count = 128` exists, but the `default_pool` record is not automatically created in the database during `airflow db migrate`.
### How to reproduce
1. Deploy Airflow 3.1.8 with a fresh database
2. 2. Create a simple DAG with a PythonOperator task
3. 3. Trigger the DAG from UI or CLI
4. 4. Task stays in `scheduled` state indefinitely
### Environment
- **Airflow version**: 3.1.8
- - **Helm chart version**: 1.19.0
- - - **Executor**: CeleryExecutor
- - - - **Database**: MySQL 8.0
### Verification commands
```bash
# Check pools - returns empty
airflow pools list
# Output: No data found
# Check default_pool_task_slot_count - returns 128
airflow config get-value core default_pool_task_slot_count
# Output: 128
# Check get_default_pool() - returns None
python -c "from airflow.models.pool import Pool; print(Pool.get_default_pool())"
# Output: None
```
### Expected behavior
Either:
1. `default_pool` should be automatically created during `airflow db migrate`, OR
2. 2. Scheduler should handle missing `default_pool` gracefully by using the configured `default_pool_task_slot_count`
### Workaround
Manually create the default pool after database migration:
```bash
airflow pools set default_pool 128 "Default pool"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state [airflow]
Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 commented on issue #63551:
URL: https://github.com/apache/airflow/issues/63551#issuecomment-4062790207
Closing issue not able to replicate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #63551:
URL: https://github.com/apache/airflow/issues/63551#issuecomment-4056837286
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state [airflow]
Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 closed issue #63551: [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state
URL: https://github.com/apache/airflow/issues/63551
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] default_pool not automatically created in Airflow 3.1.8, causing tasks to stuck in "scheduled" state [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on issue #63551:
URL: https://github.com/apache/airflow/issues/63551#issuecomment-4058452684
This doesn't appear to be a valid bug. The `default_pool` is created in all standard code paths — both on 3.1.8 and main.
**On 3.1.8 specifically**, `upgradedb()` has an unconditional fresh-DB check with no `to_revision` guard — every fresh database hits `initdb()` and returns:
https://github.com/apache/airflow/blob/3.1.8/airflow-core/src/airflow/utils/db.py#L1122-L1126
`initdb()` then calls `add_default_pool_if_not_exists()`:
https://github.com/apache/airflow/blob/3.1.8/airflow-core/src/airflow/utils/db.py#L753-L755
For existing databases, `add_default_pool_if_not_exists()` is also called after the Alembic migration completes:
https://github.com/apache/airflow/blob/3.1.8/airflow-core/src/airflow/utils/db.py#L1153-L1154
**On main**, the same coverage exists. Fresh DB without `--to-revision` goes through `initdb()`:
https://github.com/apache/airflow/blob/a9a9c5a57fbaaa11499967b39bac11adedea857e/airflow-core/src/airflow/utils/db.py#L1243-L1246
All other paths go through `_run_upgradedb()` which calls `add_default_pool_if_not_exists()` unconditionally:
https://github.com/apache/airflow/blob/a9a9c5a57fbaaa11499967b39bac11adedea857e/airflow-core/src/airflow/utils/db.py#L1181-L1182
**Additional safety nets:**
- The squashed migration inserts `default_pool` via `bulk_insert`:
https://github.com/apache/airflow/blob/3.1.8/airflow-core/src/airflow/migrations/versions/0000_2_6_2_squashed_migrations.py#L756-L772
- `Pool.delete_pool()` prevents deletion of `default_pool`:
https://github.com/apache/airflow/blob/3.1.8/airflow-core/src/airflow/models/pool.py#L151-L154
Every standard deployment path — including the Helm chart (`values.yaml` runs `airflow db migrate`) — creates the `default_pool`. The only way it could be missing is direct SQL manipulation of the database.
Could you share the exact commands you ran and the full logs from `airflow db migrate`? That would help confirm whether something unusual happened in your environment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org