Test that the segv injection works.
Test that a segv while logging something doesn't hang when the signal
handlers are installed. Note that this fails/hangs without the previous
fix.
Signed-off-by: Sage Weil <sage@redhat.com>
Memory leaks detector report:
$ valgrind --leak-check=full /usr/bin/radosgw -c /etc/ceph/ceph.conf -n
client.radosgw.gateway -
...
==16986== 8 bytes in 1 blocks are definitely lost in loss record 14 of 83
==16986== at 0x4A075BC: operator new(unsigned long) (vg_replace_malloc.c:298)
==16986== by 0x58980B8: ceph::log::Log::set_flush_on_exit() (in /usr/lib64/librados.so.2.0.0)
==16986== by 0x6BE3CA: global_init(std::vector<char const*, std::allocator<char const*> >*, st
==16986== by 0x5B6B0A: main (in /usr/bin/radosgw)
...
Signed-off-by: Andrey Kuznetsov <Andrey_Kuznetsov@epam.com>
The version of TEMP_FAILURE_RETRY found on Linux has a GNU extension
that squashes the unused return value warning where applicable. This
adds a VOID_TEMP_FAILURE_RETRY to make the case explicit, casting the
expression value to void to avoid the warning.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
- Enabling subdir objects
- Created a Makefile-env.am with basic automake init
- Created .am files per subdir, included from src/Makefile.am
Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
We weren't locking m_flush_mutex properly, which in turn was leading to
racing threads calling dump_recent() and garbling the crash dump output.
Backport: bobtail, argonaut
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
We were using a single cond, and only signalling one waiter. That means
that if the flusher and several logging threads are waiting, and we hit
a limit, we the logger could signal another logger instead of the flusher,
and we could deadlock.
Similarly, if the flusher empties the queue, it might signal only a single
logger, and that logger could re-signal the flusher, and the other logger
could wait forever.
Intead, break the single cond into two: one for loggers, and one for the
flusher. Always signal the (one) flusher, and always broadcast to all
loggers.
Backport: bobtail, argonaut
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
We need to signal the cond in the same interval where we hold the lock
*and* modify the queue. Otherwise, we can have a race like:
queue has 1 item, max is 1.
A: enter submit_entry, signal cond, wait on condition
B: enter submit_entry, signal cond, wait on condition
C: flush wakes up, flushes 1 previous item
A: retakes lock, enqueues something, exits
B: retakes lock, condition fails, waits
-> C is never woken up as there are 2 items waiting
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
At (2): Non-static class member "m_thread" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "m_prio" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member "m_subsys" is not initialized in this constructor nor in any functions that it calls.
CID 717229: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "m_static_buf" is not initialized in this constructor nor in any functions that it calls.
Signed-off-by: Sage Weil <sage@inktank.com>
CID 716965: Data race condition (MISSING_LOCK)
At (2): Accessing "this->m_stop" ("_ZN4ceph3log3LogE.m_stop") requires the "_ZN4ceph3log3LogE.m_queue_mutex" lock.
This isn't strictly needed since we assume only one thread will call this
method and start a thead, but it makes coverity happy.
Signed-off-by: Sage Weil <sage@inktank.com>
Whether an entry is eligible to log/dump is independent of the channel it
is sent to. Some channels impose additional restrictions.
Signed-off-by: Sage Weil <sage@inktank.com>
In non-crash situations, we want to make sure the message is both below the
syslog/stderr threshold and also below the normal log threshold. Otherwise
we get anything we gather on those channels, even when the log level is
low.
Signed-off-by: Sage Weil <sage@inktank.com>
We should gather an event if it is below the log or gather threshold.
Previously we were only gathering if we were going to print it, which makes
the dump no more useful than what was already logged.
Signed-off-by: Sage Weil <sage@inktank.com>
This lets you do something like
p g_ceph_context->_conf->subsys.set_log_level(ceph_subsys_mon, 20)
from gdb.
Signed-off-by: Sage Weil <sage@newdream.net>
Set this up in either global_init() or common_init_finish(), both opportune
times that occur after config parsing has happened and the user has the
option to modify this behavior. The exception would be libraries like
librados, which can't use rados_conf_* to enable this. Arguably flush
functionality should be exposed through the librados API directly, instead
of futzing with on_exit().
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This mimics the allows you to get and set subsystem debug levels via the
normal config access methods. Among other things, this allows librados
users to set debug levels.
Fixes: #2350
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This makes it easier to interpret the dump, and makes it obvious what is
dump (and potentially a dup of something that was already logged) and what
is not.
Signed-off-by: Sage Weil <sage@newdream.net>
- faster than ostringstream in optimistic case
- same as ostreamstream + std::string assignment in worst case (use
overflow string)
Signed-off-by: Sage Weil <sage@newdream.net>
- explicitly defined subsystems, and ceph_subsys_FOO enums to go with them
- modular log system with Entry object
- separate gather level and log level
- drop lots of DoutStreambuf hackery
Signed-off-by: Sage Weil <sage@newdream.net>