[sr-dev] Kamailio 3.3.5: Possible memory leak in select framework?

Pawel Kuzak pawel.kuzak at 1und1.de
Mon Feb 17 11:40:07 CET 2014


Hi,

We are running Kamailio 3.3.5 as a Registrar service. We wanted to 
increase some logging, so we inserted the following lines into our 
configuration file:

...
  # log failed registration
  route[LOG_REG_DENIED]{
   xlog("L_ERR","md=REGISTER, s=DENIED, n=$tU, 
ct=$sel(contact.uri.hostport), v=$sel(via[1].host)");
  }

  # log successful registration
  route[LOG_REG_SUCCESS]{
   xlog("L_ERR","md=REGISTER, s=OK, n=$tU, 
ct=$sel(contact.uri.hostport), v=$sel(via[1].host)");
  }
...

After about 24 hours Kamailio stopped working properly and the following 
ERROR messages started to appear in the log:

ERROR: <core> [lvalue.c:389]: rval expression evaluation failed 
(141,18-141,57)
ERROR: <core> [db_row.c:116]: no private memory left
ERROR: db_mysql [km_row.c:58]: could not allocate row
ERROR: db_mysql [km_res.c:188]: error while converting row #0
ERROR: db_mysql [km_res.c:217]: error while converting rows
ERROR: db_mysql [km_dbase.c:191]: error while converting result
ERROR: <core> [db_query.c:134]: error while storing result
ERROR: p_usrloc [ul_db_query.c:108]: could not query table location.
ERROR: p_usrloc [ul_db_query.c:52]: could not query table location error 
on id 12, db 1.
ERROR: p_usrloc [ul_db.c:199]: error on id 12, db 1, errors occured: 1, 
threshold: 50
ERROR: <core> [db_row.c:116]: no private memory left
ERROR: db_mysql [km_row.c:58]: could not allocate row
ERROR: db_mysql [km_res.c:188]: error while converting row #0
ERROR: db_mysql [km_res.c:217]: error while converting rows
ERROR: db_mysql [km_dbase.c:191]: error while converting result
ERROR: <core> [db_query.c:134]: error while storing result
ERROR: p_usrloc [ul_db_query.c:108]: could not query table location.
ERROR: p_usrloc [ul_db_query.c:52]: could not query table location error 
on id 12, db 1.
ERROR: <core> [db_row.c:116]: no private memory left
ERROR: db_mysql [km_row.c:58]: could not allocate row
ERROR: db_mysql [km_res.c:188]: error while converting row #0
ERROR: db_mysql [km_res.c:217]: error while converting rows
ERROR: db_mysql [km_dbase.c:191]: error while converting result
ERROR: <core> [db_query.c:134]: error while storing result
ERROR: p_usrloc [ul_db_query.c:108]: could not query table location.
ERROR: p_usrloc [ul_db_query.c:52]: could not query table location error 
on id 12, db 2.
ERROR: p_usrloc [ul_db.c:199]: error on id 12, db 2, errors occured: 0, 
threshold: 50
ERROR: <core> [db_row.c:116]: no private memory left
ERROR: db_mysql [km_row.c:58]: could not allocate row
ERROR: db_mysql [km_res.c:188]: error while converting row #0
ERROR: db_mysql [km_res.c:217]: error while converting rows
ERROR: db_mysql [km_dbase.c:191]: error while converting result
ERROR: <core> [db_query.c:134]: error while storing result
ERROR: p_usrloc [ul_db_query.c:108]: could not query table location.
ERROR: p_usrloc [ul_db_query.c:52]: could not query table location error 
on id 12, db 2.
ERROR: p_usrloc [udomain.c:433]: db_query failed
ERROR: <core> [msg_translator.c:2089]: ERROR: 
build_res_buf_from_sip_req: out of memory ; needs 484
ERROR: sl [sl.c:270]: failed to reply stateful (tm)
ERROR: registrar [reply.c:607]: failed to send 200 OK
ERROR: <core> [msg_translator.c:2089]: ERROR: 
build_res_buf_from_sip_req: out of memory ; needs 530
ERROR: sl [sl_funcs.c:371]: ERROR: sl_reply_error used: I'm terribly 
sorry, server error occurred (1/SL)

We strongly suppose that this memory issue is somehow caused by the 
above mentioned xlog-lines or the usage of the select framework inside 
those lines, because if we take out those lines, Kamailio is running 
smoothly (Currently running for 6 days now). May it be a possible memory 
leak in the select framework?

Some statistics about our Registrar (Interval 24h):
- Number of transactions: Average 500, Maximum 1000
- Number of accepted registrations: Average 7500, Maximum 14500
- Used Memory: Average 9MB, Maximum 15MB

Regards,
Paul




More information about the sr-dev mailing list