-
Notifications
You must be signed in to change notification settings - Fork 633
Closed
Description
OpenSIPS version you are running
version: opensips 2.4.7 (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, sigio_rt, select.
git revision: 495b980
main.c compiled on 03:18:29 Apr 10 2020 with gcc 5.4.0
Describe the bug
Opensips crashes randomly under load. Sometime multiple times a day, and other times a day or more between crashes.
Some backtraces show slight variations in the call stack but always eventually through run_trans_callbacks_locked() and segfaults in free_contacts ().
To Reproduce
Unable to reproduce. Happens randomly in production under load.
Expected behavior
No segfault!
Relevant System Logs
Apr 28 20:37
core.opensips.sig11.18058
(gdb) bt full
#0 free_contacts (_c=0x7f5ece72f610) at parser/contact/contact.c:296
ptr = 0x6e6f3d32723b
#1 0x00000000005aa5fa in free_contact (_c=_c@entry=0x7f5eb32530e0)
at parser/contact/parse_contact.c:107
No locals.
#2 0x000000000053e75c in clean_hdr_field (hf=hf@entry=0x7f5eb32530b0)
at parser/hf.c:87
No locals.
#3 0x00007f5eadfea2c7 in clean_msg_clone (msg=0x7f5eb32521e0,
max=0x7f5eb3253a78, min=0x7f5eb32521e0) at sip_msg.h:116
hdr = 0x7f5eb32530b0
#4 run_trans_callbacks_locked (type=type@entry=128,
trans=trans@entry=0x7f5eb2ecdf08, req=<optimized out>,
rpl=rpl@entry=0x7f5ece745cc8, code=code@entry=200) at t_hooks.c:265
No locals.
#5 0x00007f5eadf976ae in relay_reply (t=<optimized out>,
p_msg=<optimized out>, branch=<optimized out>, msg_status=<optimized out>,
cancel_bitmap=<optimized out>) at t_reply.c:1353
relay = <optimized out>
save_clone = <optimized out>
buf = 0x7f5ece731738 "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP <redacted source>:5060;branch=z9hG4bKt9ULXZ7fmfq6e5fK61D6FA\r\nRecord-Route: <sip:<redacted interface>:7080;transport=tcp;r2=on;lr;did=1f3.6b5ad8f6>\r\nRecord-Route: <sip:<redacted interface>"...
res_len = 1015
relayed_code = 200
relayed_msg = <optimized out>
bm = {to_tag_val = {s = 0x7f5eb32521e0 "\212B\016", len = 4455636}}
totag_retr = <optimized out>
uas_rb = 0x7f5eb2ece008
cb_s = {
s = 0x7f5ece731738 "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP <redacted source>:5060;branch=z9hG4bKt9ULXZ7fmfq6e5fK61D6FA\r\nRecord-Route: <sip<redacted interface>:7080;transport=tcp;r2=on;lr;did=1f3.6b5ad8f6>\r\nRecord-Route: <sip:<redacted interface>"..., len = 1015}
text = {s = 0x7f5ece745cc8 "_b\002", len = -1515613952}
__FUNCTION__ = "relay_reply"
#6 0x00007f5eadf9e8a7 in reply_received (p_msg=0x7f5ece745cc8)
at t_reply.c:1603
msg_status = 200
last_uac_status = 100
branch = 0
reply_status = <optimized out>
timer = 2
cancel_bitmap = 0
uac = <optimized out>
t = 0x7f5eb2ecdf08
backup_list = <optimized out>
has_reply_route = <optimized out>
__FUNCTION__ = "reply_received"
#7 0x0000000000470a71 in forward_reply (msg=msg@entry=0x7f5ece745cc8)
at forward.c:495
new_buf = 0x0
to = 0x0
new_len = 1
mod = 0x7f5ece6425e8
proto = <optimized out>
id = 0
send_sock = <optimized out>
s = <optimized out>
len = <optimized out>
__FUNCTION__ = "forward_reply"
#8 0x0000000000446d62 in receive_msg (
buf=buf@entry=0x9bbec0 <tcp_current_req> "SIP/2.0 200 OK\r\nVia: SIP/2.0/TCP <redacted interface>:7080;branch=z9hG4bK9529.26b38601.0\r\nVia: SIP/2.0/UDP <redacted source>:5060;branch=z9hG4bKt9ULXZ7fmfq6e5fK61D6FA\r\nRecord-Route: <sip:<redacted interface>:7080;transpo"..., len=<optimized out>, rcv_info=rcv_info@entry=0x7ffd44971ba0,
existing_context=existing_context@entry=0x0, flags=flags@entry=0)
at receive.c:258
ctx = 0x7f5ece72de40
msg = 0x7f5ece745cc8
start = {tv_sec = 1588106249, tv_usec = 998674}
rc = 3
in_buff = {
s = 0x9bbec0 <tcp_current_req> "SIP/2.0 200 OK\r\nVia: SIP/2.0/TCP <<redacted interface>:7080;branch=z9hG4bK9529.26b38601.0\r\nVia: SIP/2.0/UDP <redacted ource>:5060;branch=z9hG4bKt9ULXZ7fmfq6e5fK61D6FA\r\nRecord-Route: <sip:<redacted interface>:7080;transpo"..., len = 1075}
__FUNCTION__ = "receive_msg"
#9 0x000000000060b443 in tcp_handle_req (_max_msg_chunks=<optimized out>,
con=<optimized out>, req=0x9bbec0 <tcp_current_req>)
at net/proto_tcp/tcp_common.h:411
local_rcv = {src_ip = {af = 2, len = 4, u = {addrl = {3526109766, 0},
addr32 = {3526109766, 0, 0, 0}, addr16 = {10822, 53804, 0, 0, 0,
0, 0, 0}, addr = "F*,\322", '\000' <repeats 11 times>}},
dst_ip = {af = 2, len = 4, u = {addrl = {3408669254, 0}, addr32 = {
3408669254, 0, 0, 0}, addr16 = {10822, 52012, 0, 0, 0, 0, 0,
0}, addr = "F*,\313", '\000' <repeats 11 times>}},
src_port = 33762, dst_port = 7080, proto = 2,
proto_reserved1 = 647886724, proto_reserved2 = 0, src_su = {s = {
sa_family = 2,
sa_data = "\203\342F*,\322\000\000\000\000\000\000\000"}, sin = {
sin_family = 2, sin_port = 57987, sin_addr = {
s_addr = 3526109766},
sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {
sin6_family = 2, sin6_port = 57987, sin6_flowinfo = 3526109766,
sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>,
__u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0,
0, 0}}}, sin6_scope_id = 1023}},
bind_address = 0x7f5ece63ef10}
msg_buf = 0x9bbec0 <tcp_current_req> "SIP/2.0 200 OK\r\nVia: SIP/2.0/TCP <redacted interface>:7080;branch=z9hG4bK9529.26b38601.0\r\nVia: SIP/2.0/UDP <redacted_source>:5060;branch=z9hG4bKt9ULXZ7fmfq6e5fK61D6FA\r\nRecord-Route: <sip:<redacted interface>:7080;transpo"...
msg_len = <optimized out>
c = 56 '8'
size = 0
#10 tcp_read_req (con=0x7f5eaed175f8, bytes_read=0x7ffd44971c80)
at net/proto_tcp/proto_tcp.c:1187
bytes = <optimized out>
total_bytes = 1075
req = 0x9bbec0 <tcp_current_req>
src_su = {s = {sa_family = 0, sa_data = '\000' <repeats 13 times>},
sin = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {
sin6_family = 0, sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {
__in6_u = {__u6_addr8 = '\000' <repeats 15 times>,
__u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0,
0, 0}}}, sin6_scope_id = 6273364}}
dst_su = {s = {sa_family = 0,
sa_data = "\000\000\000\000\000\000\000\221\251\245-\325a#"},
sin = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\221\251\245-\325a#"}, sin6 = {sin6_family = 0,
sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {__in6_u = {
__u6_addr8 = "\000\221\251\245-\325a#\000\000\000\000\000\000\000", __u6_addr16 = {37120, 42409, 54573, 9057, 0, 0, 0, 0}, __u6_addr32 = {
2779353344, 593614125, 0, 0}}}, sin6_scope_id = 2932582632}}
__FUNCTION__ = "tcp_read_req"
#11 0x00000000005e88f7 in handle_io (fm=0x7f5ece67d378, idx=idx@entry=49,
event_type=event_type@entry=1) at net/net_tcp_proc.c:251
ret = 0
n = <optimized out>
con = 0x7f5eaed175f8
s = 309
rw = <optimized out>
resp = <optimized out>
response = {140044726089208, 1}
__FUNCTION__ = "handle_io"
#12 0x00000000005ea88b in io_wait_loop_epoll (h=<optimized out>,
t=<optimized out>, repeat=<optimized out>) at net/../io_wait_loop.h:280
ep_event = {events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}
ret = <optimized out>
n = 1
r = 49
e = <optimized out>
fd = <optimized out>
i = <optimized out>
#13 tcp_worker_proc_loop () at net/net_tcp_proc.c:396
__FUNCTION__ = "tcp_worker_proc_loop"
#14 0x00000000005f87fb in tcp_start_processes (
chd_rank=chd_rank@entry=0x998104 <chd_rank>,
startup_done=startup_done@entry=0x0) at net/net_tcp.c:1909
r = 31
reader_fd = {203, 205}
pid = <optimized out>
__FUNCTION__ = "tcp_start_processes"
#15 0x000000000041d343 in main_loop () at main.c:790
startup_done = 0x0
chd_rank = 48
rc = <optimized out>
#16 main (argc=<optimized out>, argv=<optimized out>) at main.c:1442
cfg_stream = <optimized out>
c = <optimized out>
r = <optimized out>
tmp = 0x7ffd44973ee1 ""
tmp_len = <optimized out>
port = <optimized out>
proto = <optimized out>
protos_no = <optimized out>
options = 0x639290 "f:cCm:M:b:l:n:N:rRvdDFEVhw:t:u:g:P:G:W:o:"
ret = -1
seed = 1514354603
__FUNCTION__ = "main"
OS/environment information
- Operating System: Ubuntu 16.04.6 LTS
- OpenSIPS installation: github latest "2.4" branch
Additional context
Seems to be the same issue as reported mid-March in OpenSIPS-Users "Re: segfault at the opensips 2.4.5 (Liviu Chircu) (Johan De Clercq)".