We've been seeing crashes in libbfd when we attempt to generate
a stack trace from multiple threads. It turns out that libbfd
is NOT thread-safe. It can cache the bfd structure and give it to
multiple threads without protecting itself. To get around this,
we've added a global mutex around the bfd functions and also have
refactored the use of those functions to be more efficient and
to provide more information about inlined functions.
Also added a few more tests to test_pbx.c. One just calls
ast_assert() and the other calls ast_log_backtrace(). Neither are
run by default.
WARNING: This change necessitated changing the return value of
ast_bt_get_symbols() from an array of strings to a VECTOR of
strings. However, the use of this function outside Asterisk is not
likely.
ASTERISK-28140
Change-Id: I79d02862ddaa2423a0809caa4b3b85c128131621
When a subscribe or unsubscribe occurs a message is published
containing this information. This change makes it so that the
message no longer uses stringfields or a lock, as both are not
really needed for the message.
Change-Id: I3f4831931d79f94fd979baf48048738df5dc1632
This change adds the ability for subscriptions to indicate
which message types they are interested in accepting. By
doing so the filtering is done before being dispatched
to the subscriber, reducing the amount of work that has
to be done.
This is optional and if a subscriber does not add
message types they wish to accept and set the subscription
to selective filtering the previous behavior is preserved
and they receive all messages.
There is also the ability to explicitly force the reception
of all messages for cases such as AMI or ARI where a large
number of messages are expected that are then generically
converted into a different format.
ASTERISK-28103
Change-Id: I99bee23895baa0a117985d51683f7963b77aa190
Task processors are retrieved using a 'get or create' pattern. The
singleton container was unlocked between the get and create steps so
it's possible that two threads could create task processors with the
same name at the same time.
Change-Id: Id64fae94a6a1e940ddf38fde622dcd4391635382
We cannot use need_el_end and SIGURG when restarting. Instead we need
to run el_end within the SIGHUP restartnow handler.
ASTERISK-28158
Change-Id: Ia852276363c81bdcf1aa29eb4558c5c2fa1218a0
When dn_expand was being called on SRV and NAPTR results, the
return value was being used to calculate the size of the buffer
needed to store the host names. Since dn_expand returns the
length of the COMPRESSED name the buffer could be too short
to hold the EXPANDED name. The expanded name is NULL terminated
so using strlen() is the correct way to determine the length
actually needed for the buffer.
ASTERISK-28127
Reported by: Jan Hoffmann
patches:
patch.diff submitted by janhoffmann (license 6986)
Change-Id: I4d35d6c431c6c6836cb61d37b1378cc47f0b414d
Merge storage for the stats object and name string into the main
allocation for struct ast_taskprocessor.
Change-Id: I74fe9a7f357f0e6d63152f163cf5eef6428218e1
* Ignore console=yes configuration option in remote console processes.
* Use new flag to tell consolethread to run el_end and exit when needed.
ASTERISK-28158
Change-Id: I9e23b31d4211417ddc88c6bbfd83ea4c9f3e5438
Default logging was not setup correctly when there was no logger.conf.
This resulted in many expected log messages not actually getting out to
the console.
Change-Id: I542e61c03b2f630ff5327f9de5641d776c6fa70c
Adding the "label" attribute used for participant info correlation
was previously done in app_confbridge but it wasn't working
correctly because it didn't have knowledge about which video
streams belonged to which channel. Only bridge_softmix has that
data so now it's set when the bridge topology is changed.
ASTERISK-28107
Change-Id: Ieddeca5799d710cad083af3fcc3e677fa2a2a499
These macros have been documented as legacy for a long time but are
still used in new code because they exist. Remove all references to:
* ao2_container_alloc_options
* ao2_t_container_alloc_options
* ao2_t_container_alloc
These macro's are also removed. Only ao2_container_alloc remains due to
it's use in over 100 places.
Change-Id: I1a26258b5bf3deb081aaeed11a0baa175c933c7a
__ast_mutex_logger used the variable `canlog` without accepting it as a
argument. Replace with internal macro `log_mutex_error` which takes
canlog as the first arguement. This will prevent confusion when working
with lock.c code, many of the function declare the canlog variable and
in some cases it previously appeared to be unused.
Change-Id: I83b372cb0654c5c18eadc512f65a57fa6c2e9853
Most were in comments. A couple were in warning messages.
Pointed out by Jonathan H on the Asterisk users mailing list.
Change-Id: I6286939dff5d0a27a2758140570106f1cb351855
Add attribute_warn_unused_result to ast_taskprocessor_push,
ast_taskprocessor_push_local and ast_threadpool_push. This will help
ensure we perform the necessary cleanup upon failure.
Change-Id: I7e4079bd7b21cfe52fb431ea79e41314520c3f6d
This allows us to process AO2 statistics for total objects, memory
usage, memory overhead and lock usage.
* Install refstats.py and reflocks.py into the Asterisk scripts folder.
* Enable support for reflocks.py without DEBUG_THREADS.
Steal a bit from the ao2 magic to flag when an object lock is used.
Remove 'lockobj' from reflocks.py since we can now record 'used' or
'unused' for those objects.
Add comments to explain thread safety of the 'struct __priv_data'
bitfields.
Change-Id: I84e9d679cc86d772cc97c888d9d856a17e0d3a4a
thread_worker_pair, set_size_data and task_pushed_data structures are
allocated with AO2 objects, passed to a taskprocessor, then released.
They never have multiple owners or use locking so AO2 only adds
overhead.
Change-Id: I2204d2615d9d952670fcb48e0a9c0dd1a6ba5036
The field used to store call arguments was not large enough to hold the
arguments string that can be constructed for 'open'. Expand it to
prevent this warning/error.
Change-Id: I514927f256481bc84df10a51b19d5b5fb1bc387e
ast_sendtext_data() would create an incorrect T.140 text frame which
length include the null terminator byte. It causes ultimately RTP
packets to be send with this trailing 0. The proposed fix just set the
correct length to the text frame
ASTERISK-28089
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU
Change-Id: I7ab1b9ed1e21683b2b667ea0a59d9aba3c77dd96
This has no effect on startup since AST_MODULE_LOAD_FAILURE aborts
startup, but it's possible for this code to be returned on manual load
of a module after startup.
It is an error for a module to not have a load callback but this is not
a fatal system error. In this case flag the module as declined, return
AST_MODULE_LOAD_FAILURE only if a required module is broken.
Expand doxygen documentation for AST_MODULE_LOAD_*.
Change-Id: I3c030bb917f6e5a0dfd9d91491a4661b348cabf8
There is currently no way to indicate to Asterisk that TLS certificates
and/or keys have been updated other than by modifying http.conf or
restarting Asterisk.
There is already code in main/tcptls.c that determines if a reload is
actually necessary based on the hashes of the certicate and dependent
files, so this change merely gives us a way to request a reload without
explicitly modifying http.conf.
Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276
* ACO options
* Indications
* Module loader ref_debug object
* Media index info and variants
* xmldoc items
These allocation locations were identified using reflocks.py on the
master branch.
Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
When a module reload fails we never set AST_MODULE_RELOAD_ERROR. This
caused reload failures to incorrectly report 'No module found'.
Change-Id: I5f3953e0f7d135e53ec797f24c97ee3f73f232e7
* Display list of unavailable dependencies when they cause another
module to fail loading.
* When a module declines to load find all modules which depend on it so
they can be declined and listed together.
* Prevent retry of declined modules during startup.
* When a module fails to dlopen try loading it with RTLD_LAZY so we can
attempt to display the list of missing dependencies.
These changes are meant to reduce logger spam that is caused when a
module has many dependencies and declines to load. This also fixes some
error paths which failed to recognize required modules.
Module load/start errors are delayed until the end of loader startup.
Change-Id: I046052c71331c556c09d39f47a3b92975f3e1758
If a channel creates an AST_TEXT_FRAME with datalen == 0, the ast_frdup()
and ast_frisolate() functions could create a clone frame with an invalid
data.ptr which would cause a crash. The proposed fix is to make sure that
for such empty text frames, ast_frdup() and ast_frisolate() return cloned
text frames with a valid data.ptr.
ASTERISK-28076
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU
Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
was ever used, so it can be recorded in the REF_DEBUG destructor entry.
Create contrib/scripts/reflocks.py to process locking used by
allocator. This can be used to identify places where
AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.
Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
Add a volatile flag to lock tracking structures so we only need to use
the global lock when first initializing tracking.
Additionally add support for DEBUG_THREADS_LOOSE_ABI. This is used by
astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is
not defined.
Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b