duplicate AcctUniqueId, so test starttime in stop_query?

Brad Brad braddeicide at hotmail.com
Tue Nov 14 03:38:15 CET 2006

We are seeing duplicate AcctSessionId and AcctUniqueId's in our radacct 
mysql table, when the accounting_stop_query is run its overwriting all 
previous records (except AcctStartTime) with the latest one.  Sometimes it 
happens seconds apart, somtimes its weeks apart.

I was wondering if testing the AcctStartTime field in every 
accounting_stop_query will fix the problem? accounting_stop_query_alt is 
getting AcctStartTime by DATE_SUB('%S', INTERVAL (%{Acct-Session-Time:-0} + 
%{Acct-Delay-Time:-0}) SECOND)

So the new accounting_stop_query would be

        accounting_stop_query = "UPDATE ${acct_table2} SET AcctStopTime = 
'%S', AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = 
AcctOutputOctets = '%{Acct-Output-Octets}', AcctTerminateCause = 
'%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time}',
ConnectInfo_stop = '%{Connect-Info}' WHERE AcctSessionId = 
'%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = 
'%{NAS-IP-Address}' and AcctStartTime = DATE_SUB('%S', INTERVAL 
(%{Acct-Session-Time:-0} + %{Acct-Delay-Time:-0}) SECOND)"

Is Acct-Session_time + Acct Delay-Time ALWAYS equal exactly to 

Alternativly, that stop_query_alt looks pretty good, maybe we could just run 
that and not the start_query and stop_queries?

Get FREE company branded e-mail accounts and business Web site from 
Microsoft Office Live 

More information about the Freeradius-Users mailing list