pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.51k stars 653 forks source link

pgadmin login sessions unexpectedly expired every time apache receives reload signal (RM #6982) #4746

Open dpage opened 2 years ago

dpage commented 2 years ago

Issue migrated from Redmine: https://redmine.postgresql.org/issues/6982 Originally created by Robin Griffin at 2021-11-09 12:45:36 UTC.

We see pgadmin login sessions unexpectedly expired every time apache is reloaded. This happens daily due to logrotation, but can be re-created on demand by triggering a apachectl graceful reload.

Looking around, we see that pgadmin uses flask and flask-login internally. Other flask users have reported similar issues [0], and the suggestion is that the user_loader method must be defined by the application to load the user object into a session after reload. This is referenced in the flask-login documentation [1], but a quick search across the pgadmin github repo suggests this function may not be implemented.

Is it possible that pgadmin4 is not handling the apache restart well, and that a user_loader method may help here?

Environment:

CentOS 8.3 Apache httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 python3-mod_wsgi-4.6.4-4.el8.x86_64 pgadmin 4 v6.0

LoadModule wsgi_module modules/mod_wsgi.so WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/usr/pgadmin4/venv WSGIScriptAlias /pgadmin4 /usr/pgadmin4/web/pgAdmin4.wsgi

<Directory /usr/pgadmin4/web/> WSGIProcessGroup pgadmin WSGIApplicationGroup %{GLOBAL} Require all granted

References:

[0] https://stackoverflow.com/questions/13399294/flask-login-session-gets-destroyed-on-every-apache-restart [1] https://flask-login.readthedocs.io/en/latest/#how-it-works

dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-1 Originally created by Aditya Toshniwal at 2021-11-12 11:18:39 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed Ready
Fixed Version changed 6.2
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-2 Originally created by Robin Griffin at 2022-01-12 10:26:36 UTC.

Any update on this one. I'm taking a lot of flack.

dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-3 Originally created by Akshay Joshi at 2022-05-11 09:50:40 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed Ready EDB Sprint 117
Assigned To changed Pradip Parkale
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-4 Originally created by Akshay Joshi at 2022-05-25 10:31:32 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 117 EDB Sprint 118
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-5 Originally created by Robin Griffin at 2022-05-25 10:35:29 UTC.

Boo, I was hoping this would get fixed soon. Robin

dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-6 Originally created by Pradip Parkale at 2022-05-30 08:26:26 UTC.

Redmine ticket header update:

Name Old Value New Value
Status changed New In Progress
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-7 Originally created by Akshay Joshi at 2022-06-08 10:30:54 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 118 EDB Sprint 119
dpage commented 2 years ago

Attachment migrated from Redmine: https://redmine.postgresql.org/attachments/download/6835 Originally created by Pradip Parkale at 2022-06-20 02:57:47 UTC.

https://pgadmin-archive.postgresql.org/redmine/6982/6835-RM6982.patch

dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-9 Originally created by Pradip Parkale at 2022-06-20 02:59:01 UTC.

Redmine ticket header update:

Name Old Value New Value
Assigned To changed Pradip Parkale
Status changed In Progress New
Attachment added RM6982.patch
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/6982#note-10 Originally created by Akshay Joshi at 2022-06-22 06:05:28 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 119 Ready