Thoughts about multipathd's log thread
(sending again, with dm-devel on cc. Sorry!)
Hi Ben, hi Christophe,
AFAIU, the purpose of the log thread is to avoid blocking while writing log messages to the syslog socket. The thread has been in place for a long time. However, the large majority of multipath installations today runs on systemd-enabled systems, where we don't use the log thread. Rather, we write to stderr (which is actually a journald socket) directly.
That makes me wonder: if the problem of blocking while writing to the log socket is real, it should happen with journald as well (possibly more so than with syslogd; journald doesn't exactly have the reputation of being highly efficient). Thus, we should be using the log thread also for the systemd case. OTOH, I'm not aware of any bug reports saying that multipathd wasn't able to handle events because of blocking log calls. So perhaps the issue is rather theoretical? In that case, we could do away with all the complexity the log thread involves.
What do you think?
Martin
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 11 lines · Martin Wilck
(sending again, with dm-devel on cc. Sorry!)
Hi Ben, hi Christophe,
AFAIU, the purpose of the log thread is to avoid blocking while writing log messages to the syslog socket. The thread has been in place for a long time. However, the large majority of multipath installations today runs on systemd-enabled systems, where we don't use the log thread. Rather, we write to stderr (which is actually a journald socket) directly.
Quoted 5 lines
That makes me wonder: if the problem of blocking while writing to the log socket is real, it should happen with journald as well (possibly more so than with syslogd; journald doesn't exactly have the reputation of being highly efficient). Thus, we should be using the log thread also for the systemd case
It does seem sort of wasteful to me to have a thread buffering writes to a daemon that itself buffers writes. If journald is blocking logging processes from continuing, that's a big problem, and not just for multipath. Obviously multipathd, or at the very least, path checking, is supposed to continue working when there is no access to the root filesystem, which is a stricter requirement than other programs have. But IO delays happen, and journald better be decoupling them from the logging process. I have seen journald drop log messages, presumably because it isn't just blocking everything that wants to log to it.
Quoted 6 lines
OTOH, I'm not aware of any bug reports
saying that multipathd wasn't able to handle events because of blocking log calls. So perhaps the issue is rather theoretical? In that case, we could do away with all the complexity the log thread involves.What do you think?
I do believe that syslog is allowed to block the caller, but I agree that we've mostly moved on to a systemd world where multipathd is writing to stderr. Removing this will make multipathd run a real risk of hanging on logging when not run through systemd. I just don't know how likely that scenario is anymore.
-Ben
Quoted 3 lines
Martin
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 8 lines · Benjamin Marzinski
I do believe that syslog is allowed to block the caller, but I agree that we've mostly moved on to a systemd world where multipathd is writing to stderr. Removing this will make multipathd run a real risk of
hanging on logging when not run through systemd. I just don't know how
likely that scenario is anymore.
So, you really think that journald is doing a better job at not blocking clients than syslogd? Wouldn't syslogd be truly optimized for exactly this use case? Being "allowed" to block clients is one thing, actually doing it is another.
Martin
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 10 lines · Martin Wilck
Quoted 8 lines · Benjamin Marzinski
I do believe that syslog is allowed to block the caller, but I agree that we've mostly moved on to a systemd world where multipathd is writing to stderr. Removing this will make multipathd run a real risk of
hanging on logging when not run through systemd. I just don't know how
likely that scenario is anymore.
Quoted 4 lines
So, you really think that journald is doing a better job at not blocking clients than syslogd? Wouldn't syslogd be truly optimized for exactly this use case? Being "allowed" to block clients is one thing, actually doing it is another.
Fair enough. It probably is coming down to a difference in honesty in documentation. At any rate, I have never seen a bug that pointed towards multipathd hanging on logging.
-Ben
Quoted 6 lines
Martin
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 33 lines · Benjamin Marzinski
Quoted 11 lines · Martin Wilck
(sending again, with dm-devel on cc. Sorry!)
Hi Ben, hi Christophe,
AFAIU, the purpose of the log thread is to avoid blocking while writing log messages to the syslog socket. The thread has been in place for a long time. However, the large majority of multipath installations today runs on systemd-enabled systems, where we don't use the log thread. Rather, we write to stderr (which is actually a journald socket) directly.
Quoted 5 lines
That makes me wonder: if the problem of blocking while writing to the log socket is real, it should happen with journald as well (possibly more so than with syslogd; journald doesn't exactly have the reputation of being highly efficient). Thus, we should be using the log thread also for the systemd case
It does seem sort of wasteful to me to have a thread buffering writes to a daemon that itself buffers writes. If journald is blocking logging processes from continuing, that's a big problem, and not just for multipath. Obviously multipathd, or at the very least, path checking, is supposed to continue working when there is no access to the root filesystem, which is a stricter requirement than other programs have. But IO delays happen, and journald better be decoupling them from the logging process. I have seen journald drop log messages, presumably because it isn't just blocking everything that wants to log to it.
Quoted 5 lines
OTOH, I'm not aware of any bug reports
saying that multipathd wasn't able to handle events because of blocking log calls. So perhaps the issue is rather theoretical? In that case, we could do away with all the complexity the log thread involves.
Quoted 8 lines
Quoted 1 line
What do you think?
I do believe that syslog is allowed to block the caller, but I agree that we've mostly moved on to a systemd world where multipathd is writing to stderr. Removing this will make multipathd run a real risk of hanging on logging when not run through systemd. I just don't know how likely that scenario is anymore.
Well ... isn't that what the option '-d' is for? Namely _not_ starting the log thread when running under systemd?
Cheers,
Hannes
Signature · 10 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 36 lines · Hannes Reinecke
Quoted 35 lines · Benjamin Marzinski
Quoted 11 lines · Martin Wilck
(sending again, with dm-devel on cc. Sorry!)
Hi Ben, hi Christophe,
AFAIU, the purpose of the log thread is to avoid blocking while writing log messages to the syslog socket. The thread has been in place for a long time. However, the large majority of multipath installations today runs on systemd-enabled systems, where we don't use the log thread. Rather, we write to stderr (which is actually a journald socket) directly.
Quoted 5 lines
That makes me wonder: if the problem of blocking while writing to the log socket is real, it should happen with journald as well (possibly more so than with syslogd; journald doesn't exactly have the reputation of being highly efficient). Thus, we should be using the log thread also for the systemd case
It does seem sort of wasteful to me to have a thread buffering writes to a daemon that itself buffers writes. If journald is blocking logging processes from continuing, that's a big problem, and not just for multipath. Obviously multipathd, or at the very least, path checking, is supposed to continue working when there is no access to the root filesystem, which is a stricter requirement than other programs have. But IO delays happen, and journald better be decoupling them from the logging process. I have seen journald drop log messages, presumably because it isn't just blocking everything that wants to log to it.
Quoted 6 lines
OTOH, I'm not aware of any bug reports
saying that multipathd wasn't able to handle events because of blocking log calls. So perhaps the issue is rather theoretical? In that case, we could do away with all the complexity the log thread involves.What do you think?
Quoted 8 lines
Quoted 6 lines
I do believe that syslog is allowed to block the caller, but I agree that we've mostly moved on to a systemd world where multipathd is writing to stderr. Removing this will make multipathd run a real risk of hanging on logging when not run through systemd. I just don't know how likely that scenario is anymore.
Well ... isn't that what the option '-d' is for? Namely _not_ starting the log thread when running under systemd?
Martin is arguing that syslogd is at least as likely not to block as journald, so if we don't need the log thread when writing to journald (though stderr), we also don't need the log thread when writing to syslogd. Correct me, if I'm wrong Martin.
-Ben
Quoted 9 lines
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 9 lines · Benjamin Marzinski
Quoted 3 lines · Hannes Reinecke
Well ... isn't that what the option '-d' is for? Namely _not_ starting the log thread when running under systemd?
Martin is arguing that syslogd is at least as likely not to block as journald, so if we don't need the log thread when writing to journald (though stderr), we also don't need the log thread when writing to syslogd. Correct me, if I'm wrong Martin.
Exactly. The log thread has some race issues that we've been discussing in another thread ("[PATCH v2 29/29] libmultipath: fix race between log_safe and log_thread_stop()"). I had been digging into the code a bit, and found some more things that I'd like to see improved. But I realized fixing this for good might be hairy and take a lot of time which would be better spent elsewhere, and started wondering if we still need it at all.
Thanks,
Martin
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 11 lines · Martin Wilck
Quoted 9 lines · Benjamin Marzinski
Quoted 3 lines · Hannes Reinecke
Well ... isn't that what the option '-d' is for? Namely _not_ starting the log thread when running under systemd?
Martin is arguing that syslogd is at least as likely not to block as journald, so if we don't need the log thread when writing to journald (though stderr), we also don't need the log thread when writing to syslogd. Correct me, if I'm wrong Martin.
Quoted 7 lines
Exactly. The log thread has some race issues that we've been discussing in another thread ("[PATCH v2 29/29] libmultipath: fix race between
log_safeandlog_thread_stop()"). I had been digging into the code a bit, and found some more things that I'd like to see improved. But I realized fixing this for good might be hairy and take a lot of time which would be better spent elsewhere, and started wondering if we still need it at all.
Well, seeing that most distributions (or all I care about :-) have switched to systemd I don't have any issues with removing it.
Cheers,
Hannes
Signature · 10 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel