[licq-im/licq] a3b8ee: licq: Drop log messages instead of deadlocking
GitHub <[email protected]> Thu, 25 Oct 2012 12:09:58 -0700
| Newsgroups | gmane.network.licq.cvs |
|---|---|
| Message-ID | <[email protected]> |
Branch: refs/heads/master
Home: https://github.com/licq-im/licq
Commit: a3b8ee728624c3b14116b64bc0a32813c7f35902
https://github.com/licq-im/licq/commit/a3b8ee728624c3b14116b64bc0a32813c7f35902
Author: Anders Olofsson <[email protected]>
Date: 2012-10-23 (Tue, 23 Oct 2012)
Changed paths:
M licq/include/licq/pipe.h
M licq/src/logging/pluginlogsink.cpp
M licq/src/utils/pipe.cpp
Log Message:
-----------
licq: Drop log messages instead of deadlocking
If something starts flooding log messages faster than a sink can
process them, the pipe in PluginLogSink will fill up and cause the
sender to block. The pipe is written while mutexes are held, this will
cause a deadlock as the log sinks need to take the same mutex to read
the pipe.
This deadlock could also be resolved by releasing the mutex in
PluginLogSink before accessing the pipe. However, the caller
(LogDistributor) also has a mutex for all the sinks which could also
deadlock if another source tries to log something at the same time, and
even if that is solved the second source would just hang on writing to
the pipe.