Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 834491 - net-libs/pjproject-2.10-r2: version bump or patch needed for net-misc/asterisk-18.10.0
Summary: net-libs/pjproject-2.10-r2: version bump or patch needed for net-misc/asteris...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Jaco Kroon
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-03-02 15:52 UTC by George Diamantopoulos
Modified: 2022-07-21 18:05 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
asterisk module configuration on startup (ast-modules.txt,1.80 KB, text/plain)
2022-06-24 11:26 UTC, George Diamantopoulos
Details
backtrace from crash after loading res_pjsip_outbound_registration.so (thread-apply-all-bt-full.txt,88.16 KB, text/plain)
2022-06-24 11:26 UTC, George Diamantopoulos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description George Diamantopoulos 2022-03-02 15:52:11 UTC
Hello,

net-misc/asterisk-18.10.0 lists pjproject>2.9 as a dependency, but it appears it will only work with certain features backported from newer versions (upstream bundles 2.10 with patches) or the newer version incorporating those features themselves.

As discussed in #833765, it would be convenient to either include this patch with, say, an ebuild for 2.10-r3 (compiles cleanly):

https://raw.githubusercontent.com/asterisk/asterisk/7728210352944d323a4189deba31c67105adcefd/third-party/pjproject/patches/0130-sip_inv-Additional-multipart-support-2919-2920.patch

, or provide an ebuild for 2.12 which was released a few days ago. Thanks!

Reproducible: Always
Comment 1 Jaco Kroon 2022-03-03 07:40:57 UTC
I am seeing the emails here.  I am dealing with another crises so this will only be attended next week earliest from my side.

If someone wants to jump in with a PR so long, a few notes:

It seems older (ast 13) won't compile against newer pjproject.  So exact versions will need to be determined, and dependencies updated accordingly on asterisk side.

Potentially pjproject needs to be SLOTed but out of hand I don't think this makes sense or is sensible (asterisk is the only consumer).  Also don't think there is a simple way to SLOT it.  pjproject is designed to be embedded, we're really pushing things here.
Comment 2 Florian Evers 2022-05-31 21:13:08 UTC
Hello,

I confirm that the patch mentioned by George works here as well. Furthermore, I tried to build an ebuild for pjproject-2.12.1. None of the patches provided in the "files" directory could be applied, but after disabling all of them both pjproject and asterisk compiled. However, SSL support is missing without the corresponding patch, and I'm missing the skills to edit those two configure scripts by myself.

As I need TLS support, I'm staying with pjproject-2.10-r3 for now, hoping for an updated ebuild in the future :-)

Thanks for your efforts,
Florian
Comment 3 Jaco Kroon 2022-06-01 15:48:10 UTC
Hi All,

Thanks for the patience.  I promise I'll get to this in the next few days.  It's been an absolute storm on this side, and we're prepping for power upgrades in the DC tomorrow night, which has consumed much of my time.

Kind Regards,
Jaco
Comment 4 Larry the Git Cow gentoo-dev 2022-06-15 13:32:13 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74bc4476b50218718af7c43038176f1d69c50e61

commit 74bc4476b50218718af7c43038176f1d69c50e61
Author:     Jaco Kroon <jaco@uls.co.za>
AuthorDate: 2021-07-24 08:36:57 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-06-15 13:32:11 +0000

    net-libs/pjproject: Version 2.12.1.
    
    Upstream release.
    
    Remove the need for custom patches (which is still required but no
    longer applies, instead, rely on ./configure detecting openssl, we do
    depend on it, and only --disable-ssl works, passing --enable-ssl also
    effectively disables ssl).
    
    Compile tested asterisk 13, 16 and 18 (in-tree versions) against this.
    Would appreciate a double-check on this one.  One version from each is
    sufficient.
    
    Since the two libraries that were the target of parallel build failures
    are now one, I believe the parallel build issue is fixed too.
    
    Included patch for CVE-2022-31031
    
    Closes: https://bugs.gentoo.org/833765
    Closes: https://bugs.gentoo.org/817803
    Closes: https://bugs.gentoo.org/808099
    Closes: https://bugs.gentoo.org/834491
    Bug: https://bugs.gentoo.org/803614
    Bug: https://bugs.gentoo.org/765799
    Bug: https://bugs.gentoo.org/829894
    Package-Manager: Portage-3.0.20, Repoman-3.0.2
    Signed-off-by: Jaco Kroon <jaco@uls.co.za>
    Closes: https://github.com/gentoo/gentoo/pull/21761
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 net-libs/pjproject/Manifest                        |   1 +
 .../files/pjproject-2.12.1-CVE-2022-31031.patch    |  41 +++++++
 net-libs/pjproject/pjproject-2.12.1.ebuild         | 125 +++++++++++++++++++++
 3 files changed, 167 insertions(+)
