[OpenSIPS-Devel] [opensips] cachedb_mongodb module crashes when doing a query if mongodb instance is down (#747)
abhowmik123
notifications at github.com
Thu Jan 7 12:45:01 CET 2016
found a bug as described above , done some debugging and found that bson->data holds a NULL value when initializing the bson-iterator, which causes the crash Anyways fixed the crash by aplying a simple check
problem in source file cachedb_mongodb_dbasec
problematic code:
mongo_cmd_get_last_error(conn,MONGO_DATABASE(connection),&err_b);
bson_iterator_init(&i,&err_b);
while( bson_iterator_next(&i)) {
LM_ERR("Fetched ERR key [%s] Val = ",bson_iterator_key(&i));
switch( bson_iterator_type( &i ) ) {
case BSON_DOUBLE:
fixed it:
mongo_cmd_get_last_error(conn,MONGO_DATABASE(con),&err_b);
if(err_bdata!=NULL) // check
{
bson_iterator_init(&it,&err_b);
while( bson_iterator_next(&it)) {
LM_ERR("Fetched ERR key [%s] Val = ",bson_iterator_key(&it));
switch( bson_iterator_type( &it ) ) {
case BSON_DOUBLE:
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/747
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20160107/b088f22d/attachment.htm>
More information about the Devel
mailing list