zhengxiang378928908-code commented on issue #59166: URL: https://github.com/apache/airflow/issues/59166#issuecomment-6148186922
I'd like to pick this up, since #59167 went stale. I reproduced it on current `main` (43129ecb) against MySQL 8.0 by killing the session's connection (`KILL CONNECTION_ID()` from a second connection) while import errors were being recorded. The processor still exits, with the same `PendingRollbackError: Can't reconnect until invalid transaction is rolled back`. The try/except added around `persist_parsing_result` in #65313 doesn't catch it, because the error is raised later, by the `commit()` that `@provide_session` runs on exit, outside that block. One note on the proposed fix: calling `session.rollback()` in the `except` blocks of `update_dag_parsing_results_in_db` would also roll back the Dags written earlier in the same transaction, so an error while recording import errors would silently drop the Dag updates instead. I plan to wrap each best-effort write in a savepoint instead, re-raise only when the session can no longer be used, and roll back in `handle_parsing_result` when persisting fails. PR coming shortly. -- 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]
