"No DB handles" workaround

Pete Ashdown pashdown at xmission.com
Tue Jan 14 21:38:05 CET 2014


I ran into the "rlm_sql (sql): There are no DB handles to use! skipped
0, tried to connect 0" error shortly after switching our authentication
to newly configured freeradius servers and putting load on them.  In
searching for a resolution to this error, I found this thread:

http://freeradius.1045715.n5.nabble.com/errors-There-are-no-DB-handles-to-use-and-Discarding-conflicting-packet-from-client-td2784751.html

Where Alan DeKok responds with:

"Your database is broken.  Fix it."
"The answer is always the same:  Fix the database."
" What part of "fix your database" is hard to understand?"
"Fix your database so that it isn't too slow."

Our SQL server is a 24 core, 32GB, SSD backed server with very light
loads.  A slowquery log showed nothing of interest, so we started
looking in other directions.

What we found is that if the thread pool max_servers > sql num_sql_socks
this error will occur.  I haven't looked at the code, but I am guessing
that it is locking one SQL socket per thread, and if you have more
threads than sockets, then you will start seeing this error.  We set
max_servers and num_sql_socks both to 15 and we haven't seen the error
since.

This was with freeradius v2.2.2.

I hope this helps someone.



More information about the Freeradius-Users mailing list