Comment 5 Florian Evers 2022-06-15 23:01:15 UTC
Hi,

thanks for your efforts! I really appreciate that.

A first feedback after an update: in this combination

net-libs/pjproject-2.12.1
net-misc/asterisk-18.10.0-r1

... asterisk now dies with a segmentation fault on startup.

As it is late, I just can provide a rough backtrace for now... more info tomorrow.

powerstation asterisk # gdb /usr/sbin/asterisk                                              
GNU gdb (Gentoo 11.2 vanilla) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/asterisk...
Reading symbols from /usr/lib/debug//usr/sbin/asterisk.debug...
(No debugging symbols found in /usr/lib/debug//usr/sbin/asterisk.debug)
(gdb) r -C /etc/asterisk/asterisk.conf -f -U asterisk
Starting program: /usr/sbin/asterisk -C /etc/asterisk/asterisk.conf -f -U asterisk
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff7581640 (LWP 22510)]
PBX UUID: 0f0c55bd-5d49-4d10-96e9-af8c248980c2
[New Thread 0x7ffff7504640 (LWP 22511)]
[New Thread 0x7ffff7487640 (LWP 22512)]
[New Thread 0x7ffff740a640 (LWP 22513)]
[New Thread 0x7ffff738d640 (LWP 22514)]
[New Thread 0x7ffff7310640 (LWP 22515)]
[New Thread 0x7ffff7293640 (LWP 22516)]
[New Thread 0x7ffff7216640 (LWP 22517)]
[New Thread 0x7ffff7199640 (LWP 22518)]
[New Thread 0x7ffff711c640 (LWP 22519)]
[New Thread 0x7ffff709f640 (LWP 22520)]
[New Thread 0x7ffff7022640 (LWP 22521)]
[New Thread 0x7ffff6fa5640 (LWP 22522)]
[New Thread 0x7ffff6f28640 (LWP 22523)]
[New Thread 0x7ffff6eab640 (LWP 22524)]
[New Thread 0x7ffff6e2e640 (LWP 22525)]
[New Thread 0x7ffff6db1640 (LWP 22526)]
[New Thread 0x7ffff6d34640 (LWP 22527)]
[Jun 16 00:58:31] NOTICE[22502]: loader.c:2389 load_modules: 293 modules will be loaded.
[New Thread 0x7ffff5640640 (LWP 22535)]
[New Thread 0x7ffff55c3640 (LWP 22536)]
[New Thread 0x7ffff5546640 (LWP 22537)]
[New Thread 0x7ffff54c9640 (LWP 22538)]
[Jun 16 00:58:35] NOTICE[22502]: cdr.c:4524 cdr_toggle_runtime_options: CDR simple logging enabled.
[Jun 16 00:58:35] NOTICE[22502]: dnsmgr.c:493 do_reload: Managed DNS entries will be refreshed every 30 seconds.
[New Thread 0x7ffff544c640 (LWP 22539)]
[New Thread 0x7ffff53cf640 (LWP 22540)]
[New Thread 0x7ffff5352640 (LWP 22541)]
[New Thread 0x7ffff4fd3640 (LWP 22542)]
[New Thread 0x7ffff47d2640 (LWP 22543)]
[New Thread 0x7ffff4755640 (LWP 22544)]
[New Thread 0x7ffff46d8640 (LWP 22545)]
[New Thread 0x7ffff465b640 (LWP 22546)]
[New Thread 0x7ffff45de640 (LWP 22547)]
[New Thread 0x7ffff4561640 (LWP 22548)]
[New Thread 0x7ffff44e4640 (LWP 22549)]
[New Thread 0x7ffff4467640 (LWP 22550)]
[New Thread 0x7ffff436d640 (LWP 22552)]
[New Thread 0x7ffff43ea640 (LWP 22551)]
[New Thread 0x7ffff42f0640 (LWP 22553)]
[New Thread 0x7fff8ebfe640 (LWP 22554)]
[New Thread 0x7ffff4273640 (LWP 22555)]
[New Thread 0x7ffff41f6640 (LWP 22556)]
[New Thread 0x7ffff4179640 (LWP 22557)]
[New Thread 0x7ffff40fc640 (LWP 22558)]
[New Thread 0x7ffff407f640 (LWP 22559)]
[Jun 16 00:58:36] NOTICE[22502]: confbridge/conf_config_parser.c:2376 verify_default_profiles: Adding default_menu menu to app_confbridge
[New Thread 0x7fff8e3fd640 (LWP 22560)]
[New Thread 0x7fff8e380640 (LWP 22561)]
[Jun 16 00:58:36] NOTICE[22502]: cel_custom.c:92 load_config: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[New Thread 0x7fff8e303640 (LWP 22562)]
[New Thread 0x7fff8e286640 (LWP 22563)]
[New Thread 0x7fff8e209640 (LWP 22564)]
[New Thread 0x7fff8e18c640 (LWP 22565)]
[New Thread 0x7fff8e10f640 (LWP 22566)]
[New Thread 0x7fff8e092640 (LWP 22567)]
[New Thread 0x7fff8e015640 (LWP 22568)]
[New Thread 0x7fff8df98640 (LWP 22569)]
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'res_monitor' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 21. Its replacement is 'app_mixmonitor'.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'res_adsi' has been loaded but may be removed in a future release.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'cdr_mysql' has been loaded but was deprecated in Asterisk version 1.8 and will be removed in Asterisk version 19. Its replacement is 'cdr_adaptive_odbc'.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_mysql' has been loaded but was deprecated in Asterisk version 1.8 and will be removed in Asterisk version 19. Its replacement is 'func_odbc'.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'res_pktccops' has been loaded but will be deprecated in Asterisk version 19 and will be removed in Asterisk version 21.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_url' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_nbscat' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_image' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_ices' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_getcpeid' has been loaded but may be removed in a future release.
[Jun 16 00:58:36] WARNING[22502]: loader.c:2487 load_modules: Module 'app_adsiprog' has been loaded but may be removed in a future release.
Asterisk Ready.

