Segfault in switch_nat_republish() occasionally
Describe the bug
-
Background: We have two machines, each runs a FreeSWITCH in it. One of these FreeSWITCH (fs A) is used to connect to the gateway, run IVR processes, and send calls that need to be transferred to agents the other FreeSWITCH (fs B). The other FreeSWITCH (fs B) is used for ACD queuing and media exchange.
-
Problem: In our recent stress test, both FreeSWITCH instances in two machines segfaulted during the stress test (but not at the same time)
-
fs A:
# dmesg -T [Thu Mar 9 12:48:09] traps: freeswitch[32301] general protection ip:7f547d8b62f5 sp:7f540eedbc50 error:0 in libfreeswitch.so.1.0.0[7f547d74d000+464000] -
fs B:
# dmesg -T [Thu Mar 9 12:23:46 2023] freeswitch[40088]: segfault at 1c0a ip 00007f1bf1491fe7 sp 00007f1a08430c30 error 4 in libc-2.17.so[7f1bf1457000+1c4000]
-
-
gdb btshowed that the error messages pointed toswitch_nat_republish () at src/switch_nat.c.
One thing that may or may not be related is that the stress tests on these two machines had always been fine, but recently our company moved to another location and the network environment changed. This is the first stress test after the move.
To Reproduce We use sipp to gen stress calls
sipp -i 172.16.23.153 -p 5062 -sf inbound_uac_makecall.xml -inf t.csv 172.16.23.219:7178 -l 300 -aa -r 40 -rp 1000 -m 100000000
Expected behavior no segfault
Package version or git hash
-
fs A
FreeSWITCH Version 1.10.7-release+git~20220530T093609Z~ffbccc71ab~64bit (git ffbccc7 2022-05-30 09:36:09Z 64bit) -
fs B
FreeSWITCH Version 1.10.7-release+git~20211024T163933Z~883d2cb662~64bit (git 883d2cb 2021-10-24 16:39:33Z 64bit)
backtrace from core file backtrace.zip
It's almost two years old, you need to upgrade to master and verify your problem first.
fixed by adding a lock on switch_nat_republish