commit | 843a84c42550e71322332d9d31c4842d73241112 | [log] [tgz] |
---|---|---|
author | Pau Espin Pedrol <pespin@sysmocom.de> | Wed Nov 03 17:31:47 2021 +0100 |
committer | Pau Espin Pedrol <pespin@sysmocom.de> | Wed Nov 03 17:43:19 2021 +0100 |
tree | 514d990e0135d89c76e96cfe1cc3807deb30bff9 | |
parent | 36c69ed2564c5b7b4c9c52d278a2426e126c17e9 [diff] |
logging: Fix double lock of log_tgt_mutex Recent commit introduced the "blocking-io" param to "log stderr" VTY command, which calls log_target_file_switch_to_{stream,wqueue}. The VTY command already locks the log_tgt_mutex mutex, since it has to access the tgt list. However, the functions mention above also want to lock the same mutex in order to log information. Let's drop the logging to avoid the double lock, and update its documentation to mention it must be called with the lock already held, as documented on other similar functions. The issue can be spotted when running osmo-trx-uhd: """ (gdb) bt #0 0x00007ffff75d7600 in __lll_lock_wait () from /usr/lib/libpthread.so.0 #1 0x00007ffff75d0503 in pthread_mutex_lock () from /usr/lib/libpthread.so.0 #2 0x00007ffff66314fb in log_tgt_mutex_lock_impl () at /git/libosmocore/src/logging.c:130 #3 0x00007ffff6638e74 in log_check_level (subsys=8, subsys@entry=-1, level=level@entry=3) at /git/libosmocore/src/logging.c:1510 #4 0x00007ffff6639c91 in log_target_file_switch_to_wqueue (target=target@entry=0x611000000320) at /git/libosmocore/src/logging.c:1186 #5 0x00007ffff68565d3 in cfg_log_stderr (self=<optimized out>, vty=0x6140000018a0, argc=0, argv=<optimized out>) at /git/libosmocore/src/vty/logging_vty.c:859 #6 0x00007ffff683db3d in cmd_execute_command_strict (vline=0x60b0000dfe80, vty=vty@entry=0x6140000018a0, cmd=cmd@entry=0x0) at /git/libosmocore/src/vty/command.c:2768 7 0x00007ffff683e396 in config_from_file (vty=vty@entry=0x6140000018a0, fp=fp@entry=0x615000036400) at /git/libosmocore/src/vty/command.c:2880 8 0x00007ffff684cedb in vty_read_config_filep (confp=confp@entry=0x615000036400, priv=priv@entry=0x0) at /git/libosmocore/src/vty/vty.c:1529 9 0x00007ffff684ebfc in vty_read_config_file (file_name=0x7fffffffe7d8 "/build/new/conf/osmo-trx-uhd.cfg", priv=0x0) at /git/libosmocore/src/vty/vty.c:1920 10 0x0000555555565270 in main (argc=3, argv=0x7fffffffe3c8) at /git/osmo-trx/Transceiver52M/osmo-trx.cpp:652 """ Debugged by rebuilding libosmocore with "LOG_MTX_DEBUG 1": """ /libosmocore/src/logging.c:1510 [log_check_level] lock /libosmocore/src/logging.c:1522 [log_check_level] unlock /libosmocore/src/vty/logging_vty.c:844 [cfg_log_stderr] lock /libosmocore/src/logging.c:1510 [log_check_level] lock """ Fixes: b72867f0e68c96ca25e1f9929ce92be0a802db6b Related: OS#4311 Change-Id: Idb4215fa2f364e28c0bb73fb9975b6c9f50a46f6
This repository contains a set of C-language libraries that form the core infrastructure of many Osmocom Open Source Mobile Communications projects.
Historically, a lot of this code was developed as part of the OpenBSC project, but which are of a more generic nature and thus useful to (at least) other programs that we develop in the sphere of Free Software / Open Source mobile communications.
There is no clear scope of it. We simply move all shared code between the various Osmocom projects in this library to avoid code duplication.
The libosmocore.git repository build multiple libraries:
The official homepage of the project is https://osmocom.org/projects/libosmocore/wiki/Libosmocore
You can clone from the official libosmocore.git repository using
git clone git://git.osmocom.org/libosmocore.git
There is a cgit interface at https://git.osmocom.org/libosmocore/
Doxygen-generated API documentation is generated during the build process, but also available online for each of the sub-libraries at https://ftp.osmocom.org/api/latest/libosmocore/
Discussions related to libosmocore are happening on the openbsc@lists.osmocom.org mailing list, please see https://lists.osmocom.org/mailman/listinfo/openbsc for subscription options and the list archive.
Please observe the Osmocom Mailing List Rules when posting.
Our coding standards are described at https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards
We us a gerrit based patch submission/review process for managing contributions. Please see https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for more details
The current patch queue for libosmocore can be seen at https://gerrit.osmocom.org/#/q/project:libosmocore+status:open