Richard W.M. Jones
2014-Oct-01 13:28 UTC
[Libguestfs] Useful tip: Run guestfsd under gdb and print stack trace on exit
Useful for tracking down segfaults in the daemon. This is not upstreamable right now. Example usage: $ ./run guestfish -v -x -a /dev/null run : debug segv "" [...] libguestfs: trace: launch = 0 libguestfs: trace: debug "segv" "" guestfsd: main_loop: new request, len 0x34 Program received signal SIGSEGV, Segmentation fault. debug_segv (subcmd=0x4687050 "segv", argc=0, argv=0x4687070) at debug.c:223 223\tdebug.c: No such file or directory. #0 debug_segv (subcmd=0x4687050 "segv", argc=0, argv=0x4687070) at debug.c:223 #1 0x000000000042e083 in debug_stub (xdr_in=<optimized out>) at stubs.c:2557 #2 0x0000000000448d5d in dispatch_incoming_message (xdr_in=0x7fffffffe8d0) at stubs.c:15819 #3 0x0000000000428a91 in main_loop (_sock=73953360, _sock at entry=3) at proto.c:192 #4 0x000000000040564d in main (argc=<optimized out>, argv=<optimized out>) at guestfsd.c:344 Rebooting. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top -------------- next part -------------->From 9bd0fe0e2790e0136684245dc6a97f6ec4e24502 Mon Sep 17 00:00:00 2001From: "Richard W.M. Jones" <rjones at redhat.com> Date: Wed, 1 Oct 2014 14:15:41 +0100 Subject: [PATCH] appliance: Run guestfsd under gdb and print stack trace on exit. --- appliance/init | 10 ++-------- appliance/packagelist.in | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/appliance/init b/appliance/init index 6d62338..52da01f 100755 --- a/appliance/init +++ b/appliance/init @@ -132,14 +132,8 @@ if ! grep -sq guestfs_rescue=1 /proc/cmdline; then fi # Run guestfsd, under valgrind if asked. - $vg guestfsd - if [ $? -eq 119 ]; then - echo "DAEMON VALGRIND FAILED" - # Sleep so valgrind messages are seen by the host. Note this - # only happens in non-production builds - # (--enable-valgrind-daemon) + on an error path. - sleep 10 - fi + gdb -batch -ex "run" -ex "bt" guestfsd + sleep 10 else # Run virt-rescue shell. diff --git a/appliance/packagelist.in b/appliance/packagelist.in index 276b4c2..a1ecada 100644 --- a/appliance/packagelist.in +++ b/appliance/packagelist.in @@ -216,6 +216,7 @@ e2fsprogs file findutils gawk +gdb gdisk grep gzip -- 2.0.4
Possibly Parallel Threads
- [PATCH] daemon: Don't xdr_free uninitialized args struct on error paths.
- [REPOST] guestfsd core capture, and virt-rescue clean shutdown
- factorization would be nice
- Sieve: deleteheader not working with duplicate filter for implicit keep
- [PATCH v2] daemon: proto: Make the guestfsd main loop messages consistent and useful.