Max Query Length Exceeded and Field Truncated

Robert Gabriel ephemeric at gmail.com
Thu Mar 18 17:52:10 CET 2010


Hello all,

Our network had some change somewhere and now all MySQL insert queries
are failing
with the last field been truncated and the character count is always
4097 from the CDRs
been sent by our NAS (Acme Packet SBC).

Having looked at the source we see:

src/modules/rlm_sql/conf.h
src/modules/rlm_sql/rlm_sql.c

 /* SQL defines */
 #define MAX_QUERY_LEN			4096
 #define SQL_LOCK_LEN			MAX_QUERY_LEN

I'm not sure here, can we just increase to 8192 etc. or is this being stupid?
Can I edit the above and recompile?

Unfortunately we are running FreeRADIUS 1.1.7 and yes, everyone must
be screaming upgrade!
Linux klio 2.6.24-21-server #1 SMP Wed Oct 22 00:18:13 UTC 2008 i686 GNU/Linux.
MySQL 5.0.51a-3ubuntu5.4-log.

I've looked at the above files in 2.1.8 and the values are the same.
Does this mean an upgrade will not fix this?
The RADIUS RFC says a maximum length of 4096, is this what we are
breaking or something else?

Please advise as to the best solution.



FreeRADIUS log:

Wed Mar 17 16:10:50 2010 : Error: rlm_sql_mysql: MySQL error 'You have
an error in your SQL syntax; check the manual that corresponds to y
our MySQL server version for the right syntax to use near
''sip:0827355754 at hugetipjhb01' at line 1'

MySQL log (shortened for brevity's sake):

INSERT into accounting (AcctStatusType, AcctTerminateCause,
CalledStationId, NASIdentifier, h323setuptime, h323connecttime,
h323disconnecttime, h323disconnectcause) values ('0', '0', '0', '0',
'0', '0', '0', 'sip:0738063114 at h


>From the FreeRADIUS SQL trace (shortened for brevity's sake):

INSERT into accounting (AcctStatusType, AcctTerminateCause,
CalledStationId, NASIdentifier, h323setuptime, h323connecttime,
h323disconnecttime, h323disconnectcause,  CallingRTCPMaxLatency_FS1,
CallingRTPPacketsLost_FS1, CallingRTPAvgJitter_FS1,
CallingRTPMaxJitter_FS1, SessionIngressRealm, SessionEgressRealm,
SessionProtocolType) values ('196.31.63.118', '15830', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', 'sip:0823246912@;



More information about the Freeradius-Users mailing list