1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00
Werner Koch 9a3e41c151
common: Improve lock strategy for dotlock.
* common/dotlock.c (next_wait_interval): New.
(dotlock_take_unix): Use new function.
(dotlock_take_w32): Ditto.
--

In particular when using a dotlock file for protecting the spawning
and several processes try to spawn the agent or another component, we
often run into long delays.  The solution is to is to exponential
backoff and also to reduce the initial delay from 50ms to 4ms.  We
further limit the maximum wait period to about 2 seconds and then
repeat at intervals of 512, 1024 and 2048ms.  In the wait-forever case
we add a small random value to have different intervals per process.

GnuPG-bug-id: 3380

For testing this code snippet in the spawning function might be
useful:

          const char *s;
          if ((s=getenv("hold_gpg_file")))
            while (!gnupg_access (s, F_OK))
              gnupg_sleep (1);
2023-10-02 14:45:19 +02:00
..
2018-10-25 16:53:05 -04:00
2023-10-02 13:03:03 +02:00
2023-10-02 13:03:03 +02:00
2015-10-28 10:20:17 +01:00
2021-10-06 10:35:51 +02:00
2020-02-18 18:07:46 -05:00
2015-11-17 12:50:22 +01:00
2023-01-11 11:33:26 +01:00
2021-12-20 19:34:34 +01:00
2021-12-20 19:34:34 +01:00
2018-10-25 16:53:05 -04:00
2018-10-25 16:53:05 -04:00
2019-04-16 13:24:10 +09:00
2023-05-26 11:56:36 +02:00
2019-07-12 12:11:26 +09:00
2020-02-18 18:07:46 -05:00
2016-03-02 14:27:30 +01:00
2018-10-25 16:53:05 -04:00
2023-05-01 11:38:20 +09:00
2018-10-24 15:56:18 -04:00
2023-04-05 21:32:23 +02:00
2023-09-07 17:21:05 +02:00
2023-10-02 13:03:03 +02:00
2019-10-01 10:32:31 +02:00
2018-10-24 15:56:18 -04:00
2020-02-18 18:07:46 -05:00
2020-02-18 18:07:46 -05:00
2020-02-18 18:07:46 -05:00
2022-09-14 15:42:03 +09:00
2022-04-06 13:28:15 +09:00
2022-08-02 14:35:38 +02:00
2023-06-28 17:34:19 +02:00
2020-04-24 15:37:48 +02:00
2023-10-02 13:03:03 +02:00
2022-08-02 14:35:38 +02:00
2022-08-02 14:35:38 +02:00
2023-01-20 09:07:20 +01:00
2017-02-21 13:11:46 -05:00

Common functionality used by all modules of GnuPG.