Thread 28 "asterisk" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff47d2640 (LWP 22543)]
0x00007ffff5c0ecca in filter_on_tx_message () from /usr/lib64/asterisk/modules/res_pjsip.so
(gdb) 
(gdb) 
(gdb) 
(gdb) bt
#0  0x00007ffff5c0ecca in filter_on_tx_message () from /usr/lib64/asterisk/modules/res_pjsip.so
#1  0x00007ffff5b5eef6 in endpt_on_tx_msg () from /usr/lib64/libpjsip.so.2
#2  0x00007ffff5b65ac5 in pjsip_transport_send () from /usr/lib64/libpjsip.so.2
#3  0x00007ffff5b62e01 in pjsip_endpt_send_response () from /usr/lib64/libpjsip.so.2
#4  0x00007ffff5b62f3f in pjsip_endpt_send_response2 () from /usr/lib64/libpjsip.so.2
#5  0x00007ffff5c0d7e3 in authenticate () from /usr/lib64/asterisk/modules/res_pjsip.so
#6  0x00007ffff5b5fd7b in pjsip_endpt_process_rx_data () from /usr/lib64/libpjsip.so.2
#7  0x00007ffff5c0b30f in distribute () from /usr/lib64/asterisk/modules/res_pjsip.so
#8  0x00005555556e4554 in ast_taskprocessor_execute ()
#9  0x00005555556eacb8 in execute_tasks ()
#10 0x00005555556e4554 in ast_taskprocessor_execute ()
#11 0x00005555556eb2e7 in worker_start ()
#12 0x00005555556f1afe in dummy_start ()
#13 0x00007ffff7668797 in start_thread () from /lib64/libc.so.6
#14 0x00007ffff76eb44c in clone3 () from /lib64/libc.so.6
(gdb)

