OK. I swear I have implemented it correctly. I have even gone so far as to simply change all the "return -1" lines to "return SQL_DOWN" as a test but the driver never tries to reconnect. I know I am getting the new versions installed etc as I have modified the output of the error messages so its not getting an old module or anything like that.
for instance I have the following if (!pg_sock->result) { radlog(L_ERR, "rlm_sql_postgresql: PostgreSQL Query failed Error: %s - We have a 2nd problem Houston!", PQerrorMessage(pg_sock->conn)); #return SQL_DOWN; return SQL_DOWN; But in my logs I continue to get: Mon Nov 11 17:13:24 2002 : Error: rlm_sql (sql): Couldn't update SQL accounting for START packet - FATAL 1: This connection has been terminated by the administrator. server closed the connection unexpectedly ?This probably means the server terminated abnormally ?before or while processing the request. Mon Nov 11 17:13:24 2002 : Error: rlm_sql_postgresql: PostgreSQL Query failed Error: no connection to the server - We have a 2nd problem Houston! Mon Nov 11 17:13:24 2002 : Error: rlm_sql (sql): Couldn't update SQL accounting for ALIVE packet - FATAL 1: This connection has been terminated by the administrator. server closed the connection unexpectedly ?This probably means the server terminated abnormally ?before or while processing the request. Mon Nov 11 17:13:24 2002 : Error: Received Accounting-Request packet from 212.50.53.10 with invalid signature! Mon Nov 11 17:13:24 2002 : Error: rlm_sql (sql): Couldn't update SQL accounting for START packet - FATAL 1: This connection has been terminated by the administrator. server closed the connection unexpectedly ?This probably means the server terminated abnormally ?before or while processing the request. Mon Nov 11 17:13:24 2002 : Error: rlm_sql_postgresql: PostgreSQL Query failed Error: no connection to the server - We have a 2nd problem Houston! It never actually tries to reconnect. Is there something else I need to enable before it will attempt a reconnect? When I first looked at this it looked pretty easy, but I have been banging my head aginst this all day and still can't get anywhere.. Help.. -peter On 08 Nov 2002 16:22:04 -0600 Squire Todd T. Fries uttered the following: > Hi Peter, > > I originally implemented the re-connect code. All you have to do is > understand how to get errors back from the library/api that goes along > with the c api of your interface to your favorite database module. > > I implemented it in such a way that if you return SQL_DOWN when the > database appears to be 'down' and 'need to re-connect this socket'. > The database independent code handles this properly to re-connect in > down situations such that one try is made, and if the try fails, the > timeout then applies for re-trying to connect this particular socket. > Obivously if the re-connect fails, the query to the database fails as > well. > > You should also look at the 'src/modules/rlm_sql/README' file in which > I've placed a few comments as to what the database driver api should do. > Start with: Returning 'SQL_DOWN'.... > > In any event, if you can nab some documentation for the database > specific library, finding the error codes when a connection fails, and > mapping the ones that mean 'the database is down' to a return value of > 'SQL_DOWN' is pretty much what you need to do. > > If I'm unclear, feel free to contact me, I'm interested in assisting > anyone to get the rest of the database drivers to do reconnect properly, > though I do not have the time (in the forseeable future) to implement it > myself. > > On Fri, 2002-11-08 at 10:24, Peter Nixon wrote: > > On Fri, 08 Nov 2002 09:45:02 -0600 > > Squire Chris Parker uttered the following: > > > > > At 04:17 PM 11/8/2002 +0200, Peter Nixon wrote: > > > >What is the situation regarding reconnects in the rlm_sql module > > > >(specifically with the postgres driver)? > > > >I read the following thread: > > > >http://lists.cistron.nl/pipermail/freeradius-devel/2002-July/002921 > > > >.html > > > > > > > >But did reconnect code ever make it into FreeRadius? It certainly > > > >doesn't seem to be working for me. > > > > > > It requires modifications to the sql drivers to fully support. > > > Currently, this is only done for MySQL AFAIK. The main 'rlm_sql' > > > supports it if the drivers are suitably updated. > > > > > > To repeat Alan's mantra: Patches are welcome! > > > > Ok. Thanks. I will check out the mysql module then and see how > > difficult it is to port the logic to postgres. My C skills are only > > moderate so we shall see :-) > > > > -- > > > > Peter Nixon > > http://www.peternixon.net/ > > PGP Key: http://www.peternixon.net/public.asc > -- > Todd T. Fries <[EMAIL PROTECTED]> > > > - > List info/subscribe/unsubscribe? See > http://www.freeradius.org/list/users.html > -- Peter Nixon http://www.peternixon.net/ PGP Key: http://www.peternixon.net/public.asc
msg10901/pgp00000.pgp
Description: PGP signature