jason810496 opened a new issue, #62768:
URL: https://github.com/apache/airflow/issues/62768

   ### Body
   
   ## What
   
   The test sometimes fails due to `sqlalchemy.exc.OperationalError: 
(MySQLdb.OperationalError) (2013, 'Lost connection to server during query')`
   For example: 
https://github.com/apache/airflow/actions/runs/22609497337/job/65509753041?pr=62758
   
   
   ## Traceback Logs
   
   Summary:
   
   ```python
   ERROR 
airflow-core/tests/unit/jobs/test_triggerer_job.py::test_trigger_can_call_variables_connections_and_xcoms_methods
 - sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (2013, 'Lost 
connection to server during query')
   [SQL: SELECT 1 
   FROM connection 
   WHERE connection.conn_id = %s]
   [parameters: ('presto_default',)]
   (Background on this error at: https://sqlalche.me/e/20/e3q8)
   ```
   
   <details>
     <summary>full traceback:</summary>
   
   ```python
   
=================================================================================================
 ERRORS 
=================================================================================================
   ____________________________________________________________ ERROR at setup 
of test_trigger_can_call_variables_connections_and_xcoms_methods 
_____________________________________________________________
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1967: in 
_exec_single_context
       self.dialect.do_execute(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/default.py:952: 
in do_execute
       cursor.execute(statement, parameters)
   /usr/python/lib/python3.10/site-packages/MySQLdb/cursors.py:179: in execute
       res = self._query(mogrified_query)
   /usr/python/lib/python3.10/site-packages/MySQLdb/cursors.py:330: in _query
       db.query(q)
   /usr/python/lib/python3.10/site-packages/MySQLdb/connections.py:286: in query
       _mysql.connection.query(self, query)
   E   MySQLdb.OperationalError: (2013, 'Lost connection to server during 
query')
   
   The above exception was the direct cause of the following exception:
   airflow-core/tests/unit/jobs/test_triggerer_job.py:87: in clean_database
       clear_db_connections()
   devel-common/src/tests_common/test_utils/db.py:326: in clear_db_connections
       create_default_connections(session)
   airflow-core/src/airflow/utils/session.py:98: in wrapper
       return func(*args, **kwargs)
   airflow-core/src/airflow/utils/db.py:192: in create_default_connections
       merge_conn(c, session)
   airflow-core/src/airflow/utils/session.py:98: in wrapper
       return func(*args, **kwargs)
   airflow-core/src/airflow/utils/db.py:165: in merge_conn
       if not session.scalar(select(1).where(conn.__class__.conn_id == 
conn.conn_id)):
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:2399: in 
scalar
       return self._execute_internal(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:2249: in 
_execute_internal
       result: Result[Any] = compile_state_cls.orm_execute_statement(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/context.py:306: in 
orm_execute_statement
       result = conn.execute(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1419: in 
execute
       return meth(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/sql/elements.py:527: in 
_execute_on_connection
       return connection._execute_clauseelement(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1641: in 
_execute_clauseelement
       ret = self._execute_context(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1846: in 
_execute_context
       return self._exec_single_context(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1986: in 
_exec_single_context
       self._handle_dbapi_exception(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:2363: in 
_handle_dbapi_exception
       raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1967: in 
_exec_single_context
       self.dialect.do_execute(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/default.py:952: 
in do_execute
       cursor.execute(statement, parameters)
   /usr/python/lib/python3.10/site-packages/MySQLdb/cursors.py:179: in execute
       res = self._query(mogrified_query)
   /usr/python/lib/python3.10/site-packages/MySQLdb/cursors.py:330: in _query
       db.query(q)
   /usr/python/lib/python3.10/site-packages/MySQLdb/connections.py:286: in query
       _mysql.connection.query(self, query)
   E   sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (2013, 'Lost 
connection to server during query')
   E   [SQL: SELECT 1 
   E   FROM connection 
   E   WHERE connection.conn_id = %s]
   E   [parameters: ('presto_default',)]
   E   (Background on this error at: https://sqlalche.me/e/20/e3q8)
   ```
   
   </details>
   
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
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]

Reply via email to