Move wait_shm_mmap initialization to library constructor
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 8 Mar 2019 15:01:12 +0000 (10:01 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 8 Mar 2019 15:20:41 +0000 (10:20 -0500)
commit2eab9f28f1a6a9f7e24c528a4a6418d44d370426
treee3bac0b8eac5b6a3bc833334b427eb3ef162fd7c
parentdd0b0c8a3e8a97dd0919dc890de95f88c7a7cc8d
Move wait_shm_mmap initialization to library constructor

Prevent us from deadlocking ourself if some glibc implementation
decide to hold the dl_load_* locks on fork operation.

This happens on Yocto Rocko and up when performing python tracing (import
lttngust). Why Yocto decided to patch glibc this way is a mystery
(ongoing effort) [1][2][3].

Anyhow, we can prevent this by moving the initialization of the
wait_shm_mmap to the library constructor since the dl_load_* locks are
nestable mutex.

Nothing in the git log for the wait_shm_mmap indicate a specific reason
to why it was done inside the listener thread. Doing it inside
wait_for_sessiond can help in some corner cases were /dev/shm
(or the shm path) files are unlinked. This is not much of an advantage.

[1] From yocto master branch: ee9db1a9152e8757ce4d831ff9f4472ff5a57dad
[2] From OE-Core: f2e586ebf59a9b7d5b216fc92aeb892069a4b0c1
[3] https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg101186.html

This was tested on a Yocto Rocko qemu x86-64 image with python agent
enabled.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c
This page took 0.02598 seconds and 4 git commands to generate.