[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start f
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails |
Date: |
Fri, 6 Jan 2012 10:56:19 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Jan 05, 2012 at 06:18:26PM -0600, Michael Roth wrote:
> On 01/05/2012 04:26 PM, MATSUDA, Daiki wrote:
> >Hi, all.
> >
> >I am trying QEMU Guest Agent and encountered a small bug. It is that the
> >PIDFILE remains when daemon start fails. And maybe forgotton to g_free().
> >
> >MATSUDA, Daiki
> >
>
> Thanks for the patch. There was some contention in the past about
> whether or not to clean up pidfiles when there was abnormal
> termination, but personally I like this approach better.
Yep, this still leaves open the problem of pidfile cleanup when the
daemon crashes. For libvirtd we recently switched over to a crash-safe
pidfile acquisition design, that uses fcntl(F_SETLK) to maintain
exclusive access over the pidfile. With this you don't need to worry
about forgetting to unlink() on termination, since the POSIX lock is
automatically released when process exits (or crashes).
If you're interested in copying the algorithm libvirt uses for pidfiles
then look at the virPidFileAcquirePath() function, starting line 308,
and also corresponding virPidFileReleasePath() to (optionally) call
on shutdown:
http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/util/virpidfile.c;hb=HEAD
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
- [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, MATSUDA, Daiki, 2012/01/05
- [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, MATSUDA, Daiki, 2012/01/05
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Michael Roth, 2012/01/05
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails,
Daniel P. Berrange <=
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Michael Roth, 2012/01/06
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Daniel P. Berrange, 2012/01/06
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Luiz Capitulino, 2012/01/06
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Michael Roth, 2012/01/06
- Re: [Qemu-devel] [PATCH] GuestAgent: PIDFILE remains when daemon start fails, Luiz Capitulino, 2012/01/06