ktaborski commented on issue #57470:
URL: https://github.com/apache/airflow/issues/57470#issuecomment-3472866133

   same here:
   ```2025-10-30T15:22:08.681148Z [error    ] Exception on 
/oauth-authorized/okta [GET] [airflow.providers.fab.www.app] loc=app.py:1744
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
       self.dialect.do_execute(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py",
 line 736, in do_execute
       cursor.execute(statement, parameters)
   psycopg2.OperationalError: SSL connection has been closed unexpectedly
   
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 2529, in wsgi_app
       response = self.full_dispatch_request()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1825, in full_dispatch_request
       rv = self.handle_user_exception(e)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1823, in full_dispatch_request
       rv = self.dispatch_request()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1799, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/security/views.py",
 line 713, in oauth_authorized
       user = self.appbuilder.sm.auth_user_oauth(userinfo)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 2031, in auth_user_oauth
       user = self.find_user(username=username)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 1426, in find_user
       return self.session.scalars(
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", 
line 1778, in scalars
       return self.execute(
              ^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", 
line 1717, in execute
       result = conn._execute_20(statement, params or {}, execution_options)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1710, in _execute_20
       return meth(self, args_10style, kwargs_10style, execution_options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", 
line 334, in _execute_on_connection
       return connection._execute_clauseelement(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1577, in _execute_clauseelement
       ret = self._execute_context(
             ^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1953, in _execute_context
       self._handle_dbapi_exception(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 2134, in _handle_dbapi_exception
       util.raise_(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/compat.py", 
line 211, in raise_
       raise exception
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
       self.dialect.do_execute(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py",
 line 736, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) SSL connection 
has been closed unexpectedly
   
   [SQL: SELECT ab_user.id, ab_user.first_name, ab_user.last_name, 
ab_user.username, ab_user.password, ab_user.active, ab_user.email, 
ab_user.last_login, ab_user.login_count, ab_user.fail_login_count, 
ab_user.created_on, ab_user.changed_on, ab_user.created_by_fk, 
ab_user.changed_by_fk 
   FROM ab_user 
   WHERE lower(ab_user.username) = lower(%(lower_1)s)]
   [parameters: {'lower_1': '[email protected]'}]
   (Background on this error at: https://sqlalche.me/e/14/e3q8)
   INFO:     172.16.109.9:0 - "GET 
/auth/oauth-authorized/okta?code=XXX&state=XXX HTTP/1.1" 500 Internal Server 
Error
   Error authorizing OAuth access token: mismatching_state: CSRF Warning! State 
not equal in request and response.
   2025-10-30T15:25:35.100979Z [error    ] Error authorizing OAuth access 
token: mismatching_state: CSRF Warning! State not equal in request and 
response. [flask_appbuilder.security.views] loc=views.py:684
   INFO:     172.16.109.9:0 - "GET 
/auth/oauth-authorized/okta?code=XXX&state=XXX HTTP/1.1" 302 Found
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/bootstrap.min.css HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/fontawesome/brands.min.css HTTP/1.1" 304 Not 
Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/fontawesome/solid.min.css HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/flags/flags16.css HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/fontawesome/v4-shims.min.css HTTP/1.1" 304 Not 
Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/materialIcons.3e67dd6fbfcc4f3b5105.css HTTP/1.1" 304 Not 
Modified
   INFO:     172.16.109.9:0 - "GET /auth/static/appbuilder/js/bootstrap.min.js 
HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/flash.5583a9e0cf11f2be93da.css HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET /auth/static/appbuilder/js/ab_actions.js 
HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/airflowDefaultTheme.ff5a35f322070b094aa2.css HTTP/1.1" 304 
Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/main.3cf3be1a0c5439bb640d.js HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/main.3cf3be1a0c5439bb640d.css HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/dist/moment.9baee5ec3d7639a10897.js HTTP/1.1" 304 Not Modified
   INFO:     172.16.109.9:0 - "GET 
/auth/static/appbuilder/css/webfonts/fa-solid-900.woff2 HTTP/1.1" 304 Not 
Modified
   2025-10-30T15:25:38.884531Z [error    ] Exception on /oauth-authorized/okta 
[GET] [airflow.providers.fab.www.app] loc=app.py:1744
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 2529, in wsgi_app
       response = self.full_dispatch_request()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1825, in full_dispatch_request
       rv = self.handle_user_exception(e)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1823, in full_dispatch_request
       rv = self.dispatch_request()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", 
line 1799, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/security/views.py",
 line 713, in oauth_authorized
       user = self.appbuilder.sm.auth_user_oauth(userinfo)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 2031, in auth_user_oauth
       user = self.find_user(username=username)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/security_manager/override.py",
 line 1426, in find_user
       return self.session.scalars(
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", 
line 1778, in scalars
       return self.execute(
              ^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", 
line 1717, in execute
       result = conn._execute_20(statement, params or {}, execution_options)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1710, in _execute_20
       return meth(self, args_10style, kwargs_10style, execution_options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", 
line 334, in _execute_on_connection
       return connection._execute_clauseelement(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1577, in _execute_clauseelement
       ret = self._execute_context(
             ^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 1808, in _execute_context
       conn = self._revalidate_connection()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 650, in _revalidate_connection
       self._invalid_transaction()
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", 
line 622, in _invalid_transaction
       raise exc.PendingRollbackError(
   sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid 
transaction is rolled back. (Background on this error at: 
https://sqlalche.me/e/14/8s2b)
   ```
   The only solution for now is to restart api-server


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