Regards,
Florian
Comment 6 Florian Evers 2022-06-16 11:20:02 UTC
Hi!

More info...  enabled debug info and saw, in total, three different crash types.
My handcrafted "pjproject-2.10-r3" works without issues (yes, I recompile asterisk each time I change pjproject).

First crash type, without debug info (unfortunately):
---

Thread 30 "asterisk" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff46d8640 (LWP 31040)]
0x00007ffff6270520 in find_entry () from /usr/lib64/libpj.so.2
(gdb) bt
#0  0x00007ffff6270520 in find_entry () from /usr/lib64/libpj.so.2
#1  0x00007ffff62709db in pj_hash_get () from /usr/lib64/libpj.so.2
#2  0x00007ffff5bf4280 in ast_sip_dict_get () from /usr/lib64/asterisk/modules/res_pjsip.so
#3  0x00007ffff5c0eb60 in filter_on_tx_message () from /usr/lib64/asterisk/modules/res_pjsip.so
#4  0x00007ffff5b5ef16 in endpt_on_tx_msg () from /usr/lib64/libpjsip.so.2
#5  0x00007ffff5b65ac5 in pjsip_transport_send () from /usr/lib64/libpjsip.so.2
#6  0x00007ffff5b609f3 in stateless_send_transport_cb () from /usr/lib64/libpjsip.so.2
#7  0x00007ffff5c1824e in sip_resolve () from /usr/lib64/asterisk/modules/res_pjsip.so
#8  0x00007ffff5b628ef in pjsip_endpt_send_request_stateless () from /usr/lib64/libpjsip.so.2
#9  0x00007ffff5b748d8 in tsx_send_msg.part () from /usr/lib64/libpjsip.so.2
#10 0x00007ffff5b751ec in tsx_on_state_null () from /usr/lib64/libpjsip.so.2
#11 0x00007ffff5b779b7 in pjsip_tsx_send_msg () from /usr/lib64/libpjsip.so.2
#12 0x00007ffff5b77eae in pjsip_endpt_send_request () from /usr/lib64/libpjsip.so.2
#13 0x00007ffff5bf1bb0 in endpt_send_request.constprop () from /usr/lib64/asterisk/modules/res_pjsip.so
#14 0x00007ffff5bf4c7f in ast_sip_send_out_of_dialog_request () from /usr/lib64/asterisk/modules/res_pjsip.so
#15 0x00007ffff5942ff8 in send_unsolicited_mwi_notify_to_contact () from /usr/lib64/asterisk/modules/res_pjsip_mwi.so
#16 0x00005555555bf4eb in internal_ao2_traverse ()
#17 0x00005555555bfa2c in __ao2_callback ()
#18 0x00007ffff5943370 in send_unsolicited_mwi_notify () from /usr/lib64/asterisk/modules/res_pjsip_mwi.so
#19 0x00007ffff5943b41 in send_mwi_notify () from /usr/lib64/asterisk/modules/res_pjsip_mwi.so
#20 0x00007ffff5943c39 in serialized_notify () from /usr/lib64/asterisk/modules/res_pjsip_mwi.so
#21 0x00005555556e4554 in ast_taskprocessor_execute ()
#22 0x00005555556eacb8 in execute_tasks ()
#23 0x00005555556e4554 in ast_taskprocessor_execute ()
#24 0x00005555556eb2e7 in worker_start ()
#25 0x00005555556f1afe in dummy_start ()
#26 0x00007ffff7668797 in start_thread () from /lib64/libc.so.6
#27 0x00007ffff76eb44c in clone3 () from /lib64/libc.so.6
(gdb) 



Second crash type:
---

