[sr-dev] [kamailio/kamailio] Kamailio crash while concurrent dialplan.reload (#1874)

Dmitri Savolainen notifications at github.com
Thu Feb 28 15:57:58 CET 2019


#### Reproduction

run this script simultaneously (from two console for example)
```
#!/usr/bin/perl
$cmd = q(curl -X GET -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "dialplan.reload", "params":[],  "id": 1 }' http://IP:PORT/jsonrpc/);
for ($i=0; $i<1000; $i++){
        `$cmd`;
}
```

#### Debugging Data
```
Program terminated with signal 11, Segmentation fault.
#0  0x00007ffaa39e95f7 in add_rule2hash (rule=0x7ffa9fa05248, h_index=1) at dp_db.c:563
/home/snen/KamailioGitMyFork/src/modules/dialplan/dp_db.c:563:12474:beg:0x7ffaa39e95f7
(gdb) bt
#0  0x00007ffaa39e95f7 in add_rule2hash (rule=0x7ffa9fa05248, h_index=1) at dp_db.c:563
#1  0x00007ffaa39e4831 in dp_load_db () at dp_db.c:305
#2  0x00007ffaa39ce914 in dialplan_rpc_reload (rpc=0x7ffa9f382a80 <func_param>, ctx=0x7ffa9f3829a0 <_jsonrpc_ctx_global>) at dialplan.c:610
#3  0x00007ffa9f16398f in jsonrpc_dispatch (msg=0x7ffd427ad880, s1=0x0, s2=0x0) at jsonrpcs_mod.c:1294
#4  0x0000000000461a5f in do_action (h=0x7ffd427ad7a0, a=0x7ffaa72987d8, msg=0x7ffd427ad880) at core/action.c:1067
#5  0x000000000046e23e in run_actions (h=0x7ffd427ad7a0, a=0x7ffaa72987d8, msg=0x7ffd427ad880) at core/action.c:1564
#6  0x00000000004619ce in do_action (h=0x7ffd427ad7a0, a=0x7ffaa729b140, msg=0x7ffd427ad880) at core/action.c:1058
#7  0x000000000046e23e in run_actions (h=0x7ffd427ad7a0, a=0x7ffaa729b140, msg=0x7ffd427ad880) at core/action.c:1564
#8  0x00007ffa9f38868c in xhttp_process_request (orig_msg=0x7ffaa72a6ed0, 
    new_buf=0x7ffaa72c4420 "GET /jsonrpc/ HTTP/1.1\r\nVia: SIP/2.0/TCP 192.168.10.190:48542\r\nUser-Agent: curl/7.29.0\r\nHost: 192.168.10.190:5071\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 71\r\n\r\n{\"jsonrpc\": \"2.0\","..., new_len=253) at xhttp_mod.c:296
#9  0x00007ffa9f389dcf in xhttp_handler (msg=0x7ffaa72a6ed0) at xhttp_mod.c:383
#10 0x00000000004ff30c in nonsip_msg_run_hooks (msg=0x7ffaa72a6ed0) at core/nonsip_hooks.c:112
#11 0x000000000057b373 in receive_msg (
    buf=0x7ffaa02ec618 "GET /jsonrpc/ HTTP/1.1\r\nUser-Agent: curl/7.29.0\r\nHost: 192.168.10.190:5071\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 71\r\n\r\n{\"jsonrpc\": \"2.0\", \"method\": \"dialplan.reload\", \"params\":"..., len=214, rcv_info=0x7ffaa02ec338) at core/receive.c:270
#12 0x0000000000635eb5 in receive_tcp_msg (
    tcpbuf=0x7ffaa02ec618 "GET /jsonrpc/ HTTP/1.1\r\nUser-Agent: curl/7.29.0\r\nHost: 192.168.10.190:5071\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 71\r\n\r\n{\"jsonrpc\": \"2.0\", \"method\": \"dialplan.reload\", \"params\":"..., len=214, rcv_info=0x7ffaa02ec338, con=0x7ffaa02ec320) at core/tcp_read.c:1399
#13 0x0000000000638372 in tcp_read_req (con=0x7ffaa02ec320, bytes_read=0x7ffd427ae65c, read_flags=0x7ffd427ae658) at core/tcp_read.c:1631
#14 0x000000000063b115 in handle_io (fm=0x7ffaa7302d78, events=1, idx=-1) at core/tcp_read.c:1804
#15 0x00000000006299b6 in io_wait_loop_epoll (h=0xae9060 <io_w>, t=2, repeat=0) at core/io_wait.h:1062
#16 0x000000000063d172 in tcp_receive_loop (unix_sock=16) at core/tcp_read.c:1974
#17 0x00000000004dcaf9 in tcp_init_children () at core/tcp_main.c:5086
#18 0x00000000004266c4 in main_loop () at main.c:1750
#19 0x000000000042d14b in main (argc=13, argv=0x7ffd427aedc8) at main.c:2737
(gdb) l
558		new_id = 0;
559	
560		/*search for the corresponding dpl_id*/
561		for(crt_idp = last_idp =rules_hash[h_index]; crt_idp!= NULL; 
562				last_idp = crt_idp, crt_idp = crt_idp->next)
563			if(crt_idp->dp_id == rule->dpid)
564				break;
565	
566		/*didn't find a dpl_id*/
567		if(!crt_idp){
(gdb) p crt_idp->dp_id
Cannot access memory at address 0x7ffa9f002429
(gdb) 

```


### Additional Information

```
kamailio 5.3.0-dev3 (x86_64/linux) d726bd
```



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1874
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190228/6f2fcd35/attachment.html>


More information about the sr-dev mailing list