<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">Other Airflow 2 version (please specify below)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto"><strong>Airflow version: 2.4.3</strong></p>
<p dir="auto">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.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="File &quot;/a/lib/python3.7/site-packages/flask_session/sessions.py&quot;, line 578, in save_session
    self.db.session.commit()
  File &quot;&lt;string&gt;&quot;, line 2, in commit
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 1428, in commit
    self._transaction.commit(_to_root=self.future)
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 829, in commit
    self._prepare_impl()
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 808, in _prepare_impl
    self.session.flush()
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 3339, in flush
    self._flush(objects)
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 3479, in _flush
    transaction.rollback(_capture_exception=True)
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py&quot;, line 72, in __exit__
    with_traceback=exc_tb,
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/util/compat.py&quot;, line 207, in raise_
    raise exception
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/session.py&quot;, line 3439, in _flush
    flush_context.execute()
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py&quot;, line 456, in execute
    rec.execute(self)
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py&quot;, line 633, in execute
    uow,
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py&quot;, line 247, in save_obj
    insert,
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py&quot;, line 1222, in _emit_insert_statements
    execution_options=execution_options,
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 1611, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/sql/elements.py&quot;, line 324, in _execute_on_connection
    self, multiparams, params, execution_options
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 1488, in _execute_clauseelement
    cache_hit=cache_hit,
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 1843, in _execute_context
    e, statement, parameters, cursor, context
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 2024, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/util/compat.py&quot;, line 207, in raise_
    raise exception
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/base.py&quot;, line 1800, in _execute_context
    cursor, statement, parameters, context
  File &quot;/a/lib/python3.7/site-packages/sqlalchemy/engine/default.py&quot;, line 717, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint &quot;session_session_id_key&quot;
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': &lt;psycopg2.extensions.Binary object at 0x7f773a397420&gt;, 'expiry': datetime.datetime(2022, 12, 15, 4, 29, 42, 513681, tzinfo=datetime.timezone.utc)}]
"><pre class="notranslate"><code class="notranslate">File "/a/lib/python3.7/site-packages/flask_session/sessions.py", line 578, in save_session
    self.db.session.commit()
  File "&lt;string&gt;", 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': &lt;psycopg2.extensions.Binary object at 0x7f773a397420&gt;, 'expiry': datetime.datetime(2022, 12, 15, 4, 29, 42, 513681, tzinfo=datetime.timezone.utc)}]

</code></pre></div>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">The webserver should display the normal login page without any errors.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">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.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Mac OS Monterey</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto">apache-airflow-providers-amazon==6.0.0<br>
apache-airflow-providers-apache-hive==4.0.1<br>
apache-airflow-providers-apache-spark==3.0.0<br>
apache-airflow-providers-celery==3.1.0<br>
apache-airflow-providers-common-sql==1.3.1<br>
apache-airflow-providers-ftp==3.2.0<br>
apache-airflow-providers-http==4.0.0<br>
apache-airflow-providers-imap==3.1.0<br>
apache-airflow-providers-papermill==3.1.0<br>
apache-airflow-providers-postgres==5.2.0<br>
apache-airflow-providers-redis==3.1.0<br>
apache-airflow-providers-sqlite==3.3.1<br>
apache-airflow-providers-ssh==3.3.0</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Virtualenv installation</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<h3 dir="auto">Description</h3>
<p dir="auto">Currently, <code class="notranslate">DAG Runs</code> have two "done" states: "succeeded" or "failed". I propose a third, <strong>"aborted"</strong>.</p>
<h3 dir="auto">Use case/motivation</h3>
<p dir="auto">Currently if I wish to stop a <code class="notranslate">DAG Run</code>, I must mark it one of the states listed above, and usually choose "failed" for lack of a better option. This means that later I have no easy way to differentiate between runs that actually failed, due to some exception, and runs that I manually stopped. Adding an <strong>"aborted"</strong> state will solve that.</p>
<h3 dir="auto">Related issues</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit a PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>