lohitkolluri opened a new pull request, #67900: URL: https://github.com/apache/airflow/pull/67900
When creating a backfill via the API on SQLite under concurrent access, a `sqlite3.OperationalError: database is locked` would propagate as a 500 Internal Server Error with an unhelpful SQLAlchemy traceback. Catch the `OperationalError` and check if it is a SQLite locking issue. Return HTTP 503 Service Unavailable with a clear message suggesting the user switch to PostgreSQL or MySQL for backfill operations. ## Root Cause The `_create_backfill` function uses `create_session()` internally, creating multiple DB connections. SQLite cannot handle concurrent writes, and the error propagates uncaught through the FastAPI route. ## Fix - Added `OperationalError` handling to the `create_backfill` route - When the error is SQLite "database is locked", returns HTTP 503 with a user-friendly message - All other `OperationalError` instances are re-raised as before ## Testing - All 40 existing backfill API tests pass closes: #66726 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (DeepSeek V4 Flash) Generated-by: Claude Code (DeepSeek V4 Flash) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
