Database connection failure and retry

classic Classic list List threaded Threaded
6 messages Options
| Threaded
Open this post in threaded view
|

Database connection failure and retry

Ming-Ching Tiew

A little while ago I posted about in my configuration, using unixodbc/freetds,
we noticed that database/network failure causes permanent disability in
radius server to stop logging and I was given the reply that it is in the
feature of radius server to retry upon failure.

So there is a discrepancy between what I noticed verses the "supposed to be"
behaviour.

Upon further investigation I explored into the code, I found this in sql_mysql.c :-

static int sql_fetch_row(SQLSOCK * sqlsocket, SQL_CONFIG *config)
{
        rlm_sql_mysql_sock *mysql_sock = sqlsocket->conn;

        /*
         *  Check pointer before de-referencing it.
         */
        if (!mysql_sock->result) {
                return SQL_DOWN;
        }

        sqlsocket->row = mysql_fetch_row(mysql_sock->result);

        if (sqlsocket->row == NULL) {
                return sql_check_error(mysql_errno(mysql_sock->sock));
        }
        return 0;
}


However the code in sql_unixodbc.c is like this :-


static int sql_fetch_row(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
    rlm_sql_unixodbc_sock *unixodbc_sock = sqlsocket->conn;

    sqlsocket->row = NULL;

    if(SQLFetch(unixodbc_sock->stmt_handle) == SQL_NO_DATA_FOUND)
        return 0;

    /* XXX Check if return suggests we should return error or SQL_DOWN */

    sqlsocket->row = unixodbc_sock->row;
    return 0;
}


There is no checking whatsoever, so unixodbc driver is unable to reconnect
upon  failure.





-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Database connection failure and retry

Alan DeKok
"Ming-Ching Tiew" <[hidden email]> wrote:
> There is no checking whatsoever, so unixodbc driver is unable to reconnect
> upon  failure.

  Ok... are you willing to supply a patch?

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Database connection failure and retry

Ming-Ching Tiew

From: "Alan DeKok" <[hidden email]>


> "Ming-Ching Tiew" <[hidden email]> wrote:
> > There is no checking whatsoever, so unixodbc driver is unable to reconnect
> > upon  failure.
>
>   Ok... are you willing to supply a patch?
>

I am not sure if I am in position to patch it but I noticed the mysql driver
is much higher quality. Other drivers such as iodbc and unixodbc are poorer
quality.

Cheers.



-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Database connection failure and retry

Alan DeKok
"Ming-Ching Tiew" <[hidden email]> wrote:
> I am not sure if I am in position to patch it but I noticed the mysql driver
> is much higher quality. Other drivers such as iodbc and unixodbc are poorer
> quality.

  That's terrible.

  How are you going to fix it?

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Database connection failure and retry

Ming-Ching Tiew

From: "Alan DeKok" <[hidden email]>


> "Ming-Ching Tiew" <[hidden email]> wrote:

> > I am not sure if I am in position to patch it but I noticed the mysql driver
> > is much higher quality. Other drivers such as iodbc and unixodbc are poorer
> > quality.
>
>   That's terrible.
>

Actually I am surprised that no one seem to complain about this.
My conclusion is that no one has used the iodbc and/or unixodbc
in a life environment ( everybody is using mysql  or postgres ).
With the current state of the drivers, they are not usable. Period.

Cheers.



-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Database connection failure and retry

Alan DeKok
"Ming-Ching Tiew" <[hidden email]> wrote:
> With the current state of the drivers, they are not usable. Period.

  Does this mean:

  a) you will do something about it?

or

  b) you expect someone else to do something about it?

  Alan Dekok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html