Thread 28 "asterisk" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff47d2640 (LWP 5999)]
0x00007ffff775a6b6 in __memcmp_sse4_1 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff775a6b6 in __memcmp_sse4_1 () from /lib64/libc.so.6
#1  0x00007ffff627dba2 in pj_memcmp (size=11, buf2=<optimized out>, buf1=<optimized out>) at ../include/pj/string.h:826
#2  pj_strcmp (str1=str1@entry=0x7ffff47d1a28, str2=<optimized out>) at ../include/pj/string_i.h:173
#3  0x00007ffff5c0ed53 in filter_on_tx_message (tdata=0x7fff800039b8) at res_pjsip/pjsip_message_filter.c:264
#4  0x00007ffff5b5ef16 in endpt_on_tx_msg (endpt=<optimized out>, tdata=0x7fff800039b8) at ../src/pjsip/sip_endpoint.c:1116
#5  0x00007ffff5b65ac5 in pjsip_transport_send (tr=0x7fff88012df8, tdata=tdata@entry=0x7fff800039b8, addr=addr@entry=0x7fff80003ba8, addr_len=addr_len@entry=16, token=token@entry=0x7fff880100a8, 
    cb=cb@entry=0x7ffff5b60830 <stateless_send_transport_cb>) at ../src/pjsip/sip_transport.c:936
#6  0x00007ffff5b609f3 in stateless_send_transport_cb (token=0x7fff880100a8, tdata=0x7fff800039b8, sent=<optimized out>) at ../src/pjsip/sip_util.c:1277
#7  0x00007ffff5c16c0d in sip_resolve_invoke_user_callback (data=0x7fff88011268) at res_pjsip/pjsip_resolver.c:206
#8  0x00005555556e4554 in ast_taskprocessor_execute (tps=tps@entry=0x555556396750) at taskprocessor.c:1235
#9  0x00005555556eacb8 in execute_tasks (data=0x555556396750) at threadpool.c:1350
#10 0x00005555556e4554 in ast_taskprocessor_execute (tps=0x5555564f1850) at taskprocessor.c:1235
#11 0x00005555556eb2e7 in threadpool_execute (pool=0x5555564eb940) at threadpool.c:367
#12 worker_active (worker=0x7fff90000bd0) at threadpool.c:1137
#13 worker_start (arg=arg@entry=0x7fff90000bd0) at threadpool.c:1056
#14 0x00005555556f1afe in dummy_start (data=<optimized out>) at utils.c:1574
#15 0x00007ffff7668797 in start_thread () from /lib64/libc.so.6
#16 0x00007ffff76eb44c in clone3 () from /lib64/libc.so.6
(gdb)




Third crash type:
---

Asterisk Ready.

Thread 28 "asterisk" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff47d2640 (LWP 6783)]
0x00007ffff6270520 in find_entry (pool=pool@entry=0x0, ht=0x100000001, key=key@entry=0x7ffff5c27233, keylen=12, keylen@entry=4294967295, val=val@entry=0x0, hval=hval@entry=0x7ffff47d1964, entry_buf=0x0, lower=0) at ../src/pj/hash.c:164
164     ../src/pj/hash.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff6270520 in find_entry (pool=pool@entry=0x0, ht=0x100000001, key=key@entry=0x7ffff5c27233, keylen=12, keylen@entry=4294967295, val=val@entry=0x0, hval=hval@entry=0x7ffff47d1964, entry_buf=0x0, 
    lower=0) at ../src/pj/hash.c:164
#1  0x00007ffff62709db in pj_hash_get (ht=<optimized out>, key=key@entry=0x7ffff5c27233, keylen=keylen@entry=4294967295, hval=hval@entry=0x7ffff47d1964) at ../src/pj/hash.c:217
#2  0x00007ffff5bf4280 in ast_sip_dict_get (ht=<optimized out>, key=key@entry=0x7ffff5c27233 "restrictions") at res_pjsip.c:5411
#3  0x00007ffff5c0eb60 in filter_on_tx_message (tdata=0x7fff8800b088) at res_pjsip/pjsip_message_filter.c:228
#4  0x00007ffff5b5ef16 in endpt_on_tx_msg (endpt=<optimized out>, tdata=0x7fff8800b088) at ../src/pjsip/sip_endpoint.c:1116
#5  0x00007ffff5b65ac5 in pjsip_transport_send (tr=0x7fff8800f4e8, tdata=tdata@entry=0x7fff8800b088, addr=addr@entry=0x7fff8800b278, addr_len=addr_len@entry=16, token=token@entry=0x7fff8800c608, 
    cb=cb@entry=0x7ffff5b60830 <stateless_send_transport_cb>) at ../src/pjsip/sip_transport.c:936
