unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Fix gc.test "after-gc-hook gets called" failures
@ 2019-04-11 15:43 Andrea Azzarone
  2019-04-16 21:38 ` Mark H Weaver
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Azzarone @ 2019-04-11 15:43 UTC (permalink / raw)
  To: guile-devel

Hi,

"after-gc-hook gets called" test randomly fails as reported
downstream, for example:
- https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31776
- https://bugs.launchpad.net/ubuntu/+source/guile-2.2/+bug/1823459

I'm attaching a patch that seems to fix the failures.

From 2efba337d5b636cd975260f19ea74e27ecf0ca17 Mon Sep 17 00:00:00 2001
From: Andrea Azzarone <andrea.azzarone@canonical.com>
Date: Thu, 11 Apr 2019 16:30:58 +0100
Subject: Fix gc.test "after-gc-hook gets called" failures

* libguile/scmsigs.c: Call scm_async_tick to give any pending asyncs a chance to
  run before we block indefinitely waiting for a signal to arrive.
---
 libguile/scmsigs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index b4bd380be..4e1594a29 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -182,6 +182,14 @@ signal_delivery_thread (void *data)
     {
       struct signal_pipe_data sigdata;

+      /* This tick gives any pending asyncs a chance to run before we block
+         indefinitely waiting for a signal to arrive. For example it can happen
+         that the garbage collector is triggered while marking the signal
+         handler for for future execution.  Due to the way the after-gc-hook
+         is designed, without a call to scm_async_tick, the after-gc-hook will
+         not be triggered. */
+      scm_async_tick ();
+
       scm_without_guile (read_signal_pipe_data, &sigdata);

       sig = sigdata.sigbyte;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-16 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11 15:43 [PATCH] Fix gc.test "after-gc-hook gets called" failures Andrea Azzarone
2019-04-16 21:38 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).