asterisk / asterisk

The official Asterisk Project repository.
https://www.asterisk.org
Other
1.99k stars 929 forks source link

[bug]: segmentation fault without bundled pjsip #671

Open wbx-github opened 2 months ago

wbx-github commented 2 months ago

Severity

Trivial

Versions

20.7.0

Components/Modules

pjsip

Operating Environment

Hi, I am using latest Buildroot on a Raspberry PI4 (64 Bit). I am maintaining the Asterisk package for Buildroot. Linux 6.1.61 with glibc 2.38 is used.

Frequency of Occurrence

Constant

Issue Description

With the bundled pjproject Asterisk works fine in my scenario. The Buildroot policy is not to download any source code while compiling a package. So I am trying to use the external pjproject 2.14. But then Asterisk segfaults.

Relevant log output

gdb stacktrace:
(gdb) bt
#0  0x0000007fa12e4498 in strcmp () from /lib64/libc.so.6
#1  0x0000007f5bb2af84 in record_serializer (tdata=0x7f4c008f58) at res_pjsip/pjsip_distributor.c:85
#2  0x0000007f5bc856cc in endpt_on_tx_msg (endpt=0x55ab2d2b08, tdata=0x7f4c008f58) at ../src/pjsip/sip_endpoint.c:1116
#3  0x0000007f5bc8d028 in pjsip_transport_send (tr=0x55ab252748, tdata=tdata@entry=0x7f4c008f58, addr=addr@entry=0x7f4c009148, addr_len=addr_len@entry=16, token=token@entry=0x7f4c00a4e0, 
    cb=cb@entry=0x7f5bc87274 <stateless_send_transport_cb>) at ../src/pjsip/sip_transport.c:944
#4  0x0000007f5bc87480 in stateless_send_transport_cb (token=token@entry=0x7f4c00a4e0, tdata=tdata@entry=0x7f4c008f58, sent=<optimized out>) at ../src/pjsip/sip_util.c:1286
#5  0x0000007f5bc87afc in stateless_send_resolver_callback (status=<optimized out>, token=0x7f4c00a4e0, addr=<optimized out>) at ../src/pjsip/sip_util.c:1421
#6  0x0000007f5bb36c40 in sip_resolve_invoke_user_callback (data=0x7f4c00b698) at res_pjsip/pjsip_resolver.c:206
#7  0x00000055840e2180 in ast_taskprocessor_execute (tps=tps@entry=0x55ab3e59b8) at taskprocessor.c:1302
#8  0x00000055840e9080 in execute_tasks (data=0x55ab3e59b8) at threadpool.c:1350
#9  0x00000055840e2180 in ast_taskprocessor_execute (tps=0x55ab2d0e08) at taskprocessor.c:1302
#10 0x00000055840e7db4 in threadpool_execute (pool=0x55ab2d1958) at threadpool.c:367
#11 0x00000055840e7dd0 in worker_active (worker=worker@entry=0x7f50000be8) at threadpool.c:1137
#12 0x00000055840e83d0 in worker_start (arg=arg@entry=0x7f50000be8) at threadpool.c:1056
#13 0x00000055840efafc in dummy_start (data=<optimized out>) at utils.c:1607
#14 0x0000007fa12cf584 in ?? () from /lib64/libc.so.6
#15 0x0000007fa13351cc in ?? () from /lib64/libc.so.6

Asterisk Issue Guidelines

jcolp commented 2 months ago

Did this occur as a result of upgrading Asterisk? Was Asterisk actually built against the new headers? Looking at the backtrace and where it is, I would only expect such a crash if Asterisk was built against one set of headers but then used against another version or build of PJSIP.

wbx-github commented 2 months ago

I double checked with a complete rebuild. (make clean && make) The same issue happens. So this is not an update problem.

jcolp commented 2 months ago

What is the output of config.log for Asterisk?

jcolp commented 2 months ago

And what arguments were passed to pjproject for building it?

jcolp commented 2 months ago

Oh, and finally to confirm: the previous version of Asterisk was built against 2.13 and worked fine?

jcolp commented 2 months ago

I also built PJSIP 2.14 externally myself and built Asterisk 20.7.0 against it and confirmed bundled was not used. I ran outgoing call tests, which were successful and did not result in a crash.

wbx-github commented 2 months ago

Oh, and finally to confirm: the previous version of Asterisk was built against 2.13 and worked fine?

The previous version 20.6.0 and the version included in Buildroot 20.5.2 having the same issues. May be pjsip is the problem?

jcolp commented 2 months ago

I can say that I am able to build both together not using bundled, and they work on my system. This would either mean it is your build process, the arguments passed to either PJSIP or Asterisk for building, or something in PJSIP that is only impacting things for you, or some other environmental thing. It doesn't appear to be an outright failure for all.

wbx-github commented 2 months ago

Asterisk config.log asterisk.config.log

wbx-github commented 2 months ago

Pjsip config.log pjsip.config.log

jcolp commented 2 months ago

I am still unable to reproduce this, so that means it is one of the following:

  1. Something environment specific
  2. Something build process specific
  3. Something architecture specific
  4. Something in PJSIP
  5. A combination of the above
  6. Something else

There's nothing else I can add or investigate, and this is in unsupported territory. I will leave it open to see if anyone else has experience or comments.

wbx-github commented 2 months ago

The asterisk system is behind double NAT. But this works with the bundled pjsip as mentioned earlier. I am attaching my extensions.conf and pjsip.conf for completeness. May be it is this special environment. extensions.conf.txt pjsip.conf.txt