Skip to content

Failure on editing a Variable #39581

Closed

Description

@muhzub

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.8.1

What happened?

I am encountering a problem when sometime on clicking the variable search/edit button it open a critical Error page "Ooops" and the error i can get in webserver logs "sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid transaction is rolled back. (Background on this error at: https://sqlalche.me/e/14/8s2b)" complete logs are mentioned below

I am not able to see any lock transaction in database and unable to find the reason for this behaviour.

[2024-05-13T03:45:48.832+0000] {app.py:1744} ERROR - Exception on /variable/edit/57 [GET] Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1825, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/usr/local/lib/python3.9/site-packages/airflow/www/decorators.py", line 132, in wrapper return f(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/airflow/www/auth.py", line 110, in wraps if permission_str in self.base_permissions and self.appbuilder.sm.has_access( File "/usr/local/lib/python3.9/site-packages/astronomer/flask_appbuilder/security.py", line 301, in has_access return super().has_access(action_name, resource_name, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/airflow/www/security_manager.py", line 140, in has_access return is_authorized_method(action_name, resource_pk, user) File "/usr/local/lib/python3.9/site-packages/airflow/www/security_manager.py", line 316, in <lambda> details=VariableDetails(key=get_variable_key(resource_pk)), File "/usr/local/lib/python3.9/site-packages/airflow/www/security_manager.py", line 225, in get_variable_key variable = session.scalar(select(Variable).where(Variable.id == resource_pk).limit(1)) File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1747, in scalar return self.execute( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1717, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection return connection._execute_clauseelement( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement ret = self._execute_context( File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1808, in _execute_context conn = self._revalidate_connection() File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 650, in _revalidate_connection self._invalid_transaction() File "/usr/local/lib/python3.9/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)

What you think should happen instead?

it should allow to either view and edit the variable

How to reproduce

I am not sure as this happen sometime but not very frequent

Operating System

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian

Versions of Apache Airflow Providers

apache-airflow-providers-apache-hdfs==3.2.1
apache-airflow-providers-apache-hive
apache-airflow-providers-apache-spark
apache-airflow-providers-jdbc
apache-airflow-providers-sftp
apache-airflow-providers-ssh
apache-airflow-providers-hashicorp

Deployment

Docker-Compose

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on May 13, 2024

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. raphaelauv commented on May 13, 2024

    @raphaelauv
    Contributor

    I also seen this bug before 2.9.1 with LDAP

  3. amoghrajesh commented on May 16, 2024

    @amoghrajesh
    Contributor

    I have seen this kind of issue for connection edit once in the past, and then it never happened

  4. alejandro-rivera commented on May 30, 2024

    @alejandro-rivera
    Contributor

    I've been experiencing a problem like the one described here, after upgrading to Airflow 2.9.1.

    I've pushed a PR with a potential fix: #39935.

    Cheers.

  5. UnightSun commented on May 31, 2024

    @UnightSun

    I've been experiencing a problem like the one described here, after upgrading to Airflow 2.9.1.

    I've pushed a PR with a potential fix: #39935.

    Cheers.

    This works for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions