Skip to contentSkip to conversation

Fix uninitialized pointer in debug.cc:dout_handle_daemonize().

PATCH Applied Vangelis Koukis 2 participants 3 messages Dec 13, 2010 – Dec 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix uninitialized pointer in debug.cc:dout_handle_daemonize().

Hello,

Starting the MDS from the unstable branch fails instantly with a SEGFAULT. The MDS works when started in nodaemon mode, using "-D".

The segfault happens in common/debug.cc:dout_handle_daemonize(), which attempts to call _doss->handle_stdout_closed() with _doss being NULL.

The following patch calls _dout_open_log() to initialize _doss before accessing it.

---
 src/common/debug.cc |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
src/common/debug.cc +5 -0
index 10cd6ce..88780f0 100644
@@ -38,6 +38,11 @@ void _dout_open_log()
 int dout_handle_daemonize()
 {
   Mutex::Locker l(_dout_lock);
+
+  if (_dout_need_open)
+       _dout_open_log();
+
+  assert(_doss);
   _doss->handle_stdout_closed();
   _doss->handle_stderr_closed();
   return _doss->handle_pid_change();

--
1.7.2.3

Signature · 9 lines
Vangelis Koukis
[email protected]
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <[email protected]>
     Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
        -- Ralph Waldo Emerson
#1 lore raw

Good find! You must have logging turned fairly low, so you never created/initialized the stream prior to dout_handle_daemonize().

Colin

2010/12/13 Vangelis Koukis <[email protected]>:

Quoted 47 lines

Hello,

Starting the MDS from the unstable branch fails instantly with a SEGFAULT. The MDS works when started in nodaemon mode, using "-D".

The segfault happens in common/debug.cc:dout_handle_daemonize(), which attempts to call _doss->handle_stdout_closed() with _doss being NULL.

The following patch calls _dout_open_log() to initialize _doss before accessing it.

---
 src/common/debug.cc |    5 +++++

 1 files changed, 5 insertions(+), 0 deletions(-)
src/common/debug.cc +5 -1
index 10cd6ce..88780f0 100644
@@ -38,6 +38,11 @@ void _dout_open_log()
  int dout_handle_daemonize()
  {
   Mutex::Locker l(_dout_lock);
+
+  if (_dout_need_open)
+       _dout_open_log();
+
+  assert(_doss);
   _doss->handle_stdout_closed();
   _doss->handle_stderr_closed();
   return _doss->handle_pid_change();
--

1.7.2.3

--
Vangelis Koukis
[email protected]
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <[email protected]> Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
       -- Ralph Waldo Emerson

Quoted 9 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk0GIdwACgkQ+/w3mR0DjpfzvQCg+uSs9QhOXKnDeIlMfBsXQY6C osEAn2i/HlLopWasTv+g/0lFMzJkWX5Z
=moAt
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#2 lore raw

Applied.

C.

Quoted 57 lines · Colin McCabe

Good find! You must have logging turned fairly low, so you never created/initialized the stream prior to dout_handle_daemonize().

Colin

2010/12/13 Vangelis Koukis <[email protected]>:

Quoted 50 lines

Hello,

Starting the MDS from the unstable branch fails instantly with a SEGFAULT. The MDS works when started in nodaemon mode, using "-D".

The segfault happens in common/debug.cc:dout_handle_daemonize(), which attempts to call _doss->handle_stdout_closed() with _doss being NULL.

The following patch calls _dout_open_log() to initialize _doss before accessing it.

---
 src/common/debug.cc |    5 +++++

 1 files changed, 5 insertions(+), 0 deletions(-)
src/common/debug.cc +5 -1
index 10cd6ce..88780f0 100644
@@ -38,6 +38,11 @@ void _dout_open_log()
  int dout_handle_daemonize()
  {
   Mutex::Locker l(_dout_lock);
+
+  if (_dout_need_open)
+       _dout_open_log();
+
+  assert(_doss);
   _doss->handle_stdout_closed();
   _doss->handle_stderr_closed();
   return _doss->handle_pid_change();
--

1.7.2.3

--
Vangelis Koukis
[email protected]
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <[email protected]> Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
       -- Ralph Waldo Emerson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

Quoted 7 lines
Quoted 6 lines

iEYEARECAAYFAk0GIdwACgkQ+/w3mR0DjpfzvQCg+uSs9QhOXKnDeIlMfBsXQY6C osEAn2i/HlLopWasTv+g/0lFMzJkWX5Z
=moAt
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html