Database connection failure and retry
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.
From: "Alan DeKok" <aland@ox.org>
"Ming-Ching Tiew" <mingching.tiew@redtone.com> 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.
From: "Alan DeKok" <aland@ox.org>
"Ming-Ching Tiew" <mingching.tiew@redtone.com> 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.
participants (2)
-
Alan DeKok -
Ming-Ching Tiew