[Critical Issue] Session Table Auto-Increment Mechanism Leads to ID Exhaustion in Airflow Database #45794
-
Apache Airflow version2.10.4 If "Other Airflow 2 version" selected, which one?No response What happened?airflow-web failed with error logs as follow: [SQL: INSERT INTO session (session_id, data, expiry) VALUES (%(session_id)s, %(data)s, %(expiry)s) RETURNING session.id] airflow_2=> SELECT MAX(id) FROM session;
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 10 replies
-
Through this issue, I believe there is a problem with the use of the auto-increment mechanism for the session table in Airflow's database. The specific reasons are as follows: I already have a scheduled task to execute from airflow.utils.db_cleanup import run_cleanup to clean up the database cache. |
Beta Was this translation helpful? Give feedback.
-
As already discussed in #45782 (comment) -> you are doing something terribly wrong to exceed 2 B sessions. This is impractical to achieve in reality As workaround - you should delete all entries from session database. |
Beta Was this translation helpful? Give feedback.
-
But you should also find out how it happened that your number of sessions is such huge (impractical to achieve in normal circumstances). |
Beta Was this translation helpful? Give feedback.
-
Also - since you are already in the situation that your sequence like has such high value you might need to look at which sequence is used in session db and reset it |
Beta Was this translation helpful? Give feedback.
-
But really - my sincere advice is to look at what you are doing to create 2B sessions, there is something really terribly wrong in your situation to reach such high sequence value. This mechanims (via |
Beta Was this translation helpful? Give feedback.
-
@claude - I don't believe this is practical - you are the first of many thousands of people who ever hit that limit . But if you feel like it - this is something you might suggest to Here where it is defined: Feel free to open issue in flask-session and describe your case. |
Beta Was this translation helpful? Give feedback.
@claude - I don't believe this is practical - you are the first of many thousands of people who ever hit that limit . But if you feel like it - this is something you might suggest to
flask-session
project. This is where both session table and size of the fleld is Integer (which in Postgres is up to 2B: https://www.postgresql.org/docs/current/datatype-numeric.htmlHere where it is defined:
https://github.com/pallets-eco/flask-session/blob/development/src/flask_session/sqlalchemy/sqlalchemy.py#L27
Feel free to open issue in flask-session and describe your case.