[sr-dev] modules linked to db_flatstore cause core on db_check_table_version function call

Eduardo Lejarreta lejarreta.e at sarenet.es
Wed May 25 18:07:33 CEST 2016


Good evening.

INTRODUCTION:
-------------

We've traced an error, in our case, db_flatstore and siptrace 
combination causes crash core.

siptrace module tries to check siptrace table version on a DB which has 
no query capabilities and that causes the crash core.

This happens from kamailio-4.3.0 where db_check_table_version function 
call is introduced on siptrace module.


OUR CONFIGURATION:
------------------

kamailio.cfg ->

...

#!define FLAT_DBURL "flatstore:/expert/siptrace-logs"

loadmodule "db_flatstore.so"
loadmodule "siptrace.so"

modparam("siptrace", "db_url", FLAT_DBURL)
modparam("siptrace", "trace_flag", 0)
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "traced_user_avp", "$avp(s:user)")

...


ERROR FLOW:
-----------

siptrace.c -> if (db_check_table_version(&db_funcs, db_con, 
&siptrace_table, SIP_TRACE_TABLE_VERSION) < 0)

db.c -> db_check_table_version
      -> db_table_version(dbf, dbh, table);
      -> dbf->query(connection, key, 0, val, col, 1, 1, 0, &res)

 From this last funtion call each thread never returns and remains 
blocked, and finally crashes with a nice core (it fullfills the entire 
disk)


OUR SUGGESTION:
------------------

We can recommend developers not to call db_check_table_version if a 
prior query of capabilities doesn't return: DB_CAP_QUERY.
We can do it for them on db_check_table_version function.

Thanks and best regards

Eduardo Lejarreta.
--
Dpto. Sistemas SARENET
Parque Tecnológico de Zamudio. Edif. 103 48170 Vizcaya Spain.
www.sarenet.es

Personal contact:
IT Manager & VoIP Engineer.
www.seeyouonnet.com




More information about the sr-dev mailing list