GNU bug report logs - #79367
31.0.50; magit-commit sometimes doesn't work if diff-hl-update-async is t

Previous Next

Package: emacs;

Reported by: Zhengyi Fu <i <at> fuzy.me>

Date: Tue, 2 Sep 2025 06:21:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Zhengyi Fu <i <at> fuzy.me>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: sbaugh <at> janestreet.com, 79367 <at> debbugs.gnu.org, dmitry <at> gutov.dev
Subject: bug#79367: 31.0.50; magit-commit sometimes doesn't work if diff-hl-update-async is t
Date: Sat, 06 Sep 2025 16:28:40 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Zhengyi Fu <i <at> fuzy.me>
>> Cc: sbaugh <at> janestreet.com,  dmitry <at> gutov.dev,  79367 <at> debbugs.gnu.org
>> Date: Sat, 06 Sep 2025 13:35:49 +0800
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >> From: Zhengyi Fu <i <at> fuzy.me>
>> >> Cc: sbaugh <at> janestreet.com,  dmitry <at> gutov.dev,  79367 <at> debbugs.gnu.org
>> >> Date: Fri, 05 Sep 2025 21:36:16 +0800
>> >> 
>> >> Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> 
>> >> > Thanks, then please show the value of the offending descriptor which
>> >> > causes the assertion violation.  For that, please run Emacs udner GDB,
>> >> > perform the recipe that reproduces the problem, and then type these
>> >> > GDB commands:
>> >> >
>> >> >  (gdb) frame 1
>> >> >  (gdb) print p->infd
>> >> >
>> >> > and tell what that produces.
>> >> 
>> >> The p->infd value is 8.
>> >
>> > OK, please repeat this several times to make sure it's always 8.
>> >
>> > If it is, then let's try to see which code leaves the .thread field
>> > uncleared.  Like this (please run from the src directory where you
>> > have the 'emacs' executable you have built):
>> >
>> >   $ gdb ./emacs
>> >   ...
>> >   (gdb) break process.c:8731
>> >   (gdb) run
>> >
>> > Emacs will start and stop in init_process_emacs, on line 8731 of
>> > process.c.  Then:
>> >
>> >   (gdb) watch fd_callback_info[8].thread
>> >   (gdb) commands
>> >    > bt 5
>> >    > continue
>> >    > end
>> >   (gdb) continue
>> >
>> > The above sets a watchpoint which will stop Emacs each time we assign
>> > some value to fd_callback_info[8].thread, and GDB will then show the
>> > first 5 frames of the call-stack, then continue.  Now run your recipe,
>> > until it gets SIGABRT, and post everything GDB produced until that
>> > point.  I hope that will tell us which code fails to clear the .thread
>> > member.
>> >
>> > Thanks.
>> 
>> The fd is 8 when running Emacs in terminal.
>> The fd is always 16 when running Emacs in X11.
>
> Thanks, please try the patch below, instead of the incorrect one I
> asked you to try before:
>
> diff --git a/src/process.c b/src/process.c
> index fa003c2..736098f 100644
> --- a/src/process.c
> +++ b/src/process.c
> @@ -4831,7 +4831,11 @@ deactivate_process (Lisp_Object proc)
>    /* Beware SIGCHLD hereabouts.  */
>  
>    for (i = 0; i < PROCESS_OPEN_FDS; i++)
> -    close_process_fd (&p->open_fd[i]);
> +    {
> +      fd_callback_info[p->open_fd[i]].thread = NULL;
> +      fd_callback_info[p->open_fd[i]].waiting_thread = NULL;
> +      close_process_fd (&p->open_fd[i]);
> +    }
>  
>    inchannel = p->infd;
>    eassert (inchannel < FD_SETSIZE);

This resolves the problem. The assertion failure no longer occurs when testing with the patch.




This bug report was last modified 7 days ago.

Previous Next


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