I do exactly the same thing as you - I get this problem from time to time (usually accompanied by a few discarding duplicate request messages as the nas re attempts). The documentation says that if you get these its probably back end, and its right. Usually its a slow query of some description, or the SQL server fails to respond in a timely manner. Do you account to SQL as well?. You could log slow queries in SQL and examine these. Of course it could be a loop thats not exiting within your perl script or something. Heres a list of things that have caused it for me. 1) Could not connect to accounting database in a timely manner (fixed this by putting a connect timeout and dropping the packet if no connection can be made) 2) Queries were taking too long (added a couple of keys/indexes) 3) Disk filled up on accounting database (SQL just sat there and didn't respond!) Its always been my fault, never radius's. My suggestion, put some more error checking in your script and if it cant do anything due to back end return RLM_MODULE_FAIL (one of the constants in the example).
Each function in the perl script opens a mysql connection then closes it before finishing the function. Could this be the problem? Should I create an initial connection and use it throughout the script?
I find the simplest thing to do is create a persistent DBH, and create a routine which checks the DBH handle at the beggining of my script like so ($dbh is a global): sub ensuredbh{ #if the database connection raised an error at the last query or if there isnt a database handle, then re-create one. if(ref($dbh) && $dbh->ping) { return 1; } else{ print "Database connection error - re-establishing\n"; our $dbh=DBI->connect($dbhdsn,$dbhuser,$dbhpass) or return 0);} return(1); } } in authenticate i can do &ensuredbh or return RLM_MODULE_FAIL;
After some recent changes to my rlm_perl perl script I am getting the following messages all the time...
Tue Aug 8 08:08:50 2006 : Error: WARNING: Unresponsive child (id 2966633392) for request 28 Tue Aug 8 08:08:50 2006 : Error: WARNING: Unresponsive child (id 2977528752) for request 27 Tue Aug 8 08:08:50 2006 : Error: WARNING: Unresponsive child (id 2988153776) for request 25
Usually after a lot of these radius will crash and will need to be restarted. I was receiving the sql running out of connections error but I am not getting those anymore after tuning my tables. I don't believe at this point that this is a mysql issue however any suggestions would be appreciated. I do access mysql from my perl script so that could be the problem.
Each function in the perl script opens a mysql connection then closes it before finishing the function. Could this be the problem? Should I create an initial connection and use it throughout the script?
Thanks Guys, I know you will know what the problem is.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html