Re: [libvirt] [PATCH v3 2/2] process: wait longer 5->30s on hard shutdown
On Tue, Aug 21, 2018 at 1:16 PM Daniel P. Berrangé wrote: > On Tue, Aug 14, 2018 at 11:27:34AM +0200, Christian Ehrhardt wrote: > > In cases where virProcessKillPainfully already reailizes that > > SIGTERM wasn't enough we are partially on a bad path already. > > Maybe the system is overloaded or having serious trouble to free and > > reap resources in time. > > > > In those case give the SIGKILL that was sent after 10 seconds some more > > time to take effect if force was set (only then we are falling back to > > SIGKILL anyway). > > > > Signed-off-by: Christian Ehrhardt > > --- > > src/util/virprocess.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/src/util/virprocess.c b/src/util/virprocess.c > > index 46360cc051..dda8916284 100644 > > --- a/src/util/virprocess.c > > +++ b/src/util/virprocess.c > > @@ -350,7 +350,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, > unsigned int extradelay) > > { > > size_t i; > > int ret = -1; > > -unsigned int delay = 75 + (extradelay*5); > > +unsigned int delay = (force ? 200 : 75) + (extradelay*5); > > const char *signame = "TERM"; > > > > VIR_DEBUG("vpid=%lld force=%d delay=%u", (long long)pid, force, > pid); > > @@ -358,7 +358,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, > unsigned int extradelay) > > /* This loop sends SIGTERM, then waits a few iterations (10 seconds) > > * to see if it dies. If the process still hasn't exited, and > > * @force is requested, a SIGKILL will be sent, and this will > > - * wait up to 5 seconds more for the process to exit before > > + * wait up to 30 seconds more for the process to exit before > > * returning. > > * > > * An extra delay can be specified for cases that are expected to > clean > > Reviewed-by: Daniel P. Berrangé > Thanks, added to the v4 submission queue ... > Regards, > Daniel > -- > |: https://berrange.com -o- > https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- > https://fstop138.berrange.com :| > |: https://entangle-photo.org-o- > https://www.instagram.com/dberrange :| > -- Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 2/2] process: wait longer 5->30s on hard shutdown
On Tue, Aug 14, 2018 at 11:27:34AM +0200, Christian Ehrhardt wrote: > In cases where virProcessKillPainfully already reailizes that > SIGTERM wasn't enough we are partially on a bad path already. > Maybe the system is overloaded or having serious trouble to free and > reap resources in time. > > In those case give the SIGKILL that was sent after 10 seconds some more > time to take effect if force was set (only then we are falling back to > SIGKILL anyway). > > Signed-off-by: Christian Ehrhardt > --- > src/util/virprocess.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/util/virprocess.c b/src/util/virprocess.c > index 46360cc051..dda8916284 100644 > --- a/src/util/virprocess.c > +++ b/src/util/virprocess.c > @@ -350,7 +350,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, > unsigned int extradelay) > { > size_t i; > int ret = -1; > -unsigned int delay = 75 + (extradelay*5); > +unsigned int delay = (force ? 200 : 75) + (extradelay*5); > const char *signame = "TERM"; > > VIR_DEBUG("vpid=%lld force=%d delay=%u", (long long)pid, force, pid); > @@ -358,7 +358,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, > unsigned int extradelay) > /* This loop sends SIGTERM, then waits a few iterations (10 seconds) > * to see if it dies. If the process still hasn't exited, and > * @force is requested, a SIGKILL will be sent, and this will > - * wait up to 5 seconds more for the process to exit before > + * wait up to 30 seconds more for the process to exit before > * returning. > * > * An extra delay can be specified for cases that are expected to clean Reviewed-by: Daniel P. Berrangé Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 2/2] process: wait longer 5->30s on hard shutdown
In cases where virProcessKillPainfully already reailizes that SIGTERM wasn't enough we are partially on a bad path already. Maybe the system is overloaded or having serious trouble to free and reap resources in time. In those case give the SIGKILL that was sent after 10 seconds some more time to take effect if force was set (only then we are falling back to SIGKILL anyway). Signed-off-by: Christian Ehrhardt --- src/util/virprocess.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 46360cc051..dda8916284 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -350,7 +350,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay) { size_t i; int ret = -1; -unsigned int delay = 75 + (extradelay*5); +unsigned int delay = (force ? 200 : 75) + (extradelay*5); const char *signame = "TERM"; VIR_DEBUG("vpid=%lld force=%d delay=%u", (long long)pid, force, pid); @@ -358,7 +358,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay) /* This loop sends SIGTERM, then waits a few iterations (10 seconds) * to see if it dies. If the process still hasn't exited, and * @force is requested, a SIGKILL will be sent, and this will - * wait up to 5 seconds more for the process to exit before + * wait up to 30 seconds more for the process to exit before * returning. * * An extra delay can be specified for cases that are expected to clean -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list