[OSGeo] #3286: gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Keywords:
---------------------------+------------------
We've been having this issue on trac since recent upgrades that gitea
commit hooks to trac are failing with

{{{
Error: Unable to check for upgrade of trac.db.api.DatabaseManager:
TimeoutError: Unable to get database connection within 0 seconds.
}}}

making the calls directly via trac-admin works fine.
--
Ticket URL: <https://trac.osgeo.org/osgeo/ticket/3286&gt;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+-------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Resolution:
Keywords: |
---------------------------+-------------------
Comment (by strk):

For the record it took me 3 reloads to see this ticket, first attempts all
gave me the "cannot get db connection within 0 seconds" error.

I wanted to say that manually running trac-admin usually works for me,
I've continued using this workaround and it seemed to always work, while
the git log seems to always fail. It would probably be wise to file a
ticket upstream to trac itself to see if they have any hint about it.
--
Ticket URL: <#3286 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – OSGeo;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+-------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Resolution:
Keywords: |
---------------------------+-------------------
Comment (by robe):

reported upstream - #13793 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – The Trac Project
--
Ticket URL: <#3286 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – OSGeo;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+-------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Resolution:
Keywords: |
---------------------------+-------------------
Comment (by robe):

Upstream walked me thru adding some logging in the python code around
debugging db and also to turn on db logging.

The logs now show this as the culprit

{{{
psycopg2.OperationalError: connection to server on socket
"/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password
supplied
}}}

Why it doesn't trigger that when tracadmin is called directly using the
same accounts gitea is using is a bit puzzling.
--
Ticket URL: <#3286 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – OSGeo;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+-------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Resolution:
Keywords: |
---------------------------+-------------------
Comment (by robe):

I confirmed that is the issue cause when I set to trust for local
connection in /etc/postgresql/16/main/pg_hba.conf it worked fine.
I checked and the git account does have a .pgpass entry for trac account
for all databases and it can connect to all databases. But I guess for
some reason maybe psyqcopg2 can't access the file or it's running under
another account when it does tracadmin call.
--
Ticket URL: <#3286 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – OSGeo;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.

#3286: gitea git commit hooks failing to trac upgrade of
trac.db.api.DatabaseManager
---------------------------+-------------------
Reporter: robe | Owner: strk
     Type: task | Status: new
Priority: normal | Milestone:
Component: SysAdmin/Trac | Resolution:
Keywords: |
---------------------------+-------------------
Comment (by robe):

For now I just put in the trac password in the
/var/www/trac/env/postgis/trac.ini file and that seems to work okay. I
also turned postgres logging back to what it was since the postgresql.log
had ballooned to over 90GB.
--
Ticket URL: <#3286 (gitea git commit hooks failing to trac upgrade of trac.db.api.DatabaseManager) – OSGeo;
OSGeo <Gter - OSGeo;
OSGeo committee and general foundation issue tracker.