#6  0x00007ffff5b609f3 in stateless_send_transport_cb (token=0x7fff8800c608, tdata=0x7fff8800b088, sent=<optimized out>) at ../src/pjsip/sip_util.c:1277
#7  0x00007ffff5c16c0d in sip_resolve_invoke_user_callback (data=0x7fff8800d7c8) at res_pjsip/pjsip_resolver.c:206
#8  0x00005555556e4554 in ast_taskprocessor_execute (tps=tps@entry=0x5555564a76b0) at taskprocessor.c:1235
#9  0x00005555556eacb8 in execute_tasks (data=0x5555564a76b0) at threadpool.c:1350
#10 0x00005555556e4554 in ast_taskprocessor_execute (tps=0x5555564ef030) at taskprocessor.c:1235
#11 0x00005555556eb2e7 in threadpool_execute (pool=0x5555564ed740) at threadpool.c:367
#12 worker_active (worker=0x7fff90000bd0) at threadpool.c:1137
#13 worker_start (arg=arg@entry=0x7fff90000bd0) at threadpool.c:1056
#14 0x00005555556f1afe in dummy_start (data=<optimized out>) at utils.c:1574
#15 0x00007ffff7668797 in start_thread () from /lib64/libc.so.6
#16 0x00007ffff76eb44c in clone3 () from /lib64/libc.so.6
(gdb)



[I] net-misc/asterisk
     Verfügbare Versionen:   13.38.3-r3(0/13) 16.22.0-r1(0/16) (~)16.23.0-r1(0/16) (~)16.24.0-r1(0/16) 18.8.0-r1(0/18) (~)18.9.0-r1(0/18) (~)18.10.0-r1(0/18) {alsa blocks bluetooth calendar +caps cluster codec2 curl dahdi debug deprecated doc freetds gtalk http iconv ilbc ldap lua mysql newt odbc oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog systemd unbound vorbis xmpp LUA_SINGLE_TARGET="lua5-1 lua5-3 lua5-4" VOICEMAIL_STORAGE="+file imap odbc"}
     Installierte Versionen: 18.10.0-r1(0/18)(13:13:50 16.06.2022)(caps iconv mysql pjproject span ssl -alsa -blocks -bluetooth -calendar -cluster -codec2 -curl -dahdi -debug -deprecated -doc -freetds -gtalk -http -ilbc -ldap -lua -newt -odbc -oss -portaudio -postgres -radius -selinux -snmp -speex -srtp -static -statsd -syslog -systemd -unbound -vorbis -xmpp LUA_SINGLE_TARGET="lua5-1 -lua5-3 -lua5-4" VOICEMAIL_STORAGE="-imap -odbc")
     Startseite:             https://www.asterisk.org/
     Beschreibung:           Asterisk: A Modular Open Source PBX System

[I] net-libs/pjproject
     Verfügbare Versionen:   2.10-r1(0/2.10) 2.10-r2(0/2.10) 2.10-r3(0/2.10)[1] (~)2.12.1(0/2.12.1) {alsa amr debug epoll examples ffmpeg g711 g722 g729 g7221 gsm ilbc ipv6 l16 libyuv openh264 opus portaudio resample sdl silk speex ssl static-libs v4l2 vpx webrtc}
     Installierte Versionen: 2.12.1(0/2.12.1)(13:17:38 16.06.2022)(g722 ipv6 ssl -alsa -amr -debug -epoll -examples -ffmpeg -g711 -g729 -g7221 -gsm -ilbc -l16 -libyuv -openh264 -opus -portaudio -resample -sdl -silk -speex -static-libs -v4l2 -vpx -webrtc)
     Startseite:             https://www.pjsip.org/
     Beschreibung:           Open source SIP, Media, and NAT Traversal Library
     

Please tell me what you need... I'm going to help you as good as possible :)

Regards,
Florian
Comment 7 Jaco Kroon 2022-06-16 15:33:27 UTC
(In reply to Florian Evers from comment #6)

> Please tell me what you need... I'm going to help you as good as possible :)

"My handcrafted "pjproject-2.10-r3" works without issues"

Your hand-crafted pjproject would not go amis.

This does bump a few versions, and I've noticed asterisk is really sensitive ... wondering if using the embedded pjproject might not be a bad idea after all, even though I'd prefer not to - John?

Re-opening as plainly something isn't quite happy.

Kind Regards,
Jaco
Comment 8 George Diamantopoulos 2022-06-24 11:25:33 UTC
I'm also seeing crashes with pjproject 2.12.1. I start with a minimal set of modules (see ast-modules.txt).

Then, I do 'module load res_pjsip_outbound_registration.so' from asterisk CLI which almost immediately (and consistently) causes the crash in the BT.

I'm attaching a "thread apply all bt full" here in case it helps. I only have symbols for pjproject and asterisk at this time. This is against asterisk-18.13.0 (local ebuild).

I'm thinking a 'system-pjproject' flag would be useful here for asterisk, to control whether to build bundled pjproject (flag disabled) or use system-provided pjproject (flag enabled), similar to how e.g. firefox ebuild do for several libraries such as system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx and system-webp.
Comment 9 George Diamantopoulos 2022-06-24 11:26:01 UTC
Created attachment 787334 [details]
asterisk module configuration on startup
Comment 10 George Diamantopoulos 2022-06-24 11:26:28 UTC
Created attachment 787337 [details]
backtrace from crash after loading res_pjsip_outbound_registration.so
Comment 11 Jaco Kroon 2022-07-05 11:27:00 UTC
Hi All,

Finally managed to reproduce this, it's a bit more involved than simply loading the specific offender, need to actually have some stuff set up here.  My crash looks different though.

Even with an updated site_config.h for pjproject though, I still get this bt:

Thread 28 "asterisk" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffface3e640 (LWP 18880)]
0x00007fffaf4bd580 in ?? () from /usr/lib64/libpj.so.2
(gdb) bt
#0  0x00007fffaf4bd580 in ?? () from /usr/lib64/libpj.so.2
#1  0x00007fffaf4bda3b in pj_hash_get () from /usr/lib64/libpj.so.2
#2  0x00007fffaf1edeb1 in ast_sip_dict_get () from /usr/lib64/asterisk/modules/res_pjsip.so
#3  0x00007fffaf213e2d in filter_on_tx_message () from /usr/lib64/asterisk/modules/res_pjsip.so
#4  0x00007fffaf5bc066 in ?? () from /usr/lib64/libpjsip.so.2
#5  0x00007fffaf5c2c65 in pjsip_transport_send () from /usr/lib64/libpjsip.so.2
#6  0x00007fffaf5bdb73 in ?? () from /usr/lib64/libpjsip.so.2
#7  0x00007fffaf21f2cf in sip_resolve_invoke_user_callback () from /usr/lib64/asterisk/modules/res_pjsip.so
#8  0x0000555555760cae in ast_taskprocessor_execute ()
#9  0x000055555576b7d2 in execute_tasks ()
#10 0x0000555555760cae in ast_taskprocessor_execute ()
#11 0x000055555576905c in threadpool_execute ()
#12 0x000055555576af20 in worker_active ()
#13 0x000055555576ac6a in worker_start ()
#14 0x00005555557763c4 in dummy_start ()
#15 0x00007ffff72ea4a7 in start_thread (arg=<optimized out>) at pthread_create.c:435
#16 0x00007ffff736cbac in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

This does feel (to me at least) like a pjproject bug regardless, so someone who has a working configuration for pjproject for an outbound registration, please post it here (I'll push a new PR regardless).  Obviously remove sensitive details.  Currently I'm testing with (we have only partially migrated to pjsip as of yet):

[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss,flow
bind=0.0.0.0

[ulsvoip-reg]
type=registration
transport=transport-udp
outbound_auth=ulsvoip-auth
contact_user=0100210269
retry_interval=10
forbidden_retry_interval=600
server_uri=sip:our.realm
client_uri=sip:0123456@plastiekpoot
expiration=1800
line=yes
endpoint=ulsvoip

[ulsvoip-auth]
type=auth
auth_type=userpass
password=test-pass
username=test-user
realm=our.realm

[ulsvoip-aor]
type=aor
contact=sip:server1.uls.co.za:5060
contact=sip:server2.uls.co.za:5060
qualify_frequency=30
qualify_timeout=2.0

[ulsvoip]
type=endpoint
transport=transport-udp
context=default
disallow=all
allow=gsm
outbound_auth=ulsvoip-auth
aors=ulsvoip-aor


Failing this I think we need to shelf non-embedded pjproject though.  This is starting to get me down and causing delays in getting potentially serious problems resolved.
Comment 12 Jaco Kroon 2022-07-05 19:42:34 UTC
Would greatly appreciate an independent review of the changes at https://github.com/gentoo/gentoo/pull/26230

I'm not confident this will sort things out w.r.t. pjproject, but let's see.
Comment 13 Jaco Kroon 2022-07-11 08:40:48 UTC
Tracked this to structure changes depending on things like PJ_HAS_IPV6, so appending these using append-cflag to handle via emake is not a workable solution.  Surprised we haven't run into this earlier.  Will push an updated pjproject ebuild along with updated asterisk ebuilds momentarily, just performing final tests.

Thanks for all the inputs on this ticket, indirectly they all all helped.  As it stands I can confirm working builds for asterisk with pjproject with with USE=ipv6 and -ipv6.

Just looking to see how to trigger an asterisk rebuild if pjproject USE flag changes.
Comment 14 Jaco Kroon 2022-07-13 07:55:30 UTC
https://github.com/gentoo/gentoo/pull/26230

Can others please help test?  I've got 210 asterisk instances operational on that currently, all with uptimes in excess of 36 hours.  Not all of them use pjproject though, those that do make fairly heavy use thereof, but none of them uses outbound registrations.
Comment 15 Larry the Git Cow gentoo-dev 2022-07-13 08:01:24 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a59fa196adc0c98fbb19d56533e107ef1625b43

commit 9a59fa196adc0c98fbb19d56533e107ef1625b43
Author:     Jaco Kroon <jaco@uls.co.za>
AuthorDate: 2022-06-27 21:42:02 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-07-13 08:00:49 +0000

    net-libs/pjproject: rev bump to update config_site.h.
    
    Straight to stable:  This fixes major usability problems in 2.10
    revisions of pjproject, and asterisk 18.* depends on this (already
    stable).
    
    This brings in updates from newer versions of asterisk.
    
    Note that USE=ipv6 gets dropped as flipping this causes ABI breakage,
    and the way in which this was done could cause ABI issues as it was.
    Since there are no extra dependencies, just remove the USE flag
    completely.
    
    Also introduce _pj_ functions in the ebuild itself to manipulate the way
    in which ./configure is used (pjproject generally enables everything it
    can find dependencies for, and passing --enable-XXX generally ends up
    having the same effect as --disable ...).
    
    PENDING: ISUE=srtp.  Asterisk has patches but I don't want to figure
    that out at this stage.
    
    Bug: https://bugs.gentoo.org/834491
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Signed-off-by: Jaco Kroon <jaco@uls.co.za>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../pjproject/files/pjproject-2.12.1-config_site.h | 97 ++++++++++++++++++++++
 ...ct-2.12.1.ebuild => pjproject-2.12.1-r1.ebuild} | 29 +++++--
 2 files changed, 119 insertions(+), 7 deletions(-)
Comment 16 Florian Evers 2022-07-13 18:40:35 UTC
Hi Jaco,

thank you very much! I just updated my setup to net-libs/pjproject-2.12.1-r1 and net-misc/asterisk-18.13.0 and it works... at least for a few minutes now without any issues.

- Multiple outgoing registrations (Telekom with multiple numbers)
- Multiple incloming registrations (DECT base station with multiple head sets)

Incoming and outgoing calls are routed properly and sound works! No warnings, errors, or crashes.

Great work! :-)

Regards,
Florian
Comment 17 George Diamantopoulos 2022-07-14 03:04:57 UTC
Looks good here too. Thanks!
Comment 18 Jaco Kroon 2022-07-21 18:05:19 UTC
Thanks, not sure how I missed the feedback.  Closing based on that.  If anyone gets stuck, please log a new bug with the specific problem (eg, the USE=ssl compile failure in https://bugs.gentoo.org/show_bug.cgi?id=859556).