]> git.proxmox.com Git - pve-common.git/commitdiff
Tools::run_with_timeout improvement + hires alarm
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 26 Aug 2015 08:38:26 +0000 (10:38 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Aug 2015 08:45:26 +0000 (10:45 +0200)
The following situations could lead to the 'unknown error':
1) As commented, when the alarm triggered after the first
signal handler was installed and before the new alarm was
installed. In this case the $signalcount was increased,
and worse: the original signal handler was never called.

2) When $code died, since the call itself wasn't in an eval
block, we'd leave the eval block containing the inner alarm
signal handler. Then there's a time window from leaving the
signal block (and with that restoring the first installed
only-counting signal-handler) and reaching the code to
restore the previous alarm where the counting alarm handler
could get triggered by our own alarm set before running
$code. In this case at least the the old alarm would be
restored, but we'd still trigger the 'unknown error'.

The new code starts off by suspending the original alarm
before installing any signal handler, then installing the
timeout handler inside the first eval block. The $code is
then run inside another eval block to make sure we reach the
alarm(0) statement before restoring the old signal handler
and alarm timeout.


No differences found