ClusterLabs / ClusterLabs/libqb

[sanity] qb_log_fini should assuredly (by the means of a guard) only be called from whatever thread but the logging worker

Open
#290 0 comments 0 reactions 0 assignees View on GitHub
design
Dominant language
C
Stars
171
Forks
103
PR merge metrics
No merged PRs in 30d

Description

...which could possibly lead to deadlock or other funny moments.

This is to prevent situation like `SIGSEGV` handler, deliberately and
acceptably calling `qb_log_fini` (like corosync does) being unknowingly
arranged also for the logging worker should the SIGSEGV be raised
in its context:

"A signal may be generated (and thus pending) for a process as
a whole (e.g., when sent using kill(2)) or for a specific thread
(e.g., certain signals, such as SIGSEGV and SIGFPE, generated as
a consequence of executing a specific machine-language instruction
are thread directed, as are signals targeted at a specific thread
using pthread_kill(3)). A process-directed signal may be delivered
to any one of the threads that does not currently have the signal
blocked. If more than one of the threads has the signal unblocked,
then the kernel chooses an arbitrary thread to which to deliver the
signal." [signal(7)]

Consider, for example, that the main thread performs, sequentially,
logging to blackbox, which could possibly result in another nasty race.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.