Subject: Re: bug#26961: 26.0.50; Possible timming issue in regex-tests.el

From: Tino Calancha <[email-masked]>
Date: Thu, 18 May 2017 16:00:31 +0900

Eli Zaretskii <[email-masked]> writes:

>> > ;;; II) This one fails in Debian-9, but it works in Fedora-25:
>> > emacs --batch -L ":." -l ert -l src/regex-tests.el \
>> > --eval '(let (arg) (ert-run-tests-batch-and-exit arg))'
>
>> #0  terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:363
>> #1  0x00000000005c1191 in emacs_abort () at sysdep.c:2371
>> #2  0x0000000000629189 in mark_object (arg=XIL(0x7fffffffbc54)) at alloc.c:6428
>> #3  0x00000000006299ae in mark_object (arg=XIL(0x2f44ac3)) at alloc.c:6667
>> #4  0x0000000000625a6c in mark_maybe_object (obj=XIL(0x2f44ac3)) at alloc.c:4788
>> #5  0x0000000000625e47 in mark_memory (start=0x7fffffff6b70, end=0x7fffffffe08f) at alloc.c:4940
>> #6  0x0000000000625e7c in mark_stack (bottom=0x7fffffffe08f "", end=0x7fffffff6b70 "\200\214!\001") at alloc.c:5138
>> #7  0x00000000006e01dc in mark_one_thread (thread=0xe1b2a0 <main_thread>) at thread.c:603
>> #8  0x00000000006e0371 in mark_threads_callback (ignore=0x0) at thread.c:634
>> #9  0x0000000000625ec4 in flush_stack_call_func (func=0x6e02de <mark_threads_callback>, arg=0x0) at alloc.c:5165
>> #10 0x00000000006e03a3 in mark_threads () at thread.c:641
>> #11 0x0000000000627e8b in garbage_collect_1 (end=0x7fffffff6d50) at alloc.c:5942
>> #12 0x0000000000628562 in Fgarbage_collect () at alloc.c:6108
>
> Are you up to the task of debugging GC?  See etc/DEBUG for some
> advice.

The problem arise from the recursive call in mark_object:
mark_object (ptr->car);

In my example recipe, such call not always satisfy the sanity
checks.

With the following patch, i cannot reproduce the issue anymore.

commit 5d0ac7e21e5dbb5128310a3a5017795321f71736
Author: Tino Calancha <[email-masked]>
Date:   Thu May 18 15:44:10 2017 +0900

    * src/alloc.c (mark_object): Use mark_maybe_object (Bug#26961).

diff --git a/src/alloc.c b/src/alloc.c
index faa14eebb3..8555e3f4e4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6664,7 +6664,7 @@ mark_object (Lisp_Object arg)
 	    cdr_count = 0;
 	    goto loop;
 	  }
-	mark_object (ptr->car);
+	mark_maybe_object (ptr->car);
 	obj = ptr->u.cdr;
 	cdr_count++;
 	if (cdr_count == mark_object_loop_halt)