From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster 3/3] pmxcfs: enable QB log thread
Date: Thu, 1 Oct 2020 10:53:26 +0200 [thread overview]
Message-ID: <20201001085326.3815261-4-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20201001085326.3815261-1-f.gruenbichler@proxmox.com>
since pmxcfs is a multi-threaded application, and `man qblog.h`
explicitly states:
Thread safe non-blocking logging.
Logging is only thread safe when threaded logging is in use. If you
plan on logging from multiple threads, you must initialize libqb's
logger thread and use qb_log_filter_ctl to set the QB_LOG_CONF_THREADED
flag on all the logging targets in use.
without this we can lose log messages under high load, especially when
enabling debug mode to trouble-shoot issues.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
this would have saved Alexandre and me quite a bit of back and forth and false
leads ;)
data/src/pmxcfs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/data/src/pmxcfs.c b/data/src/pmxcfs.c
index 00aa53d..3146121 100644
--- a/data/src/pmxcfs.c
+++ b/data/src/pmxcfs.c
@@ -1005,8 +1005,13 @@ int main(int argc, char *argv[])
}
} else {
write_pidfile(getpid());
+ // foreground == STDERR logging enabled, make it threaded
+ qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_THREADED, QB_TRUE);
}
+ qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_THREADED, QB_TRUE);
+ qb_log_thread_start();
+
wrote_pidfile = TRUE;
cfs_loop_t *corosync_loop = cfs_loop_new(fuse);
--
2.20.1
next prev parent reply other threads:[~2020-10-01 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 8:53 [pve-devel] [PATCH cluster 0/3] logging improvements Fabian Grünbichler
2020-10-01 8:53 ` [pve-devel] [RFC cluster 1/3] pmxcfs: switch log domain to enum Fabian Grünbichler
2020-10-01 8:53 ` [pve-devel] [PATCH cluster 2/3] pmxcfs: set log domain in more places Fabian Grünbichler
2020-10-01 8:53 ` Fabian Grünbichler [this message]
2021-04-22 19:45 ` [pve-devel] [PATCH cluster 0/3] logging improvements Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201001085326.3815261-4-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox