Skip to content

dialplan causes crash on startup #655

@petekelly

Description

@petekelly

I am running OpenSIPS 2.1 latest from git, and seeing a strange issue with dialplan module in conjunction with postgresql. Basically opensips will not start, even with an empty dialplan table and is terminated with a SIGBUS.

The problem still happens with some rows in dialplan table, but disappears if I comment out dialplan module and call to dp_translate.

I have not tried to replicate with MySQL

OpenSIPs version is

version: opensips 2.1.1 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
git revision: 4963c7c
main.c compiled on 08:24:30 Sep 28 2015 with gcc 4.9.2

Log output is

Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_submit_query: 0x7fca723c2b60 PQsendQuery(select dpid,pr,match_op,match_exp,match_flags,subst_exp,repl_exp,attrs,timerec from dialplan where disabled=0 order by pr)
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:core:db_new_result: allocate 48 bytes for result set at 0x7fca723c2cf8
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_fetch_result: 0x7fca723c2b60 PQresultStatus(PGRES_TUPLES_OK) PQgetResult(0x242a680)
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: 9 columns returned from the query
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:core:db_allocate_columns: allocate 252 bytes for result columns at 0x7fca723c2dc0
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e08)[0]=[dpid]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e18)[1]=[pr]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e28)[2]=[match_op]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e38)[3]=[match_exp]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e48)[4]=[match_flags]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e58)[5]=[subst_exp]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e68)[6]=[repl_exp]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e78)[7]=[attrs]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e88)[8]=[timerec]
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type
Sep 28 08:47:16 opensips01 opensips-reg[20519]: WARNING:dialplan:dp_load_db: no data in the db
Sep 28 08:47:16 opensips01 opensips-reg[20513]: DBG:core:handle_sigs: status = 135
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: child process 20519 exited by a signal 7
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: core was generated
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: terminating due to SIGCHLD
Sep 28 08:47:16 opensips01 opensips-reg[20515]: INFO:core:sig_usr: signal 15 received
Sep 28 08:47:16 opensips01 opensips-reg[20518]: INFO:core:sig_usr: signal 15 received
Sep 28 08:47:16 opensips01 opensips-reg[20514]: INFO:core:sig_usr: signal 15 received
Sep 28 08:47:16 opensips01 opensips-reg[20516]: INFO:core:sig_usr: signal 15 received
Sep 28 08:47:16 opensips01 opensips-reg[20517]: INFO:core:sig_usr: signal 15 received
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:cleanup: cleanup

Backtrace output is

Core was generated by `/usr/local/opensips_proxy/sbin/opensips -P /var/run/opensips/opensips.pid -m 64'.
Program terminated with signal SIGBUS, Bus error.
#0  destroy_hash (rules_hash=0x7fca64cd1790) at dp_db.c:671
671             for (rulep = indexp->first_rule; rulep; rulep=indexp->first_rule) {
(gdb) bt
#0  destroy_hash (rules_hash=0x7fca64cd1790) at dp_db.c:671
#1  0x00007fca6b8c92ec in dp_load_db (dp_conn=dp_conn@entry=0x7fca64cd1790) at dp_db.c:343
#2  0x00007fca6b8c9903 in init_db_data (dp_connection=dp_connection@entry=0x7fca64cd1790) at dp_db.c:126
#3  0x00007fca6b8b7b52 in child_init (rank=<optimized out>) at dialplan.c:532
#4  0x00000000004e5167 in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237b308) at sr_module.c:552
#5  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237b878) at sr_module.c:546
#6  init_mod_child (m=0x7fca7237b958, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546
#7  0x00000000004e4f5f in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237cec8) at sr_module.c:546
#8  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237d818) at sr_module.c:546
#9  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237dac0) at sr_module.c:546
#10 init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237e7d8) at sr_module.c:546
#11 init_mod_child (m=0x7fca7237e960, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546
#12 0x00000000004e4f5f in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237eb40) at sr_module.c:546
#13 init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237ec78) at sr_module.c:546
#14 init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237f8f0) at sr_module.c:546
#15 init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237fa20) at sr_module.c:546
#16 init_mod_child (m=0x7fca7237fba0, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546
#17 0x00000000004e84eb in init_mod_child (type=<optimized out>, rank=1, m=0x7fca72380738) at sr_module.c:546
#18 init_child (rank=1) at sr_module.c:595
#19 0x000000000058c591 in udp_start_processes (chd_rank=chd_rank@entry=0x84c2ec <chd_rank>, startup_done=startup_done@entry=0x7fca64d4ed58) at net/net_udp.c:424
#20 0x000000000041a9d3 in main_loop () at main.c:722
#21 main (argc=<optimized out>, argv=<optimized out>) at main.c:1259
(gdb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions