Scroll to the bottom for other notes
Asterisk often (but not always) segfaults on startup with res_pjsip_pubsub
loaded, due to state being PJSIP_EVSUB_STATE_NULL
.
PJPROJECT code reference: https://github.com/pjsip/pjproject/blob/5d7e2748ce6ca3f58e5310f8d7d8f78e94e4db90/pjsip/src/pjsip-simple/evsub.c#L1437-L2362
Where the exact issue lies is not currently known, but this kind of thing has been observed on and off since November 2022:
[2024-05-12 09:49:41.697] DEBUG[119882]: res_pjsip_sca.c:679 notify_task: Sent NOTIFY to 2 contacts
[2024-05-12 09:49:41.697] ERROR[119815]: res_pjsip_pubsub.c:2558 send_notify: FRACK!, Failed assertion sub_tree->evsub->dst_state != PJSIP_EVSUB_STATE_NULL (0)
[2024-05-12 09:49:42.082] ERROR[119815]: Got 13 backtrace records
# 0: asterisk __ast_assert_failed()
# 1: [0x7fb6968ce259] res_pjsip_pubsub.so utils.h:737 _ast_assert()
# 2: [0x7fb6968d4bff] res_pjsip_pubsub.so res_pjsip_pubsub.c:2559 send_notify()
# 3: [0x7fb6968d637e] res_pjsip_pubsub.so res_pjsip_pubsub.c:3046 initial_notify_task()
# 4: asterisk ast_taskprocessor_execute()
# 5: asterisk <unknown>()
# 6: asterisk ast_taskprocessor_execute()
# 7: asterisk <unknown>()
# 8: asterisk <unknown>()
# 9: asterisk <unknown>()
#10: asterisk <unknown>()
#11: [0x7fb6da41d044] libc.so.6 pthread_create.c:442 start_thread()
#12: [0x7fb6da49d61c] libc.so.6 clone3.S:83 clone3()
debian*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups
[2024-05-12 09:52:21.166] ERROR[119924]: res_pjsip_pubsub.c:2558 send_notify: FRACK!, Failed assertion sub_tree->evsub->dst_state != PJSIP_EVSUB_STATE_NULL (0)
[2024-05-12 09:52:21.166] DEBUG[119993]: res_pjsip_sca.c:620 on_tdata: Full Call-Info header: <sip:[email protected]:14444>;appearance-index=*;appearance-state=idle
[2024-05-12 09:52:21.166] DEBUG[119993]: res_pjsip_pubsub.c:3971 pubsub_on_evsub_state: evsub 0x7f8e8c0255a8 state ACTIVE event USER sub_tree 0x7f8e8c02c410 sub_tree state Normal
[2024-05-12 09:52:21.166] DEBUG[119993]: res_pjsip_pubsub.c:686 subscription_persistence_update: Updating persistence for 'PolycomSCA1->PolycomSCA1' prune on boot: no
[2024-05-12 09:52:21.167] DEBUG[119993]: res_pjsip_sca.c:679 notify_task: Sent NOTIFY to 2 contacts
[2024-05-12 09:52:21.485] ERROR[119924]: Got 13 backtrace records
# 0: asterisk __ast_assert_failed()
# 1: [0x7f8e5368c259] res_pjsip_pubsub.so utils.h:737 _ast_assert()
# 2: [0x7f8e53692bff] res_pjsip_pubsub.so res_pjsip_pubsub.c:2559 send_notify()
# 3: [0x7f8e5369437e] res_pjsip_pubsub.so res_pjsip_pubsub.c:3046 initial_notify_task()
# 4: asterisk ast_taskprocessor_execute()
# 5: asterisk <unknown>()
# 6: asterisk ast_taskprocessor_execute()
# 7: asterisk <unknown>()
# 8: asterisk <unknown>()
# 9: asterisk <unknown>()
#10: asterisk <unknown>()
#11: [0x7f8e971c9044] libc.so.6 pthread_create.c:442 start_thread()
#12: [0x7f8e9724961c] libc.so.6 clone3.S:83 clone3()
Thread 1 (Thread 0x7f14c55ba6c0 (LWP 550700)):
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
tid = <optimized out>
ret = 0
pd = <optimized out>
old_mask = {__val = {139727186681856}}
ret = <optimized out>
#1 0x00007f150b458d9f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x00007f150b409f32 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
ret = <optimized out>
#3 0x00007f150b3f4472 in __GI_abort () at ./stdlib/abort.c:79
save_stage = 1
act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {1427, 139728036857840, 18, 7, 139728036941456, 538976288, 0, 139727187188376, 9045314737401847>
#4 0x00007f150b3f4395 in __assert_fail_base (fmt=0x7f150b568a90 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n", assertion=assertion@entry=0x7f150c189b28 "sub->dst_state!=PJSIP_EVSUB_STATE_NULL", file=file@entry=0x7f150c189622 "../src/pjsip-simple/evsub.c", line=line@entry=1427, function=function@ent>
str = 0x7f14f80087f0 "^X^YO ^S\177"
total = 4096
#5 0x00007f150b402e32 in __GI___assert_fail (assertion=0x7f150c189b28 "sub->dst_state!=PJSIP_EVSUB_STATE_NULL", file=0x7f150c189622 "../src/pjsip-simple/evsub.c", line=1427, function=0x7f150c1>
#6 0x00007f150c08a233 in pjsip_evsub_send_request (sub=0x7f14f8006038, tdata=0x7f14f026d3c8) at ../src/pjsip-simple/evsub.c:1427
status = 0
__PRETTY_FUNCTION__ = "pjsip_evsub_send_request"
#7 0x00007f14c794b8a5 in sip_subscription_send_request (sub_tree=0x7f14f8003ab0, tdata=0x7f14f026d3c8) at res_pjsip_pubsub.c:2044
Per one of George's changes, all the pubsub modules should also use this format instead of always returning -1:
static int unload_module(void)
{
if (ast_shutdown_final()) {
ast_sip_unregister_subscription_handler(&feature_handler);
ast_custom_function_unregister(&features_function);
return 0;
} else {
/* Can't unload modules that call ast_sip_register_subscription_handler */
return -1;
}
}
In res_pjsip_device_features
, this can be a bitfield: unsigned int terminate:1;
Additionally, seized appearances must expire after 30 seconds, so ensure that's the case or make it so.
You must be