Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Feb 2016 17:30:04 +0100
From:      Willem Jan Withagen <wjw@digiware.nl>
To:        freebsd-hackers@freebsd.org
Subject:   Debugging C++ code with atexit functions not called..
Message-ID:  <56BF5A0C.6060503@digiware.nl>

next in thread | raw e-mail | index | archive | help

Hi,

I've rn into a snag with porting some of the Ceph code....

PID file cleanup is done tru a atexit(pidfile_remove) setup.

Ive augmented the code and I see that the last thing the Linux version
does is actually execute the pidfile_remove code.

Whereas on FreeBSD this does not happen, the function does not seem to
be called at all..

The most obvious reason would be a crash of the program, but I don't get
a core file...

But to terminate the program I have to send it a 'kill TERM'.
Doing so under gdb gdb prints:
[New Thread 806c91800 (LWP 101527 sginal_handler)]
[New Thread 806c91400 (LWP 101519 ms_accepter)]
[New Thread 806c91000 (LWP 101512 ms_local)]
[New Thread 804dffc00 (LWP 101509 ms_dispatch)]
[New Thread 804dff800 (LWP 101489 safe_timer)]
[New Thread 804dff400 (LWP 100256 ms_reaper)]
[New Thread 804dff000 (LWP 100223 fn_monstore)]
[New Thread 804c15c00 (LWP 100206 admin_socket)]
[New Thread 804c15800 (LWP 100193 service)]
[New Thread 804c15400 (LWP 100167 log)]
Program received signal SIGTERM, Terminated.

[Switching to Thread 804c15000 (LWP 101222)]
0x00000008025ea1fc in _umtx_op_err () from /lib/libthr.so.3
(gdb)

Are these threads being fired up by the program upon receiving the
signal? Continuing gives me some of the programs output, and it prints
that it has received a signal.

The break on the pidfile_remove is not triggered. Suggesting that it
does not call the atexit-functions...

Suggestions on how to debug this further....

--WjW



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56BF5A0C.6060503>