GNU bug report logs - #79228
30.1.90; native--compile-async sentinel can error if threads are running

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 12 Aug 2025 21:57:01 UTC

Severity: normal

Found in version 30.1.90

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Spencer Baugh <sbaugh <at> janestreet.com>
Subject: bug#79228: closed (Re: bug#79228: 30.1.90; native--compile-async
 sentinel can error if threads are running)
Date: Tue, 02 Sep 2025 15:09:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#79228: 30.1.90; native--compile-async sentinel can error if threads are running

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 79228 <at> debbugs.gnu.org.

-- 
79228: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79228
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: dmitry <at> gutov.dev, acorallo <at> gnu.org, johnw <at> gnu.org,
 79228-done <at> debbugs.gnu.org
Subject: Re: bug#79228: 30.1.90; native--compile-async sentinel can error if
 threads are running
Date: Tue, 02 Sep 2025 18:07:33 +0300
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: dmitry <at> gutov.dev,  acorallo <at> gnu.org,  johnw <at> gnu.org,  79228 <at> debbugs.gnu.org
> Date: Tue, 02 Sep 2025 10:40:53 -0400
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
> >> Cc: dmitry <at> gutov.dev,  acorallo <at> gnu.org,  johnw <at> gnu.org,  79228 <at> debbugs.gnu.org
> >> Date: Tue, 02 Sep 2025 09:18:12 -0400
> >> 
> >> > And it's unjustified, since if worse comes to worst, we can simply
> >> > unlock the process that performs async compilation.  No need to reach
> >> > far-fetched conclusions about processes in general because of this
> >> > specific case.
> >> 
> >> Okay, then this patch should fix the bug.
> >
> > But does it?  You've brought up the issue, so presumably you have a
> > way of recreating the problem.
> 
> Not easily, but fine, I did some more work to figure out a reliable
> reproduction:
> 
> 1. Delete eln-cache
> 2. emacs -Q --eval '(dotimes (_ 5) (make-thread (lambda () (while t (sit-for 1)))))'
> 3. Observe errors in *Messages* from native compilation
> 
> > Then please try this patch and tell whether it indeed solves the
> > problem.
> 
> Yes, it does.

Thanks, installed on master, and closing the bug.

[Message part 3 (message/rfc822, inline)]
From: Spencer Baugh <sbaugh <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1.90; native--compile-async sentinel can error if threads are
 running
Date: Tue, 12 Aug 2025 17:56:29 -0400
Other threads can run pending_funcalls if they call
accept-process-output.  This should probably not be allowed.

A specific bug is that the C core calls native--compile-async using
pending_funcalls.  If that runs on another thread, then the processes
created in native--compile-async are locked to that other thread.  Then
the sentinels for those processes error when they call
accept-process-output on the processes while on yet another thrad.  Or
something like that; the sentinels were definitely erroring with the
"Attempt to accept output from process %s locked to thread %s" error.

This can be reproduced somewhat reliably by causing the C code to start
async native compilation while there are other threads running.  Sorry
for not making a full reproduction, but I think it's fairly
self-explanatory, and having pending_funcalls run on other threads is
clearly wrong.




This bug report was last modified 4 days ago.

Previous Next


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