rlm_sql_null driver sometimes writes truncated lines

Shawn Asmussen shawn.asmussen at gmail.com
Thu Mar 8 21:25:36 CET 2018


I'm currently using the rlm_sql_null driver to write accounting updates to
a flat file, which are then sent up to an external database using
radsqlrelay. On a very small percentage of the records (Maybe once out of
every million records or so), one of the lines gets truncated in the output
file, causing it to be merged with the next record. Here is one such
example. About halfway through the line, you can see where the first sql
statement is only partially written, and then the next UPDATE starts all on
the same line (AND AcctStopTime UPDATE radacct). radsqlrelay does not
handle this gracefully. When it fails to execute the invalid SQL it just
goes into an infinite loop, trying to execute that same SQL statement over
and over. Given the infrequency that it happens, I'm not sure that it would
feasible to get debug output from radiusd when it happens, although I'm
open to suggestions on how to capture any useful info. Wondering if anybody
has seen anything like before? I'm currently running the
freeradius-3.0.13-6.el7.x86_64 rpm from the EPEL repo for CentOS 7. It
doesn't happen often, but we're generating millions of accounting updates a
day across hundreds of freeradius servers, so it has been popping up
somewhere just about every day.


UPDATE radacct SET FramedIPAddress = NULLIF('172.21.22.24', '')::inet,
AcctSessionTime = 600, AcctInterval = (1520393120 - EXTRACT(EPOCH FROM
(COALESCE(AcctUpdateTime, AcctStartTime)))), AcctUpdateTime =
TO_TIMESTAMP(1520393120), AcctInputOctets = (('0'::bigint << 32) +
'0'::bigint), AcctOutputOctets = (('0'::bigint << 32) + '0'::bigint) WHERE
(AcctUniqueId = 'fb8de85671b07d2387ec982a42bb4ea4') AND AcctStopTime UPDATE
radacct SET AcctStopTime = TO_TIMESTAMP(1520396146), AcctUpdateTime =
TO_TIMESTAMP(1520396146), AcctSessionTime = COALESCE(10806, (1520396146 -
EXTRACT(EPOCH FROM(AcctStartTime)))), AcctInputOctets = (('0'::bigint <<
32) + '0'::bigint), AcctOutputOctets = (('0'::bigint << 32) + '0'::bigint),
AcctTerminateCause = '', FramedIPAddress = NULLIF('172.21.22.61',
'')::inet, ConnectInfo_stop = '' WHERE (AcctUniqueId =
'1c43554feb67bd56087b0656fefdad17') AND AcctStopTime IS NULL;




Shawn Asmussen


More information about the Freeradius-Users mailing list