Sanjays2402 opened a new issue, #73715:
URL: https://github.com/apache/airflow/issues/73715
`config_templates/config.yml` documents `max_db_retries` as "Number of times
the code should be retried in case of DB Operational Errors." But
`run_with_db_retries` in `airflow/utils/retries.py` passes it straight into
`tenacity.stop_after_attempt(max_retries)`, and tenacity counts the initial
attempt too. So the default `max_db_retries=3` gives 3 total attempts, i.e.
only 2 retries.
```python
from unittest import mock
from sqlalchemy.exc import DBAPIError
from airflow.utils.retries import retry_db_transaction
attempts = []
@retry_db_transaction(retries=3)
def flaky(session=None):
attempts.append(1)
raise DBAPIError('stmt', {}, Exception('boom'))
try:
flaky(session=mock.Mock())
except DBAPIError:
pass
print(len(attempts)) # 3; expected 4 if "3 retries" is taken literally
```
Either the doc wording or the `stop_after_attempt(max_retries)` wiring is
off by one. This affects the scheduler, dag processor, and task-instance paths
that all go through these helpers.
Seen on main at `8dff0303` (2026-09-25).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]