GNU bug report logs - #10655
[2.0.3+] ‘queue_after_gc_hook’ called during thread startup leads to SIGSEGV

Previous Next

Package: guile;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Mon, 30 Jan 2012 15:28:01 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


Message #11 received at 10655 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo <at> pobox.com>
Cc: 10655 <at> debbugs.gnu.org
Subject: Re: bug#10655: [2.0.3+] ‘queue_after_gc_hook’ called during thread startup leads to SIGSEGV
Date: Mon, 30 Jan 2012 16:41:17 +0100
[Message part 1 (text/plain, inline)]
Hi!

I’m testing this patch:

[Message part 2 (text/x-patch, inline)]
diff --git a/libguile/gc.c b/libguile/gc.c
index 7816801..97dfcd8 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -730,14 +730,17 @@ queue_after_gc_hook (void * hook_data SCM_UNUSED,
   if (scm_debug_cells_gc_interval == 0)
 #endif
     {
-      scm_i_thread *t = SCM_I_CURRENT_THREAD;
-
-      if (scm_is_false (SCM_CDR (after_gc_async_cell)))
-        {
-          SCM_SETCDR (after_gc_async_cell, t->active_asyncs);
-          t->active_asyncs = after_gc_async_cell;
-          t->pending_asyncs = 1;
-        }
+      if (SCM_I_CURRENT_THREAD != NULL && SCM_I_CURRENT_THREAD->guile_mode)
+	{
+	  scm_i_thread *t = SCM_I_CURRENT_THREAD;
+
+	  if (scm_is_false (SCM_CDR (after_gc_async_cell)))
+	    {
+	      SCM_SETCDR (after_gc_async_cell, t->active_asyncs);
+	      t->active_asyncs = after_gc_async_cell;
+	      t->pending_asyncs = 1;
+	    }
+	}
     }
 
   return NULL;
[Message part 3 (text/plain, inline)]
Rationale:

  - With TLS, SCM_I_CURRENT_THREAD is never NULL but the whole struct,
    including ‘guile_mode’, is zero when the thread starts.

  - Without TLS, SCM_I_CURRENT_THREAD is NULL until ‘guilify_self_1’ has
    been called.

Thoughts?

(My “benchmark” has been running for some time already and the bug
hasn’t shown up again.)

Thanks,
Ludo’.

This bug report was last modified 13 years and 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.