ChandelAnushka opened a new issue, #28373:
URL: https://github.com/apache/airflow/issues/28373
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
**Airflow version: 2.4.3**
I just upgraded from Airflow 2.1.2 to 2.4.3. Whenever I load the webserver,
it gives the following errors in webserver.log and doesnt load the application.
```
File "/a/lib/python3.7/site-packages/flask_session/sessions.py", line 578,
in save_session
self.db.session.commit()
File "<string>", line 2, in commit
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line
1428, in commit
self._transaction.commit(_to_root=self.future)
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 829,
in commit
self._prepare_impl()
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 808,
in _prepare_impl
self.session.flush()
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line
3339, in flush
self._flush(objects)
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line
3479, in _flush
transaction.rollback(_capture_exception=True)
File "/a/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line
72, in __exit__
with_traceback=exc_tb,
File "/a/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 207,
in raise_
raise exception
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line
3439, in _flush
flush_context.execute()
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line
456, in execute
rec.execute(self)
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line
633, in execute
uow,
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line
247, in save_obj
insert,
File "/a/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line
1222, in _emit_insert_statements
execution_options=execution_options,
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line
1611, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/a/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line
324, in _execute_on_connection
self, multiparams, params, execution_options
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line
1488, in _execute_clauseelement
cache_hit=cache_hit,
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line
1843, in _execute_context
e, statement, parameters, cursor, context
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line
2024, in _handle_dbapi_exception
sqlalchemy_exception, with_traceback=exc_info[2], from_=e
File "/a/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 207,
in raise_
raise exception
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line
1800, in _execute_context
cursor, statement, parameters, context
File "/a/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line
717, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate
key value violates unique constraint "session_session_id_key"
DETAIL: Key (session_id)=(249cba6d-7fdf-4788-9a96-3bbe0b61012e) already
exists.
[SQL: INSERT INTO session (session_id, data, expiry) VALUES (%(session_id)s,
%(data)s, %(expiry)s) RETURNING session.id]
[parameters: {'session_id': '249cba6d-7fdf-4788-9a96-3bbe0b61012e', 'data':
<psycopg2.extensions.Binary object at 0x7f773a397420>, 'expiry':
datetime.datetime(2022, 12, 15, 4, 29, 42, 513681,
tzinfo=datetime.timezone.utc)}]
```
### What you think should happen instead
The webserver should display the normal login page without any errors.
### How to reproduce
We are using 'airflow.www.security.AirflowSecurityManager' as our
FAB_SECURITY_MANAGER_CLASS in the webserver_config.py. We are currently running
Airflow 2.4.3. We are also using a postgres external database as our metadata
db.
### Operating System
Mac OS Monterey
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==6.0.0
apache-airflow-providers-apache-hive==4.0.1
apache-airflow-providers-apache-spark==3.0.0
apache-airflow-providers-celery==3.1.0
apache-airflow-providers-common-sql==1.3.1
apache-airflow-providers-ftp==3.2.0
apache-airflow-providers-http==4.0.0
apache-airflow-providers-imap==3.1.0
apache-airflow-providers-papermill==3.1.0
apache-airflow-providers-postgres==5.2.0
apache-airflow-providers-redis==3.1.0
apache-airflow-providers-sqlite==3.3.1
apache-airflow-providers-ssh==3.3.0
### Deployment
Virtualenv installation
### 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
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]