GNU bug report logs - #80770
Emacs hangs in sys_close for pipe process on Windows

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Octave Crespel <octave.crespel@HIDDEN>; dated Tue, 7 Apr 2026 22:48:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 14 Apr 2026 11:34:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 14 07:34:54 2026
Received: from localhost ([127.0.0.1]:45465 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wCc2c-0005Fh-8x
	for submit <at> debbugs.gnu.org; Tue, 14 Apr 2026 07:34:53 -0400
Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:54414)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <octave.crespel@HIDDEN>)
 id 1wCc2W-0005Ef-Ph
 for 80770 <at> debbugs.gnu.org; Tue, 14 Apr 2026 07:34:47 -0400
Received: by mail-ej1-x62d.google.com with SMTP id
 a640c23a62f3a-b9382e59c0eso979290766b.0
 for <80770 <at> debbugs.gnu.org>; Tue, 14 Apr 2026 04:34:44 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1776166483; cv=none;
 d=google.com; s=arc-20240605;
 b=Byci9zl+vckNsBcQUrH8zreVCD4BcwU37X9AtXK4BuUOLIpNTFs/M1QzynI+R6UcyR
 SNOJ1hQcYJY+TsZh90YDSFe8ejsHnkiqzSSES/su3co3qk9czTwi3tHhE3tAD7ITSnHu
 v0pihm2N7uyC+fBgkjgxaLPRkr0uX3daLmAF3oBadf8ucOn3RHXhG4GIQEFmgM+qVd38
 ZN7d32DNFFLONEqsB15OZHL5n8x8+G7/Fj4MqwvVIo5ePrL3Su+Q4k8Z+9b4KM8tyhJw
 P8WRSLV3IEnUmU4ehNPmj0NRLbRXL0iPs7I+0NFpQkosQHxDhCNsbHyYPynCtvvoFdLo
 nhcA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=6HpcwLJy+xKAT93G2G7DUQjgC7HG/sFGvCnIsH9gOWk=;
 fh=mdL1Y7hQ0v9jAJu1rLp/7gxa1Axw6eEi8LKvfiPY+zw=;
 b=CdtCAJ7bEYnRnapLnR4z/pronnOpi5D/mrFK45UjIzuUdJnAqpLEXulMPeYfo3r00v
 r8zhAqQ3lEiyou/YHKb2UtsL8WSHjXxSSlTNAII9o6b+G2iswzHJX4zezFGozSfmS2WR
 34FO/R4VbSckfwtNt9MAUwsHBtxJUWd60Oh/fE+9zEKm5uQ7A+epuO8T1KcdAYyfWd5K
 ZcaEzABMWKTnsCLXunP0uTtJ+a57gklfun2oVkcSVGEnh7SLhPyrNXyblNu1S7QLySkt
 8A46UEjAHWBIGCLdrXu6sG7/ilgwCFnmPgW/rt8z0pgs0pXfW8BmdMIoOQncSGSkosbB
 hM7g==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=nerd.nintendo.com; s=google; t=1776166483; x=1776771283; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=6HpcwLJy+xKAT93G2G7DUQjgC7HG/sFGvCnIsH9gOWk=;
 b=bGs5cLB6jLHCJWDP5h7yR4rg9sw6cIw2f0GDHfaQHajfIXRqIHz/zkLCLuSNM1UJ/8
 kR5jMjrLvFaS4x5VTaxXUiiCSFFiSP+9pG0k/BpTSB5GqHdUDu9TfUKaQyJoIuWBzH3i
 nbZxr6fWCVAp5eekDFplahFKgxOL0OPY2Ldkg=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1776166483; x=1776771283;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=6HpcwLJy+xKAT93G2G7DUQjgC7HG/sFGvCnIsH9gOWk=;
 b=GyUaD66f52KWDErGCgWuBZlQC5kik2tpqeBiHkEhCQcb/HIzGvcic6uaizuxrkv5K6
 mKQin8wTCz4MlY4ZoL6vWMm4nsqmzSDEiUo0YpZqmU+r3W2NG4Rl/WfHu2iqZn8VpmGd
 iY1g8JHrNjRVHv75+Fb7MXQpH6OqIWqZke6L1hZ3T1Hy5bBpD8n+1Y8SkAHKgT+02JeI
 9CswSCSohhT9PoMkqMAnVFIOtU9wcQFeLcI+P3Otw1vScGjwrPnwl8ETB2ZZYA8vxkc9
 RM4AYGrbCUIp0WX8y1ZogFH+f/O7FKzBxOOHJj7SIluSEShdbTVyT3U4NlcHCT6C5ZLz
 ibqg==
X-Gm-Message-State: AOJu0YxGYVmybrZ4c5hCXHOTXC8W5CUZDCSm9WjRCykikhd6EGQnSYYZ
 d/UKIrX9S8CAm02kz49OOLb19kP+hXTxuYkB0Tbl+P2bDGBsi212IGJpZWNZWgzeMErNyxOgPUN
 Ho/HbZg749sZ2Th1j4GjpzQYfo+W6awZDCoWVWcl5Kg==
X-Gm-Gg: AeBDievL8RHn+hKSCmn5fDGWRpb/SoyE+BOT5HLIv5r2fjRkpt7Y+LJBmu6spPFo14P
 ou44L2DrvOcK5Ia13W4r2KEvmCFn5/sSXvnywS/BqagpsJcLg4dkSE62VVNBy/5WHI7oAQTOSTp
 vDN4xlqCK6MMWd/f/bfvqbCzl5WmbruuEuqqvybX+N6UIkkNihb3VU8m4MAJiiAXmLCWDVecRa6
 Ce4TjM/cAMnPDvTDSXdAqUxMdA5gBXRLRaUiM4cQzEc/2aUHUDM25SW+bBuP9klkAcyZ/bCcBj2
 Mxn6HPXVRolXrrf2r4VPSwgSqPBZZYQZFPkik+j5tO87hpRu5R4GgHWBcP4WSHah1SG7nD+TS1V
 lnkjp3ltii8gYC46HN25WImAWIswndIaqW02bbXQ83jaRnmg5
X-Received: by 2002:a17:907:8d8e:b0:b96:dec7:5209 with SMTP id
 a640c23a62f3a-b9d7248ab93mr911141766b.17.1776166483146; Tue, 14 Apr 2026
 04:34:43 -0700 (PDT)
MIME-Version: 1.0
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 <86h5pgqvqi.fsf@HIDDEN>
 <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
 <CANn2Ubkw9g8KimxpCxfs_EjrC=o2nCTYjNtERiBjB0X71W=+pg@HIDDEN>
 <86lderoxlp.fsf@HIDDEN> <86cy03ossd.fsf@HIDDEN>
In-Reply-To: <86cy03ossd.fsf@HIDDEN>
From: Octave Crespel <octave.crespel@HIDDEN>
Date: Tue, 14 Apr 2026 13:34:31 +0200
X-Gm-Features: AQROBzC5TeA1EaCYZXoin8V436boSestR01RS8mNVwrXzkwjCJ8IMZDYbPYCmcA
Message-ID: <CANn2Ubnw=5_QnCxTi5vzxZo4zyUb6cv-2QaDabonsrLPA-Tziw@HIDDEN>
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000004a4804064f69fc4c"
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

--0000000000004a4804064f69fc4c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi, thanks for the changes. I now have another error, related to getdelim:

In file included from ../../lib/boot-time.c:60:
../../lib/boot-time-aux.h: In function 'get_windows_boot_time_fallback':
../../lib/boot-time-aux.h:395:26: warning: the comparison will always
evaluate as 'true' for the address of 'GetTickCount64' will never be NULL
-Waddress]
  395 |   if (GetTickCount64Func !=3D NULL)
      |                          ^~
In file included from C:/msys64/mingw64/include/winbase.h:36,
                 from C:/msys64/mingw64/include/windows.h:70,
                 from ../../lib/boot-time.c:48:
C:/msys64/mingw64/include/sysinfoapi.h:42:31: note: 'GetTickCount64'
declared here
   42 |   WINBASEAPI ULONGLONG WINAPI GetTickCount64 (VOID);
      |                               ^~~~~~~~~~~~~~
  CC       getopt1.o
  CC       getrandom.o
  CC       gettime.o
../../lib/getdelim.c:63:1: warning: no previous prototype for 'getdelim'
[-Wmissing-prototypes]
   63 | getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
      | ^~~~~~~~
  CC       gettimeofday.o
../../lib/getline.c:24:1: warning: no previous prototype for 'getline'
[-Wmissing-prototypes]
   24 | getline (char **lineptr, size_t *n, FILE *stream)
      | ^~~~~~~
../../lib/getline.c: In function 'getline':
../../lib/getline.c:26:10: error: implicit declaration of function
'getdelim' [-Wimplicit-function-declaration]
   26 |   return getdelim (lineptr, n, '\n', stream);
      |          ^~~~~~~~
../../lib/getline.c:26:10: warning: nested extern declaration of 'getdelim'
[-Wnested-externs]
  CC       malloc/dynarray_at_failure.o
  CC       malloc/dynarray_emplace_enlarge.o
  CC       malloc/dynarray_finalize.o

Is there an official MinGW (or other compiler) I should use to build Emacs
on Windows without issues ? mingw.org seems to have shut down and been
superseded by mingw-w64.org. (I'm usually a Linux user but I have to use
Windows at work, so I'm a bit less familiar with this ecosystem).

On Mon, Apr 13, 2026 at 4:10=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote:

> > Cc: 80770 <at> debbugs.gnu.org
> > Date: Mon, 13 Apr 2026 15:26:10 +0300
> > From: Eli Zaretskii <eliz@HIDDEN>
> >
> > > From: Octave Crespel <octave.crespel@HIDDEN>
> > > Date: Mon, 13 Apr 2026 10:34:21 +0200
> > >
> > > To clarify, I ended up applying your patch manually on commit
> 4f46593668a, which is the one I was at until
> > > today. I could then build and run, and didn't reproduce the issue.
> >
> > Thanks, I will install the patch soon on the master branch.
>
> I've now installed a slightly more cautious change, please try the
> latest master and tell if the original problem with hangs is solved.
>

--0000000000004a4804064f69fc4c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi, thanks for the changes. I now have another error,=
 related to getdelim:</div><div><br></div><div>In file included from ../../=
lib/boot-time.c:60:<br>../../lib/boot-time-aux.h: In function &#39;get_wind=
ows_boot_time_fallback&#39;:<br>../../lib/boot-time-aux.h:395:26: warning: =
the comparison will always evaluate as &#39;true&#39; for the address of &#=
39;GetTickCount64&#39; will never be NULL -Waddress]<br>=C2=A0 395 | =C2=A0=
 if (GetTickCount64Func !=3D NULL)<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0^~<br>In file included from C:/msys64/mingw64/include/winbase.h:36,<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from C:/msys6=
4/mingw64/include/windows.h:70,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0from ../../lib/boot-time.c:48:<br>C:/msys64/mingw64=
/include/sysinfoapi.h:42:31: note: &#39;GetTickCount64&#39; declared here<b=
r>=C2=A0 =C2=A042 | =C2=A0 WINBASEAPI ULONGLONG WINAPI GetTickCount64 (VOID=
);<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~~~~~~~~~<=
br>=C2=A0 CC =C2=A0 =C2=A0 =C2=A0 getopt1.o<br>=C2=A0 CC =C2=A0 =C2=A0 =C2=
=A0 getrandom.o<br>=C2=A0 CC =C2=A0 =C2=A0 =C2=A0 gettime.o<br>../../lib/ge=
tdelim.c:63:1: warning: no previous prototype for &#39;getdelim&#39; [-Wmis=
sing-prototypes]<br>=C2=A0 =C2=A063 | getdelim (char **lineptr, size_t *n, =
int delimiter, FILE *fp)<br>=C2=A0 =C2=A0 =C2=A0 | ^~~~~~~~<br>=C2=A0 CC =
=C2=A0 =C2=A0 =C2=A0 gettimeofday.o<br>../../lib/getline.c:24:1: warning: n=
o previous prototype for &#39;getline&#39; [-Wmissing-prototypes]<br>=C2=A0=
 =C2=A024 | getline (char **lineptr, size_t *n, FILE *stream)<br>=C2=A0 =C2=
=A0 =C2=A0 | ^~~~~~~<br>../../lib/getline.c: In function &#39;getline&#39;:=
<br>../../lib/getline.c:26:10: error: implicit declaration of function &#39=
;getdelim&#39; [-Wimplicit-function-declaration]<br>=C2=A0 =C2=A026 | =C2=
=A0 return getdelim (lineptr, n, &#39;\n&#39;, stream);<br>=C2=A0 =C2=A0 =
=C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~~~~~~<br>../../lib/getline.c:=
26:10: warning: nested extern declaration of &#39;getdelim&#39; [-Wnested-e=
xterns]<br>=C2=A0 CC =C2=A0 =C2=A0 =C2=A0 malloc/dynarray_at_failure.o<br>=
=C2=A0 CC =C2=A0 =C2=A0 =C2=A0 malloc/dynarray_emplace_enlarge.o<br>=C2=A0 =
CC =C2=A0 =C2=A0 =C2=A0 malloc/dynarray_finalize.o<br><br></div><div>Is the=
re an official MinGW (or other compiler) I should use to build Emacs on Win=
dows without issues ? <a href=3D"http://mingw.org">mingw.org</a> seems to h=
ave shut down and been superseded by <a href=3D"http://mingw-w64.org">mingw=
-w64.org</a>. (I&#39;m usually a Linux user but I have to use Windows at wo=
rk, so I&#39;m a bit less familiar with this ecosystem).</div></div><br><di=
v class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gma=
il_attr">On Mon, Apr 13, 2026 at 4:10=E2=80=AFPM Eli Zaretskii &lt;<a href=
=3D"mailto:eliz@HIDDEN">eliz@HIDDEN</a>&gt; wrote:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">&gt; Cc: <a href=3D"mailto:80770@debbu=
gs.gnu.org" target=3D"_blank">80770 <at> debbugs.gnu.org</a><br>
&gt; Date: Mon, 13 Apr 2026 15:26:10 +0300<br>
&gt; From: Eli Zaretskii &lt;<a href=3D"mailto:eliz@HIDDEN" target=3D"_bla=
nk">eliz@HIDDEN</a>&gt;<br>
&gt; <br>
&gt; &gt; From: Octave Crespel &lt;<a href=3D"mailto:octave.crespel@HIDDEN=
ntendo.com" target=3D"_blank">octave.crespel@HIDDEN</a>&gt;<br>
&gt; &gt; Date: Mon, 13 Apr 2026 10:34:21 +0200<br>
&gt; &gt; <br>
&gt; &gt; To clarify, I ended up applying your patch manually on commit 4f4=
6593668a, which is the one I was at until<br>
&gt; &gt; today. I could then build and run, and didn&#39;t reproduce the i=
ssue.<br>
&gt; <br>
&gt; Thanks, I will install the patch soon on the master branch.<br>
<br>
I&#39;ve now installed a slightly more cautious change, please try the<br>
latest master and tell if the original problem with hangs is solved.<br>
</blockquote></div>

--0000000000004a4804064f69fc4c--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 13 Apr 2026 14:10:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 13 10:10:30 2026
Received: from localhost ([127.0.0.1]:47339 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wCHzg-0003E3-9z
	for submit <at> debbugs.gnu.org; Mon, 13 Apr 2026 10:10:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50404)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wCHza-0003CH-Ma
 for 80770 <at> debbugs.gnu.org; Mon, 13 Apr 2026 10:10:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wCHzU-0007jb-Kz; Mon, 13 Apr 2026 10:10:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=sq/6CPY+S7ubmiP2UHlGdmyfszdey9AF2W+a0tqXsUo=; b=NMh0Gf5bPO2x
 uLMJL0PMkb43DSr/IhzOBAkDv74Rs9YJxQWhzuiDf2opBL0WMi7ZqRhVPqbCL1LB7clRGOZfqO+2E
 ymdezxY4FcL+XGHjh26Kcg1mvKBWLZYWyDJcHTPOBWm9tSK1XS456M7LqED5Ui0p22hPPtNFJvdxO
 3mfskcWBnVuEN+/OexM3EuL/HjvRZOZXbs04LtHI2d8CCbaTgn4VtO58f/ZQNRiK4zB3f7Hq3zl+7
 kW/nGk4HIGJ5BX9Z9ZRPv69ns+j2cDma75J5IoJLLYtOjAMjkX/aHn95gHptnq/hpLrAtsNR6WbEv
 aJ50D8sXHWtpD3yViMs+sw==;
Date: Mon, 13 Apr 2026 17:10:10 +0300
Message-Id: <86cy03ossd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: octave.crespel@HIDDEN
In-Reply-To: <86lderoxlp.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 13
 Apr 2026 15:26:10 +0300)
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 <86h5pgqvqi.fsf@HIDDEN>
 <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
 <CANn2Ubkw9g8KimxpCxfs_EjrC=o2nCTYjNtERiBjB0X71W=+pg@HIDDEN>
 <86lderoxlp.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 80770 <at> debbugs.gnu.org
> Date: Mon, 13 Apr 2026 15:26:10 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Octave Crespel <octave.crespel@HIDDEN>
> > Date: Mon, 13 Apr 2026 10:34:21 +0200
> > 
> > To clarify, I ended up applying your patch manually on commit 4f46593668a, which is the one I was at until
> > today. I could then build and run, and didn't reproduce the issue.
> 
> Thanks, I will install the patch soon on the master branch.

I've now installed a slightly more cautious change, please try the
latest master and tell if the original problem with hangs is solved.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 13 Apr 2026 13:35:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 13 09:35:54 2026
Received: from localhost ([127.0.0.1]:46462 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wCHSD-00078h-My
	for submit <at> debbugs.gnu.org; Mon, 13 Apr 2026 09:35:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50158)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wCHS9-00077W-NJ
 for 80770 <at> debbugs.gnu.org; Mon, 13 Apr 2026 09:35:51 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wCHS4-0000hl-4l; Mon, 13 Apr 2026 09:35:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=H3k2YMWw0SkExe9FqhcKf8aXKHt1b1yvSDeZdKbST4I=; b=m1iwvwBDze+J
 ntIJ+IPmU6pvouve0g2aTWsjZ86jIn626pYyB/9JfP1p6YwfMCp1pp28746rpKVU6giXf6Fd4Mwyy
 4aJvcYq19fmFyx8s+qnqUdJLc6+OAe7peeAUtocjs55UeedroE/rThmzTqyglSCmzva3B9BXp7w4x
 3BgAT9J8W5PgcqNoRFMKNPef9WFvnRUNbt1EBpl7eSVOPjRpi+oOZR/aP8Kryh61ieiIqThJWbVcO
 +t5FMSk3Y0IlJkElaiWfw/WN1mSNhqH1TRZVOz51eC7Pkr6clpLhQPGBtkhZAh1Paw13HYBacLAot
 TfDKfor+Ss0+eUO+ZnJn9Q==;
Date: Mon, 13 Apr 2026 16:35:41 +0300
Message-Id: <86eckjoudu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: octave.crespel@HIDDEN
In-Reply-To: <86mrz7oxpn.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 13
 Apr 2026 15:23:48 +0300)
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 <86h5pgqvqi.fsf@HIDDEN>
 <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
 <86mrz7oxpn.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 80770 <at> debbugs.gnu.org
> Date: Mon, 13 Apr 2026 15:23:48 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > Two minor issues though: I couldn't build emacs on the latest master
> > (7d07690e5dade398da8a26805744f8bf1daafe8c), because of the following error:
> >   CCLD     emacsclientw.exe
> > ../../lib-src/emacsclient.c: In function 'get_server_config':
> > ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline' [-Wimplicit-function-declaration]
> >  1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
> >       |                       ^~~~~~~
> > ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]
> > make[2]: *** [Makefile:439: emacsclient.exe] Error 1
> > make[2]: *** Waiting for unfinished jobs....
> > ../../lib-src/emacsclient.c: In function 'get_server_config':
> > ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline' [-Wimplicit-function-declaration]
> >  1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
> >       |                       ^~~~~~~
> > ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]
> 
> The function getline comes from Gnulib, and the Makefile is supposed
> to cause emacsclientw to be linked against ../lib/libgnu.a.  If you
> still have this problem with the latest master branch, maybe try a
> clean build.

Ignore this.  The real cause of this is that MinGW64 (which you are
using to build) doesn't have getline in its runtime, so we now need to
build the Gnulib getline module on MS-Windows if the system libraries
don't have it (mingw.org's MinGW does have this function in its
runtime).  I've installed a fix, which should allow you to build the
latest master, assuming you re-run autogen.sh and the configure script.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 13 Apr 2026 12:26:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 13 08:26:37 2026
Received: from localhost ([127.0.0.1]:44690 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wCGN5-0004Cm-Ic
	for submit <at> debbugs.gnu.org; Mon, 13 Apr 2026 08:26:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57962)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wCGMu-0004B5-4n
 for 80770 <at> debbugs.gnu.org; Mon, 13 Apr 2026 08:26:28 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wCGMm-0001tR-So; Mon, 13 Apr 2026 08:26:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=vodFrbMEmohB4ZcmF1CbucWnfQEk4PpZYaF//w9XhVU=; b=JYD+VfgqEdEjX7FY8HJs
 joEwYJW11cVcSpfj95xH4p1iYjjXO5zNPjCgoqn0hcaByzrJ5FH8cGh4bXfNtEWE767mCpjLfzWfM
 PSKrM+KosMwP3ifWACe/NHN7ZZSPL+1EUr+BYf8ILHHOSl4kqWJ5CQGgdEPn/2jc4zMh1tWFRXonq
 AYen9Te+gGMMhmc54DsBFGTPtndUdjCK0dDTQVlr0n7Ybe2g80UQjAIQUbXv5meZBAVnWiOSFWNGu
 AJct3UXMT5x84np6E6JGS3/L3VzoOoGTCb/d58NcTXRSchV9tzb7mizHteWobe6xv6gEkc17LlidI
 e5wD8j2GRyzmEg==;
Date: Mon, 13 Apr 2026 15:26:10 +0300
Message-Id: <86lderoxlp.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Octave Crespel <octave.crespel@HIDDEN>
In-Reply-To: <CANn2Ubkw9g8KimxpCxfs_EjrC=o2nCTYjNtERiBjB0X71W=+pg@HIDDEN>
 (message from Octave Crespel on Mon, 13 Apr 2026 10:34:21 +0200)
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 <86h5pgqvqi.fsf@HIDDEN>
 <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
 <CANn2Ubkw9g8KimxpCxfs_EjrC=o2nCTYjNtERiBjB0X71W=+pg@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Octave Crespel <octave.crespel@HIDDEN>
> Date: Mon, 13 Apr 2026 10:34:21 +0200
> 
> To clarify, I ended up applying your patch manually on commit 4f46593668a, which is the one I was at until
> today. I could then build and run, and didn't reproduce the issue.

Thanks, I will install the patch soon on the master branch.

> On Mon, Apr 13, 2026 at 10:29 AM Octave Crespel <octave.crespel@HIDDEN> wrote:
> 
>  Thanks for the reply! The patch looks like it works.
> 
>  Two minor issues though: I couldn't build emacs on the latest master
>  (7d07690e5dade398da8a26805744f8bf1daafe8c), because of the following error:
>    CCLD     emacsclientw.exe
>  ../../lib-src/emacsclient.c: In function 'get_server_config':
>  ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline'
>  [-Wimplicit-function-declaration]
>   1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
>        |                       ^~~~~~~
>  ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]
>  make[2]: *** [Makefile:439: emacsclient.exe] Error 1
>  make[2]: *** Waiting for unfinished jobs....
>  ../../lib-src/emacsclient.c: In function 'get_server_config':
>  ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline'
>  [-Wimplicit-function-declaration]
>   1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
>        |                       ^~~~~~~
>  ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]
> 
>  And trying to apply your patch with git apply failed with the following error, so I had to make the changes
>  manually:
>  error: patch failed: src/w32.c:8724
>  error: src/w32.c: patch does not apply
> 
>  Do you know what could cause these ? If necessary I can send a new bug report for the first one.
> 
>  On Sun, Apr 12, 2026 at 1:11 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> 
>  > Date: Tue, 7 Apr 2026 14:31:12 +0200
>  > From:  Octave Crespel via "Bug reports for GNU Emacs,
>  >  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>  > 
>  > This is my first Emacs bug report, apologies if I'm doing something incorrectly.
> 
>  No need to apologize, you are doing just fine.
> 
>  > When I run 'counsel-ag and edit the text several times in a row quickly,
>  > Emacs ends up hanging. This bug has the same symptoms as #52414, except
>  > that one is reportedly fixed.
>  > 
>  > Here is a minimal (ish) .emacs file to reproduce the bug:
>  > 
>  > ;;; -*- lexical-binding: t -*-
>  > (require 'package)
>  > (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
>  > (package-initialize)
>  > 
>  > (unless (package-installed-p 'use-package)
>  >   (package-install 'use-package))
>  > 
>  > (require 'use-package)
>  > (setq use-package-always-ensure t)
>  > 
>  > ;; Use Ivy for completion
>  > (use-package ivy
>  >   :diminish
>  >   :init (ivy-mode 1)
>  >   )
>  > 
>  > ;; Use counsel for better default functions with Ivy
>  > (use-package counsel
>  >   :init (counsel-mode 1)
>  >   :bind (("C-x b" . counsel-ibuffer)
>  > ("C-M-j" . counsel-switch-buffer)
>  > :map minibuffer-local-map
>  > ("C-r" . 'counsel-minibuffer-history)))
>  > 
>  > (global-set-key (kbd "C-c f") 'counsel-ag)
>  > 
>  > Here is the backtrace from the main thread:
>  > 
>  > #0  0x00007ff8a94e56e4 in ntdll!ZwWaitForAlertByThreadId () from
>  C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #1  0x00007ff8a938af5f in ntdll!RtlRaiseException () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #2  0x00007ff8a938c67f in ntdll!RtlSleepConditionVariableCS () from
>  C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #3  0x00007ff8a938d8f2 in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #4  0x00007ff8a7360077 in msvcrt!_setmode () from C:\WINDOWS\System32\msvcrt.dll
>  > #5  0x00007ff8a735e662 in msvcrt!_close () from C:\WINDOWS\System32\msvcrt.dll
>  > #6  0x00007ff7353cb509 in sys_close (fd=5) at ../../src/w32.c:8783
>  > #7  0x00007ff73520dbe3 in posix_close (fd=5, flag=1) at ../../src/sysdep.c:2604
>  > #8  0x00007ff73520dc23 in emacs_close (fd=5) at ../../src/sysdep.c:2627
>  > #9  0x00007ff73531f2fc in close_process_fd (fd_addr=0x11684674) at ../../src/process.c:2116
>  > #10 0x00007ff735323aa1 in deactivate_process (proc=0x116845a5) at ../../src/process.c:4840
>  > #11 0x00007ff73531c4e3 in remove_process (proc=0x116845a5) at ../../src/process.c:965
>  > #12 0x00007ff73532a59e in status_notify (deleting_process=0x116845a0, wait_proc=0x0) at .
>  > ./../src/process.c:7921
>  > #13 0x00007ff73531ca80 in Fdelete_process (process=0x116845a5) at ../../src/process.c:1149
>  > #14 0x00007ff7352afafc in funcall_subr (subr=0x1141d8e0, numargs=1, args=0xbfc9b8) at .
>  ./../src/eval.c:3252
>  > #15 0x00007ff7352af4f6 in funcall_general (fun=0x1141d8e5, numargs=1, args=0xbfc9b8) at .
>  > ./../src/eval.c:3131
>  > #16 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfc9b0) at ../../src/eval.c:3184
>  > #17 0x00007ff83fd22180 in
>  > F636f756e73656c2d2d6173796e632d636f6d6d616e642d31_counsel__async_command_1_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #18 0x00007ff7352afb95 in funcall_subr (subr=0x115b7850, numargs=1, args=0xbfcc88) at .
>  ./../src/eval.c:3258
>  > #19 0x00007ff7352af4f6 in funcall_general (fun=0x115b7855, numargs=1, args=0xbfcc88) at .
>  > ./../src/eval.c:3131
>  > #20 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcc80) at ../../src/eval.c:3184
>  > #21 0x00007ff7352ae93a in Fapply (nargs=2, args=0xbfcc80) at ../../src/eval.c:2798
>  > #22 0x00007ff83fd2235f in
>  > F636f756e73656c2d2d6173796e632d636f6d6d616e64_counsel__async_command_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #23 0x00007ff7352afd59 in funcall_subr (subr=0x115b78b0, numargs=1, args=0xbfcec8) at .
>  ./../src/eval.c:3275
>  > #24 0x00007ff7352af4f6 in funcall_general (fun=0x115b78b5, numargs=1, args=0xbfcec8) at .
>  > ./../src/eval.c:3131
>  > #25 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcec0) at ../../src/eval.c:3184
>  > #26 0x00007ff83fd32c35 in
>  F636f756e73656c2d61672d66756e6374696f6e_counsel_ag_function_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #27 0x00007ff7352afafc in funcall_subr (subr=0x1151c390, numargs=1, args=0xbfd100) at .
>  ./../src/eval.c:3252
>  > #28 0x00007ff7352af4f6 in funcall_general (fun=0x1151c395, numargs=1, args=0xbfd100) at .
>  > ./../src/eval.c:3131
>  > #29 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd0f8) at ../../src/eval.c:3184
>  > #30 0x00007ff83fe85e50 in
>  >
>  F6976792d2d64796e616d69632d636f6c6c656374696f6e2d63616e6473_ivy__dynamic_collection_cands_0
>  
>  > ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #31 0x00007ff7352afafc in funcall_subr (subr=0x113d2c00, numargs=1, args=0xbfd300) at .
>  ./../src/eval.c:3252
>  > #32 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c05, numargs=1, args=0xbfd300) at .
>  > ./../src/eval.c:3131
>  > #33 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd2f8) at ../../src/eval.c:3184
>  > #34 0x00007ff83fe86bd9 in
>  > F6976792d2d7570646174652d6d696e69627566666572_ivy__update_minibuffer_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #35 0x00007ff7352afae3 in funcall_subr (subr=0x113d2c60, numargs=0, args=0xbfd4d0) at .
>  > ./../src/eval.c:3250
>  > #36 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c65, numargs=0, args=0xbfd4d0) at .
>  > ./../src/eval.c:3131
>  > #37 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd4c8) at ../../src/eval.c:3184
>  > #38 0x00007ff83fe85c04 in F6976792d2d65786869626974_ivy__exhibit_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #39 0x00007ff7352afae3 in funcall_subr (subr=0x113d2ba0, numargs=0, args=0xbfd6d8) at .
>  > ./../src/eval.c:3250
>  > #40 0x00007ff7352af4f6 in funcall_general (fun=0x113d2ba5, numargs=0, args=0xbfd6d8) at .
>  > ./../src/eval.c:3131
>  > #41 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd6d0) at ../../src/eval.c:3184
>  > #42 0x00007ff83fe8579c in
>  F6976792d2d71756575652d65786869626974_ivy__queue_exhibit_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #43 0x00007ff7352afae3 in funcall_subr (subr=0x113d1d80, numargs=0, args=0xbfd950) at .
>  > ./../src/eval.c:3250
>  > #44 0x00007ff7352af4f6 in funcall_general (fun=0x113d1d85, numargs=0, args=0xbfd950) at .
>  > ./../src/eval.c:3131
>  > #45 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd948) at ../../src/eval.c:3184
>  > #46 0x00007ff7351e5d21 in safe_run_hooks_1 (nargs=2, args=0xbfd940) at .
>  ./../src/keyboard.c:1901
>  > #47 0x00007ff7352abe8f in internal_condition_case_n (bfun=0x7ff7351e5cfa
>  <safe_run_hooks_1>, nargs=2,
>  > args=0xbfd940, handlers=0x30,
>  >     hfun=0x7ff7351e5d27 <safe_run_hooks_error>) at ../../src/eval.c:1769
>  > #48 0x00007ff7351e62a7 in safe_run_hook_funcall (nargs=2, args=0xbfda20) at .
>  ./../src/keyboard.c:1959
>  > #49 0x00007ff7352af12c in run_hook_with_args (nargs=2, args=0xbfda20,
>  funcall=0x7ff7351e6152
>  > <safe_run_hook_funcall>) at ../../src/eval.c:3029
>  > #50 0x00007ff7351e649f in safe_run_hooks_maybe_narrowed (hook=0xf690, w=0x58962c0) at .
>  > ./../src/keyboard.c:1997
>  > #51 0x00007ff7351e4544 in command_loop_1 () at ../../src/keyboard.c:1563
>  > #52 0x00007ff7352abc3f in internal_condition_case (bfun=0x7ff7351e3b4c <command_loop_1>,
>  > handlers=0x90, hfun=0x7ff7351e2f47 <cmd_error>)
>  >     at ../../src/eval.c:1689
>  > #53 0x00007ff7351e3747 in command_loop_2 (handlers=0x90) at ../../src/keyboard.c:1163
>  > #54 0x00007ff7352ab1d5 in internal_catch (tag=0x7b00, func=0x7ff7351e371b
>  <command_loop_2>,
>  > arg=0x90) at ../../src/eval.c:1369
>  > #55 0x00007ff7351e3612 in command_loop () at ../../src/keyboard.c:1133
>  > #56 0x0000000000000000 in ?? ()
>  > 
>  > And here is the backtrace from the reader thread :
>  > 
>  > #0  0x00007ff8a94e1b54 in ntdll!ZwReadFile () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #1  0x00007ff8a6d61e3d in ReadFile () from C:\WINDOWS\System32\KernelBase.dll
>  > #2  0x00007ff8a736238c in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
>  > #3  0x00007ff8a7361ffa in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
>  > #4  0x00007ff7353cb971 in _sys_read_ahead (fd=5) at ../../src/w32.c:8936
>  > #5  0x00007ff7353d8956 in reader_thread (arg=0x7ff735610390 <child_procs+144>) at .
>  > ./../src/w32proc.c:2024
>  > #6  0x00007ff8a7bde8d7 in KERNEL32!BaseThreadInitThunk () from
>  C:\WINDOWS\System32\kernel32.dll
>  > #7  0x00007ff8a940c48c in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #8  0x0000000000000000 in ?? ()
>  > 
>  > I looked through the relevant code in process.c and w32.c but couldn't
>  > find anything obvious. Let me know if there's anything I can do to help.
> 
>  Assuming you can reproduce this at will, and can also build your
>  Emacs, please try the patch below:
> 
>  diff --git a/src/w32.c b/src/w32.c
>  index 0b8c21e..3cf2eb2 100644
>  --- a/src/w32.c
>  +++ b/src/w32.c
>  @@ -8706,6 +8706,7 @@ sys_close (int fd)
>   {
>     int rc = -1;
>     bool reader_thread_exited = false;
>  +  bool reader_thread_reading = false;
> 
>     if (fd < 0)
>       {
>  @@ -8724,6 +8725,9 @@ sys_close (int fd)
>            && thrd_status != STILL_ACTIVE)
>          reader_thread_exited = true;
> 
>  +      if (cp->thrd != NULL && cp->status == STATUS_READ_IN_PROGRESS)
>  +       reader_thread_reading = true;
>  +
>         fd_info[fd].cp = NULL;
> 
>         if (CHILD_ACTIVE (cp))
>  @@ -8773,7 +8777,8 @@ sys_close (int fd)
>        because socket handles are fully fledged kernel handles. */
>     if (fd < MAXDESC)
>       {
>  -      if ((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
>  +      if (((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
>  +          && !reader_thread_reading)
>            /* If the reader thread already exited, close the descriptor,
>               since otherwise no one will close it, and we will be
>               leaking descriptors.  */




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 13 Apr 2026 12:24:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 13 08:24:04 2026
Received: from localhost ([127.0.0.1]:44664 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wCGKg-0003rS-QS
	for submit <at> debbugs.gnu.org; Mon, 13 Apr 2026 08:24:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38296)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wCGKd-0003qE-5f
 for 80770 <at> debbugs.gnu.org; Mon, 13 Apr 2026 08:24:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wCGKX-0001NF-EF; Mon, 13 Apr 2026 08:23:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=ahNgBOjt8ZV52g+noXfdwurTRpDplTW3sENc24mV9Ac=; b=ACyEkFtjNhzslaoMgrxj
 tGwCjgeNHz8KgX17CqOu1oqH9toRNLfo+lzEmlSA6+9jONPJqkH2vB/9XnPvRUbH59Yrit2mde6Bv
 aExIx8Ct2LtWtZBl7pen7JEV8jGANWmNmZMus5jkJ/6difNyQnm/G62WKvor+aHbg3+U7fuMHP/PX
 4fzg4GBxqK1xt7FZY7b4NqOT8kvI+ZI6hUiwyH6cGyqqHdE/uL54WoPSFpumsfM7To0dw5XKKS5LE
 c6UunfnpYZY5MpGnNjHGDuNeL8y6m4BdtX5BDMjytDO65cXx1V7EMXzXtH3ascF6dgcExLCgBpQ1A
 p2raU/Uce5SEzw==;
Date: Mon, 13 Apr 2026 15:23:48 +0300
Message-Id: <86mrz7oxpn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Octave Crespel <octave.crespel@HIDDEN>
In-Reply-To: <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
 (message from Octave Crespel on Mon, 13 Apr 2026 10:29:35 +0200)
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 <86h5pgqvqi.fsf@HIDDEN>
 <CANn2Ub=NJ_cW4aWQh3m=kda9UH6kPKO+GVFpQ5xgEbi88yhAgw@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

[Please always use Reply to All to reply, to keep the bug tracker CC'ed.]

> From: Octave Crespel <octave.crespel@HIDDEN>
> Date: Mon, 13 Apr 2026 10:29:35 +0200
> 
> Thanks for the reply! The patch looks like it works.

Great, thanks for testing.

> Two minor issues though: I couldn't build emacs on the latest master
> (7d07690e5dade398da8a26805744f8bf1daafe8c), because of the following error:
>   CCLD     emacsclientw.exe
> ../../lib-src/emacsclient.c: In function 'get_server_config':
> ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline' [-Wimplicit-function-declaration]
>  1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
>       |                       ^~~~~~~
> ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]
> make[2]: *** [Makefile:439: emacsclient.exe] Error 1
> make[2]: *** Waiting for unfinished jobs....
> ../../lib-src/emacsclient.c: In function 'get_server_config':
> ../../lib-src/emacsclient.c:1027:23: error: implicit declaration of function 'getline' [-Wimplicit-function-declaration]
>  1027 |   ssize_t dottedlen = getline (&dotted, &dottedsize, config);
>       |                       ^~~~~~~
> ../../lib-src/emacsclient.c:1027:23: warning: nested extern declaration of 'getline' [-Wnested-externs]

The function getline comes from Gnulib, and the Makefile is supposed
to cause emacsclientw to be linked against ../lib/libgnu.a.  If you
still have this problem with the latest master branch, maybe try a
clean build.

> And trying to apply your patch with git apply failed with the following error, so I had to make the changes
> manually:
> error: patch failed: src/w32.c:8724
> error: src/w32.c: patch does not apply
> 
> Do you know what could cause these ? If necessary I can send a new bug report for the first one.

No clue about the patch failure, sorry.

> 
> On Sun, Apr 12, 2026 at 1:11 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> 
>  > Date: Tue, 7 Apr 2026 14:31:12 +0200
>  > From:  Octave Crespel via "Bug reports for GNU Emacs,
>  >  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>  > 
>  > This is my first Emacs bug report, apologies if I'm doing something incorrectly.
> 
>  No need to apologize, you are doing just fine.
> 
>  > When I run 'counsel-ag and edit the text several times in a row quickly,
>  > Emacs ends up hanging. This bug has the same symptoms as #52414, except
>  > that one is reportedly fixed.
>  > 
>  > Here is a minimal (ish) .emacs file to reproduce the bug:
>  > 
>  > ;;; -*- lexical-binding: t -*-
>  > (require 'package)
>  > (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
>  > (package-initialize)
>  > 
>  > (unless (package-installed-p 'use-package)
>  >   (package-install 'use-package))
>  > 
>  > (require 'use-package)
>  > (setq use-package-always-ensure t)
>  > 
>  > ;; Use Ivy for completion
>  > (use-package ivy
>  >   :diminish
>  >   :init (ivy-mode 1)
>  >   )
>  > 
>  > ;; Use counsel for better default functions with Ivy
>  > (use-package counsel
>  >   :init (counsel-mode 1)
>  >   :bind (("C-x b" . counsel-ibuffer)
>  > ("C-M-j" . counsel-switch-buffer)
>  > :map minibuffer-local-map
>  > ("C-r" . 'counsel-minibuffer-history)))
>  > 
>  > (global-set-key (kbd "C-c f") 'counsel-ag)
>  > 
>  > Here is the backtrace from the main thread:
>  > 
>  > #0  0x00007ff8a94e56e4 in ntdll!ZwWaitForAlertByThreadId () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #1  0x00007ff8a938af5f in ntdll!RtlRaiseException () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #2  0x00007ff8a938c67f in ntdll!RtlSleepConditionVariableCS () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #3  0x00007ff8a938d8f2 in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #4  0x00007ff8a7360077 in msvcrt!_setmode () from C:\WINDOWS\System32\msvcrt.dll
>  > #5  0x00007ff8a735e662 in msvcrt!_close () from C:\WINDOWS\System32\msvcrt.dll
>  > #6  0x00007ff7353cb509 in sys_close (fd=5) at ../../src/w32.c:8783
>  > #7  0x00007ff73520dbe3 in posix_close (fd=5, flag=1) at ../../src/sysdep.c:2604
>  > #8  0x00007ff73520dc23 in emacs_close (fd=5) at ../../src/sysdep.c:2627
>  > #9  0x00007ff73531f2fc in close_process_fd (fd_addr=0x11684674) at ../../src/process.c:2116
>  > #10 0x00007ff735323aa1 in deactivate_process (proc=0x116845a5) at ../../src/process.c:4840
>  > #11 0x00007ff73531c4e3 in remove_process (proc=0x116845a5) at ../../src/process.c:965
>  > #12 0x00007ff73532a59e in status_notify (deleting_process=0x116845a0, wait_proc=0x0) at .
>  > ./../src/process.c:7921
>  > #13 0x00007ff73531ca80 in Fdelete_process (process=0x116845a5) at ../../src/process.c:1149
>  > #14 0x00007ff7352afafc in funcall_subr (subr=0x1141d8e0, numargs=1, args=0xbfc9b8) at .
>  ./../src/eval.c:3252
>  > #15 0x00007ff7352af4f6 in funcall_general (fun=0x1141d8e5, numargs=1, args=0xbfc9b8) at .
>  > ./../src/eval.c:3131
>  > #16 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfc9b0) at ../../src/eval.c:3184
>  > #17 0x00007ff83fd22180 in
>  > F636f756e73656c2d2d6173796e632d636f6d6d616e642d31_counsel__async_command_1_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #18 0x00007ff7352afb95 in funcall_subr (subr=0x115b7850, numargs=1, args=0xbfcc88) at .
>  ./../src/eval.c:3258
>  > #19 0x00007ff7352af4f6 in funcall_general (fun=0x115b7855, numargs=1, args=0xbfcc88) at .
>  > ./../src/eval.c:3131
>  > #20 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcc80) at ../../src/eval.c:3184
>  > #21 0x00007ff7352ae93a in Fapply (nargs=2, args=0xbfcc80) at ../../src/eval.c:2798
>  > #22 0x00007ff83fd2235f in
>  > F636f756e73656c2d2d6173796e632d636f6d6d616e64_counsel__async_command_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #23 0x00007ff7352afd59 in funcall_subr (subr=0x115b78b0, numargs=1, args=0xbfcec8) at .
>  ./../src/eval.c:3275
>  > #24 0x00007ff7352af4f6 in funcall_general (fun=0x115b78b5, numargs=1, args=0xbfcec8) at .
>  > ./../src/eval.c:3131
>  > #25 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcec0) at ../../src/eval.c:3184
>  > #26 0x00007ff83fd32c35 in F636f756e73656c2d61672d66756e6374696f6e_counsel_ag_function_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
>  > #27 0x00007ff7352afafc in funcall_subr (subr=0x1151c390, numargs=1, args=0xbfd100) at .
>  ./../src/eval.c:3252
>  > #28 0x00007ff7352af4f6 in funcall_general (fun=0x1151c395, numargs=1, args=0xbfd100) at .
>  > ./../src/eval.c:3131
>  > #29 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd0f8) at ../../src/eval.c:3184
>  > #30 0x00007ff83fe85e50 in
>  >
>  F6976792d2d64796e616d69632d636f6c6c656374696f6e2d63616e6473_ivy__dynamic_collection_cands_0
>  
>  > ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #31 0x00007ff7352afafc in funcall_subr (subr=0x113d2c00, numargs=1, args=0xbfd300) at .
>  ./../src/eval.c:3252
>  > #32 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c05, numargs=1, args=0xbfd300) at .
>  > ./../src/eval.c:3131
>  > #33 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd2f8) at ../../src/eval.c:3184
>  > #34 0x00007ff83fe86bd9 in
>  > F6976792d2d7570646174652d6d696e69627566666572_ivy__update_minibuffer_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #35 0x00007ff7352afae3 in funcall_subr (subr=0x113d2c60, numargs=0, args=0xbfd4d0) at .
>  > ./../src/eval.c:3250
>  > #36 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c65, numargs=0, args=0xbfd4d0) at .
>  > ./../src/eval.c:3131
>  > #37 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd4c8) at ../../src/eval.c:3184
>  > #38 0x00007ff83fe85c04 in F6976792d2d65786869626974_ivy__exhibit_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #39 0x00007ff7352afae3 in funcall_subr (subr=0x113d2ba0, numargs=0, args=0xbfd6d8) at .
>  > ./../src/eval.c:3250
>  > #40 0x00007ff7352af4f6 in funcall_general (fun=0x113d2ba5, numargs=0, args=0xbfd6d8) at .
>  > ./../src/eval.c:3131
>  > #41 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd6d0) at ../../src/eval.c:3184
>  > #42 0x00007ff83fe8579c in F6976792d2d71756575652d65786869626974_ivy__queue_exhibit_0 ()
>  >    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
>  > #43 0x00007ff7352afae3 in funcall_subr (subr=0x113d1d80, numargs=0, args=0xbfd950) at .
>  > ./../src/eval.c:3250
>  > #44 0x00007ff7352af4f6 in funcall_general (fun=0x113d1d85, numargs=0, args=0xbfd950) at .
>  > ./../src/eval.c:3131
>  > #45 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd948) at ../../src/eval.c:3184
>  > #46 0x00007ff7351e5d21 in safe_run_hooks_1 (nargs=2, args=0xbfd940) at ../../src/keyboard.c:1901
>  > #47 0x00007ff7352abe8f in internal_condition_case_n (bfun=0x7ff7351e5cfa <safe_run_hooks_1>,
>  nargs=2,
>  > args=0xbfd940, handlers=0x30,
>  >     hfun=0x7ff7351e5d27 <safe_run_hooks_error>) at ../../src/eval.c:1769
>  > #48 0x00007ff7351e62a7 in safe_run_hook_funcall (nargs=2, args=0xbfda20) at .
>  ./../src/keyboard.c:1959
>  > #49 0x00007ff7352af12c in run_hook_with_args (nargs=2, args=0xbfda20, funcall=0x7ff7351e6152
>  > <safe_run_hook_funcall>) at ../../src/eval.c:3029
>  > #50 0x00007ff7351e649f in safe_run_hooks_maybe_narrowed (hook=0xf690, w=0x58962c0) at .
>  > ./../src/keyboard.c:1997
>  > #51 0x00007ff7351e4544 in command_loop_1 () at ../../src/keyboard.c:1563
>  > #52 0x00007ff7352abc3f in internal_condition_case (bfun=0x7ff7351e3b4c <command_loop_1>,
>  > handlers=0x90, hfun=0x7ff7351e2f47 <cmd_error>)
>  >     at ../../src/eval.c:1689
>  > #53 0x00007ff7351e3747 in command_loop_2 (handlers=0x90) at ../../src/keyboard.c:1163
>  > #54 0x00007ff7352ab1d5 in internal_catch (tag=0x7b00, func=0x7ff7351e371b <command_loop_2>,
>  > arg=0x90) at ../../src/eval.c:1369
>  > #55 0x00007ff7351e3612 in command_loop () at ../../src/keyboard.c:1133
>  > #56 0x0000000000000000 in ?? ()
>  > 
>  > And here is the backtrace from the reader thread :
>  > 
>  > #0  0x00007ff8a94e1b54 in ntdll!ZwReadFile () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #1  0x00007ff8a6d61e3d in ReadFile () from C:\WINDOWS\System32\KernelBase.dll
>  > #2  0x00007ff8a736238c in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
>  > #3  0x00007ff8a7361ffa in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
>  > #4  0x00007ff7353cb971 in _sys_read_ahead (fd=5) at ../../src/w32.c:8936
>  > #5  0x00007ff7353d8956 in reader_thread (arg=0x7ff735610390 <child_procs+144>) at .
>  > ./../src/w32proc.c:2024
>  > #6  0x00007ff8a7bde8d7 in KERNEL32!BaseThreadInitThunk () from
>  C:\WINDOWS\System32\kernel32.dll
>  > #7  0x00007ff8a940c48c in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
>  > #8  0x0000000000000000 in ?? ()
>  > 
>  > I looked through the relevant code in process.c and w32.c but couldn't
>  > find anything obvious. Let me know if there's anything I can do to help.
> 
>  Assuming you can reproduce this at will, and can also build your
>  Emacs, please try the patch below:
> 
>  diff --git a/src/w32.c b/src/w32.c
>  index 0b8c21e..3cf2eb2 100644
>  --- a/src/w32.c
>  +++ b/src/w32.c
>  @@ -8706,6 +8706,7 @@ sys_close (int fd)
>   {
>     int rc = -1;
>     bool reader_thread_exited = false;
>  +  bool reader_thread_reading = false;
> 
>     if (fd < 0)
>       {
>  @@ -8724,6 +8725,9 @@ sys_close (int fd)
>            && thrd_status != STILL_ACTIVE)
>          reader_thread_exited = true;
> 
>  +      if (cp->thrd != NULL && cp->status == STATUS_READ_IN_PROGRESS)
>  +       reader_thread_reading = true;
>  +
>         fd_info[fd].cp = NULL;
> 
>         if (CHILD_ACTIVE (cp))
>  @@ -8773,7 +8777,8 @@ sys_close (int fd)
>        because socket handles are fully fledged kernel handles. */
>     if (fd < MAXDESC)
>       {
>  -      if ((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
>  +      if (((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
>  +          && !reader_thread_reading)
>            /* If the reader thread already exited, close the descriptor,
>               since otherwise no one will close it, and we will be
>               leaking descriptors.  */




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at 80770 <at> debbugs.gnu.org:


Received: (at 80770) by debbugs.gnu.org; 12 Apr 2026 11:11:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 12 07:11:33 2026
Received: from localhost ([127.0.0.1]:43905 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wBsix-0001RI-Ul
	for submit <at> debbugs.gnu.org; Sun, 12 Apr 2026 07:11:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55444)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wBsir-0001Pq-Pr
 for 80770 <at> debbugs.gnu.org; Sun, 12 Apr 2026 07:11:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wBsil-0007ef-WC; Sun, 12 Apr 2026 07:11:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=JflNqOaGHn3i2PH84h4g36EHveIBnOmbugMfNiTL+pU=; b=Ad8M+7AtepTz
 8xdEyaZ67jlKL0UCEhZFdxjVSst005CPSdMYDKLaq5WecgvKdUT7ZRkg2SgELSdSTrrn3I5m+BDHj
 jePLRhu123OrRbMucfJoZ43kwjrKSZHxOoBr41MvA4fQRCc/SrR3tGle4Y2sh/e5C6CCvJYJupy7t
 OyR9J3Ad/UGvwXq1rfZKNc5Z36v4L/cSmNzDYpmlRug4kNMQR/RO/V3p4l5w34OSab0BjtedPQ5gJ
 GAoFg+s24F9SC+qTyQcL+Ei0C1KZoGsKYVq8xctOEg5QkYWaEEXEKG8cVwzahUL9igJaRs3C9GyJ2
 EE7wWmsNsurTGadJnBgVrg==;
Date: Sun, 12 Apr 2026 14:11:17 +0300
Message-Id: <86h5pgqvqi.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Octave Crespel <octave.crespel@HIDDEN>
In-Reply-To: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
 (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#80770: Emacs hangs in sys_close for pipe process on Windows
References: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80770
Cc: 80770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 7 Apr 2026 14:31:12 +0200
> From:  Octave Crespel via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> This is my first Emacs bug report, apologies if I'm doing something incorrectly.

No need to apologize, you are doing just fine.

> When I run 'counsel-ag and edit the text several times in a row quickly,
> Emacs ends up hanging. This bug has the same symptoms as #52414, except
> that one is reportedly fixed.
> 
> Here is a minimal (ish) .emacs file to reproduce the bug:
> 
> ;;; -*- lexical-binding: t -*-
> (require 'package)
> (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
> (package-initialize)
> 
> (unless (package-installed-p 'use-package)
>   (package-install 'use-package))
> 
> (require 'use-package)
> (setq use-package-always-ensure t)
> 
> ;; Use Ivy for completion
> (use-package ivy
>   :diminish
>   :init (ivy-mode 1)
>   )
> 
> ;; Use counsel for better default functions with Ivy
> (use-package counsel
>   :init (counsel-mode 1)
>   :bind (("C-x b" . counsel-ibuffer)
> ("C-M-j" . counsel-switch-buffer)
> :map minibuffer-local-map
> ("C-r" . 'counsel-minibuffer-history)))
> 
> (global-set-key (kbd "C-c f") 'counsel-ag)
> 
> Here is the backtrace from the main thread:
> 
> #0  0x00007ff8a94e56e4 in ntdll!ZwWaitForAlertByThreadId () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #1  0x00007ff8a938af5f in ntdll!RtlRaiseException () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #2  0x00007ff8a938c67f in ntdll!RtlSleepConditionVariableCS () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #3  0x00007ff8a938d8f2 in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #4  0x00007ff8a7360077 in msvcrt!_setmode () from C:\WINDOWS\System32\msvcrt.dll
> #5  0x00007ff8a735e662 in msvcrt!_close () from C:\WINDOWS\System32\msvcrt.dll
> #6  0x00007ff7353cb509 in sys_close (fd=5) at ../../src/w32.c:8783
> #7  0x00007ff73520dbe3 in posix_close (fd=5, flag=1) at ../../src/sysdep.c:2604
> #8  0x00007ff73520dc23 in emacs_close (fd=5) at ../../src/sysdep.c:2627
> #9  0x00007ff73531f2fc in close_process_fd (fd_addr=0x11684674) at ../../src/process.c:2116
> #10 0x00007ff735323aa1 in deactivate_process (proc=0x116845a5) at ../../src/process.c:4840
> #11 0x00007ff73531c4e3 in remove_process (proc=0x116845a5) at ../../src/process.c:965
> #12 0x00007ff73532a59e in status_notify (deleting_process=0x116845a0, wait_proc=0x0) at .
> ./../src/process.c:7921
> #13 0x00007ff73531ca80 in Fdelete_process (process=0x116845a5) at ../../src/process.c:1149
> #14 0x00007ff7352afafc in funcall_subr (subr=0x1141d8e0, numargs=1, args=0xbfc9b8) at ../../src/eval.c:3252
> #15 0x00007ff7352af4f6 in funcall_general (fun=0x1141d8e5, numargs=1, args=0xbfc9b8) at .
> ./../src/eval.c:3131
> #16 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfc9b0) at ../../src/eval.c:3184
> #17 0x00007ff83fd22180 in
> F636f756e73656c2d2d6173796e632d636f6d6d616e642d31_counsel__async_command_1_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
> #18 0x00007ff7352afb95 in funcall_subr (subr=0x115b7850, numargs=1, args=0xbfcc88) at ../../src/eval.c:3258
> #19 0x00007ff7352af4f6 in funcall_general (fun=0x115b7855, numargs=1, args=0xbfcc88) at .
> ./../src/eval.c:3131
> #20 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcc80) at ../../src/eval.c:3184
> #21 0x00007ff7352ae93a in Fapply (nargs=2, args=0xbfcc80) at ../../src/eval.c:2798
> #22 0x00007ff83fd2235f in
> F636f756e73656c2d2d6173796e632d636f6d6d616e64_counsel__async_command_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
> #23 0x00007ff7352afd59 in funcall_subr (subr=0x115b78b0, numargs=1, args=0xbfcec8) at ../../src/eval.c:3275
> #24 0x00007ff7352af4f6 in funcall_general (fun=0x115b78b5, numargs=1, args=0xbfcec8) at .
> ./../src/eval.c:3131
> #25 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcec0) at ../../src/eval.c:3184
> #26 0x00007ff83fd32c35 in F636f756e73656c2d61672d66756e6374696f6e_counsel_ag_function_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
> #27 0x00007ff7352afafc in funcall_subr (subr=0x1151c390, numargs=1, args=0xbfd100) at ../../src/eval.c:3252
> #28 0x00007ff7352af4f6 in funcall_general (fun=0x1151c395, numargs=1, args=0xbfd100) at .
> ./../src/eval.c:3131
> #29 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd0f8) at ../../src/eval.c:3184
> #30 0x00007ff83fe85e50 in
> F6976792d2d64796e616d69632d636f6c6c656374696f6e2d63616e6473_ivy__dynamic_collection_cands_0
> ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
> #31 0x00007ff7352afafc in funcall_subr (subr=0x113d2c00, numargs=1, args=0xbfd300) at ../../src/eval.c:3252
> #32 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c05, numargs=1, args=0xbfd300) at .
> ./../src/eval.c:3131
> #33 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd2f8) at ../../src/eval.c:3184
> #34 0x00007ff83fe86bd9 in
> F6976792d2d7570646174652d6d696e69627566666572_ivy__update_minibuffer_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
> #35 0x00007ff7352afae3 in funcall_subr (subr=0x113d2c60, numargs=0, args=0xbfd4d0) at .
> ./../src/eval.c:3250
> #36 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c65, numargs=0, args=0xbfd4d0) at .
> ./../src/eval.c:3131
> #37 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd4c8) at ../../src/eval.c:3184
> #38 0x00007ff83fe85c04 in F6976792d2d65786869626974_ivy__exhibit_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
> #39 0x00007ff7352afae3 in funcall_subr (subr=0x113d2ba0, numargs=0, args=0xbfd6d8) at .
> ./../src/eval.c:3250
> #40 0x00007ff7352af4f6 in funcall_general (fun=0x113d2ba5, numargs=0, args=0xbfd6d8) at .
> ./../src/eval.c:3131
> #41 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd6d0) at ../../src/eval.c:3184
> #42 0x00007ff83fe8579c in F6976792d2d71756575652d65786869626974_ivy__queue_exhibit_0 ()
>    from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
> #43 0x00007ff7352afae3 in funcall_subr (subr=0x113d1d80, numargs=0, args=0xbfd950) at .
> ./../src/eval.c:3250
> #44 0x00007ff7352af4f6 in funcall_general (fun=0x113d1d85, numargs=0, args=0xbfd950) at .
> ./../src/eval.c:3131
> #45 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd948) at ../../src/eval.c:3184
> #46 0x00007ff7351e5d21 in safe_run_hooks_1 (nargs=2, args=0xbfd940) at ../../src/keyboard.c:1901
> #47 0x00007ff7352abe8f in internal_condition_case_n (bfun=0x7ff7351e5cfa <safe_run_hooks_1>, nargs=2,
> args=0xbfd940, handlers=0x30,
>     hfun=0x7ff7351e5d27 <safe_run_hooks_error>) at ../../src/eval.c:1769
> #48 0x00007ff7351e62a7 in safe_run_hook_funcall (nargs=2, args=0xbfda20) at ../../src/keyboard.c:1959
> #49 0x00007ff7352af12c in run_hook_with_args (nargs=2, args=0xbfda20, funcall=0x7ff7351e6152
> <safe_run_hook_funcall>) at ../../src/eval.c:3029
> #50 0x00007ff7351e649f in safe_run_hooks_maybe_narrowed (hook=0xf690, w=0x58962c0) at .
> ./../src/keyboard.c:1997
> #51 0x00007ff7351e4544 in command_loop_1 () at ../../src/keyboard.c:1563
> #52 0x00007ff7352abc3f in internal_condition_case (bfun=0x7ff7351e3b4c <command_loop_1>,
> handlers=0x90, hfun=0x7ff7351e2f47 <cmd_error>)
>     at ../../src/eval.c:1689
> #53 0x00007ff7351e3747 in command_loop_2 (handlers=0x90) at ../../src/keyboard.c:1163
> #54 0x00007ff7352ab1d5 in internal_catch (tag=0x7b00, func=0x7ff7351e371b <command_loop_2>,
> arg=0x90) at ../../src/eval.c:1369
> #55 0x00007ff7351e3612 in command_loop () at ../../src/keyboard.c:1133
> #56 0x0000000000000000 in ?? ()
> 
> And here is the backtrace from the reader thread :
> 
> #0  0x00007ff8a94e1b54 in ntdll!ZwReadFile () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #1  0x00007ff8a6d61e3d in ReadFile () from C:\WINDOWS\System32\KernelBase.dll
> #2  0x00007ff8a736238c in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
> #3  0x00007ff8a7361ffa in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll
> #4  0x00007ff7353cb971 in _sys_read_ahead (fd=5) at ../../src/w32.c:8936
> #5  0x00007ff7353d8956 in reader_thread (arg=0x7ff735610390 <child_procs+144>) at .
> ./../src/w32proc.c:2024
> #6  0x00007ff8a7bde8d7 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
> #7  0x00007ff8a940c48c in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
> #8  0x0000000000000000 in ?? ()
> 
> I looked through the relevant code in process.c and w32.c but couldn't
> find anything obvious. Let me know if there's anything I can do to help.

Assuming you can reproduce this at will, and can also build your
Emacs, please try the patch below:

diff --git a/src/w32.c b/src/w32.c
index 0b8c21e..3cf2eb2 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -8706,6 +8706,7 @@ sys_close (int fd)
 {
   int rc = -1;
   bool reader_thread_exited = false;
+  bool reader_thread_reading = false;
 
   if (fd < 0)
     {
@@ -8724,6 +8725,9 @@ sys_close (int fd)
 	  && thrd_status != STILL_ACTIVE)
 	reader_thread_exited = true;
 
+      if (cp->thrd != NULL && cp->status == STATUS_READ_IN_PROGRESS)
+	reader_thread_reading = true;
+
       fd_info[fd].cp = NULL;
 
       if (CHILD_ACTIVE (cp))
@@ -8773,7 +8777,8 @@ sys_close (int fd)
      because socket handles are fully fledged kernel handles. */
   if (fd < MAXDESC)
     {
-      if ((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
+      if (((fd_info[fd].flags & FILE_DONT_CLOSE) == 0
+	   && !reader_thread_reading)
 	  /* If the reader thread already exited, close the descriptor,
 	     since otherwise no one will close it, and we will be
 	     leaking descriptors.  */






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Apr 2026 22:47:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 18:47:44 2026
Received: from localhost ([127.0.0.1]:43394 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAFCw-0006Ta-La
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 18:47:44 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58780)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <octave.crespel@HIDDEN>)
 id 1wABTk-0005iA-0H
 for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 14:49:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <octave.crespel@HIDDEN>)
 id 1wABTc-0004Gt-S6
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2026 14:48:41 -0400
Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <octave.crespel@HIDDEN>)
 id 1wA5ae-00037e-9N
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2026 08:31:39 -0400
Received: by mail-ed1-x531.google.com with SMTP id
 4fb4d7f45d1cf-66ec3b7b1deso3362217a12.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 07 Apr 2026 05:31:29 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1775565088; cv=none;
 d=google.com; s=arc-20240605;
 b=hZ53ii6St4K5TaJMNeJQKgCpbmdMDufU9RbVYo5sTfDdW1LGpvdZCdLrtK66DDl2pz
 OYtGBy/RfcCqtqhFC9Uakdzfv4FRriVXusgnhO4cv0e1qptsW/dKAaXBGBwIJzQnExwT
 I5RAqH1pDHNbnsqX213uHIad8Cw7DYzsJb4RI0J/cnLq8ogMip83JVTfBr/L0kd8eeBc
 zXz1iHvxTXih64z+ug9I8PqBKYZG4OGo3Z++1Sym4QxxDGmkDCEh4Xdeiyz9/sv5/Wqm
 CKHm+mWcg6RM+JacsWJAjQmGWenACBmOE4rEES98uTIyBMzkr+zSMpiV3zIEu4WeMUYV
 cn2A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=to:subject:message-id:date:from:mime-version:dkim-signature;
 bh=49vrkwNaY78/X37f8smG/8sZyy1+L3hh8vbcsTdBZ2c=;
 fh=+R8aXOFVnuBbN1nRXJJI02Ia//JUQJmLW/Uk/VaA0ag=;
 b=UIv6rHIObvFBFh6EtVBPtuhw9abK/4mpmXp3T4fFRANe9ZF0JhX2gA32LMP0Bio5It
 YMBefgZWfGSxBXEQACqq9StBpAE/SS5GmnbFOwfDmmyTk1YBGvBDfxtMwxVamWWciIB6
 cayaTVXv+BPLdJbbCyVWCrhDfu+wHHNEn1lPYpPm4hk8xjdRJaTfqsD7BieolRnD8n9Y
 QMqiQpPtp6Uz6q6FL5vuQhwl/pZ40nzInjMOq3yXpJ9+40bqfeNG30TJpP/e/H6PR24D
 WrL2ry61xTuUTIPyINnTAWmWarHpMZcSEBjGTDrBBT+bz+coUi4A3bGmQS5z3RZDCACG
 lINQ==; darn=gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=nerd.nintendo.com; s=google; t=1775565088; x=1776169888; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=49vrkwNaY78/X37f8smG/8sZyy1+L3hh8vbcsTdBZ2c=;
 b=e8NMZt6uD3zc1tT0Duc+aWP4ztq8hDZZfhT8So5F1okI61tFQX9XpV6GfbVsfQIL6Z
 +IaVU+E9Rg4WP+HwDLNWUNiUxsk1I7mNYk21setnilVjPL/lccoVwmdBjuqGzhsTbUIP
 i6V3KzZGAYQE9nKmm62XNwV55HKEaXBfy1pnQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775565088; x=1776169888;
 h=to:subject:message-id:date:from:mime-version:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=49vrkwNaY78/X37f8smG/8sZyy1+L3hh8vbcsTdBZ2c=;
 b=P7UYvZ3icAqWQYZjwH2Zyd74BEIiKnA8OPXs2QCvarOyT1/Ml+XO3chvQMd2VnQ+2g
 7EfujRvhPLdXHZyV1TmYQcU2F34TvI/y/08FNvewaH6meKdkuvebGol4aG7UO9EO1sLi
 /ruplq1w0GeBIVE+p0sberCXaGl7o91kT0M/kiab2W58DmV11GgwglSLl8upH7EhPZ/M
 70b4i/grjHjPXMVFZe2aFU1hks3FOhbHgaA5Ig9AbEABbevnNvXpw2+2WLkns4kEDFvo
 bQWVfD6Bav5iTQC4rchWPsGoEhRcAXSP6KSB1yoOhoGDaw4z5fM9DYaPoLKIfyfIp2WT
 GuqQ==
X-Gm-Message-State: AOJu0YwdqrP0XaKuTq1WExmdUUQm4yh6Ieg7yBraKehjbEzXsn5ByXMg
 O27Anqdkix6ZExAzhyWhA8m2RBoKhHuMQEDIissKZmyFbkYGGDGsy66WntXERhgSLn+F/YdmL9t
 3Bi6udPTKR4qUef+ATp+V55RvHajgj+QHH/v7gy1jfUkCRt1KdbKIBeBoow==
X-Gm-Gg: AeBDieugD5eOQkJnEpCcgVl4MvYhebifJX/Ne9+TI2gnu7UkF5X0jL2koOHm6IkxhLo
 34zvip1ql+kIISX5keHwPO858w0KKdzjd45jE1yvmja4Eigyg96Rs7Q0szd7ssKAgH7cqIh1hCm
 mMp0eRxxc0Zcfj91tG0Lt9iCBNtlU7uWDFRt5WMHwJ2O/3tOv/wulJodBf6FBmNjnMQf8CCj2OD
 mrTBpBlLcvH/Y1y0WAr/EIa+G2bVMHvhLBeuA1VapfJqRdd/1XQaXDodftpvr99g47JHy54B6cS
 1BRwgfPqdbdvY2zWHXelXfBvwF7A87RIWwFpxo8n7hC4t7zA5YhzDQ1uXWdklOMSxI2qT4QBE5E
 PWzWiv1IjxTJsQdq1Z9H5COcL6zGpVsnL2xbMpQ==
X-Received: by 2002:a50:ee09:0:b0:66e:aca1:e0af with SMTP id
 4fb4d7f45d1cf-66eaca1e0famr3202923a12.24.1775565086825; Tue, 07 Apr 2026
 05:31:26 -0700 (PDT)
MIME-Version: 1.0
From: Octave Crespel <octave.crespel@HIDDEN>
Date: Tue, 7 Apr 2026 14:31:12 +0200
X-Gm-Features: AQROBzB0VvE3VgFq_6F1d1SFUzglQdXGQXV0XttDFiWKhk6nNLPsP3vuAJ09fBk
Message-ID: <CANn2UbnMCDcSZGgsbZX2dEO61E625h_b4tQNRtGMymfgc=X+WA@HIDDEN>
Subject: Emacs hangs in sys_close for pipe process on Windows
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="00000000000046b434064eddf673"
Received-SPF: pass client-ip=2a00:1450:4864:20::531;
 envelope-from=octave.crespel@HIDDEN; helo=mail-ed1-x531.google.com
X-Spam_score_int: -179
X-Spam_score: -18.0
X-Spam_bar: ------------------
X-Spam_report: (-18.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,
 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
 ENV_AND_HDR_SPF_MATCH=-0.5, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5,
 USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 07 Apr 2026 18:47:39 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--00000000000046b434064eddf673
Content-Type: text/plain; charset="UTF-8"

This is my first Emacs bug report, apologies if I'm doing something
incorrectly.

When I run 'counsel-ag and edit the text several times in a row quickly,
Emacs ends up hanging. This bug has the same symptoms as #52414, except
that one is reportedly fixed.

Here is a minimal (ish) .emacs file to reproduce the bug:

;;; -*- lexical-binding: t -*-
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)

;; Use Ivy for completion
(use-package ivy
  :diminish
  :init (ivy-mode 1)
  )

;; Use counsel for better default functions with Ivy
(use-package counsel
  :init (counsel-mode 1)
  :bind (("C-x b" . counsel-ibuffer)
("C-M-j" . counsel-switch-buffer)
:map minibuffer-local-map
("C-r" . 'counsel-minibuffer-history)))

(global-set-key (kbd "C-c f") 'counsel-ag)


Here is the backtrace from the main thread:

#0  0x00007ff8a94e56e4 in ntdll!ZwWaitForAlertByThreadId () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#1  0x00007ff8a938af5f in ntdll!RtlRaiseException () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#2  0x00007ff8a938c67f in ntdll!RtlSleepConditionVariableCS () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#3  0x00007ff8a938d8f2 in ntdll!RtlEnterCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#4  0x00007ff8a7360077 in msvcrt!_setmode () from
C:\WINDOWS\System32\msvcrt.dll
#5  0x00007ff8a735e662 in msvcrt!_close () from
C:\WINDOWS\System32\msvcrt.dll
#6  0x00007ff7353cb509 in sys_close (fd=5) at ../../src/w32.c:8783
#7  0x00007ff73520dbe3 in posix_close (fd=5, flag=1) at
../../src/sysdep.c:2604
#8  0x00007ff73520dc23 in emacs_close (fd=5) at ../../src/sysdep.c:2627
#9  0x00007ff73531f2fc in close_process_fd (fd_addr=0x11684674) at
../../src/process.c:2116
#10 0x00007ff735323aa1 in deactivate_process (proc=0x116845a5) at
../../src/process.c:4840
#11 0x00007ff73531c4e3 in remove_process (proc=0x116845a5) at
../../src/process.c:965
#12 0x00007ff73532a59e in status_notify (deleting_process=0x116845a0,
wait_proc=0x0) at ../../src/process.c:7921
#13 0x00007ff73531ca80 in Fdelete_process (process=0x116845a5) at
../../src/process.c:1149
#14 0x00007ff7352afafc in funcall_subr (subr=0x1141d8e0, numargs=1,
args=0xbfc9b8) at ../../src/eval.c:3252
#15 0x00007ff7352af4f6 in funcall_general (fun=0x1141d8e5, numargs=1,
args=0xbfc9b8) at ../../src/eval.c:3131
#16 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfc9b0) at
../../src/eval.c:3184
#17 0x00007ff83fd22180 in
F636f756e73656c2d2d6173796e632d636f6d6d616e642d31_counsel__async_command_1_0
()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
#18 0x00007ff7352afb95 in funcall_subr (subr=0x115b7850, numargs=1,
args=0xbfcc88) at ../../src/eval.c:3258
#19 0x00007ff7352af4f6 in funcall_general (fun=0x115b7855, numargs=1,
args=0xbfcc88) at ../../src/eval.c:3131
#20 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcc80) at
../../src/eval.c:3184
#21 0x00007ff7352ae93a in Fapply (nargs=2, args=0xbfcc80) at
../../src/eval.c:2798
#22 0x00007ff83fd2235f in
F636f756e73656c2d2d6173796e632d636f6d6d616e64_counsel__async_command_0 ()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
#23 0x00007ff7352afd59 in funcall_subr (subr=0x115b78b0, numargs=1,
args=0xbfcec8) at ../../src/eval.c:3275
#24 0x00007ff7352af4f6 in funcall_general (fun=0x115b78b5, numargs=1,
args=0xbfcec8) at ../../src/eval.c:3131
#25 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfcec0) at
../../src/eval.c:3184
#26 0x00007ff83fd32c35 in
F636f756e73656c2d61672d66756e6374696f6e_counsel_ag_function_0 ()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln
#27 0x00007ff7352afafc in funcall_subr (subr=0x1151c390, numargs=1,
args=0xbfd100) at ../../src/eval.c:3252
#28 0x00007ff7352af4f6 in funcall_general (fun=0x1151c395, numargs=1,
args=0xbfd100) at ../../src/eval.c:3131
#29 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd0f8) at
../../src/eval.c:3184
#30 0x00007ff83fe85e50 in
F6976792d2d64796e616d69632d636f6c6c656374696f6e2d63616e6473_ivy__dynamic_collection_cands_0
()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
#31 0x00007ff7352afafc in funcall_subr (subr=0x113d2c00, numargs=1,
args=0xbfd300) at ../../src/eval.c:3252
#32 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c05, numargs=1,
args=0xbfd300) at ../../src/eval.c:3131
#33 0x00007ff7352af7c5 in Ffuncall (nargs=2, args=0xbfd2f8) at
../../src/eval.c:3184
#34 0x00007ff83fe86bd9 in
F6976792d2d7570646174652d6d696e69627566666572_ivy__update_minibuffer_0 ()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
#35 0x00007ff7352afae3 in funcall_subr (subr=0x113d2c60, numargs=0,
args=0xbfd4d0) at ../../src/eval.c:3250
#36 0x00007ff7352af4f6 in funcall_general (fun=0x113d2c65, numargs=0,
args=0xbfd4d0) at ../../src/eval.c:3131
#37 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd4c8) at
../../src/eval.c:3184
#38 0x00007ff83fe85c04 in F6976792d2d65786869626974_ivy__exhibit_0 ()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
#39 0x00007ff7352afae3 in funcall_subr (subr=0x113d2ba0, numargs=0,
args=0xbfd6d8) at ../../src/eval.c:3250
#40 0x00007ff7352af4f6 in funcall_general (fun=0x113d2ba5, numargs=0,
args=0xbfd6d8) at ../../src/eval.c:3131
#41 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd6d0) at
../../src/eval.c:3184
#42 0x00007ff83fe8579c in
F6976792d2d71756575652d65786869626974_ivy__queue_exhibit_0 ()
   from
c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln
#43 0x00007ff7352afae3 in funcall_subr (subr=0x113d1d80, numargs=0,
args=0xbfd950) at ../../src/eval.c:3250
#44 0x00007ff7352af4f6 in funcall_general (fun=0x113d1d85, numargs=0,
args=0xbfd950) at ../../src/eval.c:3131
#45 0x00007ff7352af7c5 in Ffuncall (nargs=1, args=0xbfd948) at
../../src/eval.c:3184
#46 0x00007ff7351e5d21 in safe_run_hooks_1 (nargs=2, args=0xbfd940) at
../../src/keyboard.c:1901
#47 0x00007ff7352abe8f in internal_condition_case_n (bfun=0x7ff7351e5cfa
<safe_run_hooks_1>, nargs=2, args=0xbfd940, handlers=0x30,
    hfun=0x7ff7351e5d27 <safe_run_hooks_error>) at ../../src/eval.c:1769
#48 0x00007ff7351e62a7 in safe_run_hook_funcall (nargs=2, args=0xbfda20) at
../../src/keyboard.c:1959
#49 0x00007ff7352af12c in run_hook_with_args (nargs=2, args=0xbfda20,
funcall=0x7ff7351e6152 <safe_run_hook_funcall>) at ../../src/eval.c:3029
#50 0x00007ff7351e649f in safe_run_hooks_maybe_narrowed (hook=0xf690,
w=0x58962c0) at ../../src/keyboard.c:1997
#51 0x00007ff7351e4544 in command_loop_1 () at ../../src/keyboard.c:1563
#52 0x00007ff7352abc3f in internal_condition_case (bfun=0x7ff7351e3b4c
<command_loop_1>, handlers=0x90, hfun=0x7ff7351e2f47 <cmd_error>)
    at ../../src/eval.c:1689
#53 0x00007ff7351e3747 in command_loop_2 (handlers=0x90) at
../../src/keyboard.c:1163
#54 0x00007ff7352ab1d5 in internal_catch (tag=0x7b00, func=0x7ff7351e371b
<command_loop_2>, arg=0x90) at ../../src/eval.c:1369
#55 0x00007ff7351e3612 in command_loop () at ../../src/keyboard.c:1133
#56 0x0000000000000000 in ?? ()

And here is the backtrace from the reader thread :

#0  0x00007ff8a94e1b54 in ntdll!ZwReadFile () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#1  0x00007ff8a6d61e3d in ReadFile () from
C:\WINDOWS\System32\KernelBase.dll
#2  0x00007ff8a736238c in msvcrt!_read () from
C:\WINDOWS\System32\msvcrt.dll
#3  0x00007ff8a7361ffa in msvcrt!_read () from
C:\WINDOWS\System32\msvcrt.dll
#4  0x00007ff7353cb971 in _sys_read_ahead (fd=5) at ../../src/w32.c:8936
#5  0x00007ff7353d8956 in reader_thread (arg=0x7ff735610390
<child_procs+144>) at ../../src/w32proc.c:2024
#6  0x00007ff8a7bde8d7 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
#7  0x00007ff8a940c48c in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#8  0x0000000000000000 in ?? ()


I looked through the relevant code in process.c and w32.c but couldn't
find anything obvious. Let me know if there's anything I can do to help.



In GNU Emacs 31.0.50 (build 7, x86_64-w64-mingw32) of 2026-04-07 built
 on WKS-240614
Repository revision: 4f46593668a94a19fd4da843f9b3632ca153ddd9
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.26200
System Description: Microsoft Windows 10 Pro (v10.0.2009.26200.8037)

Configured using:
 'configure --prefix=/c/Users/ocrespel/dev/emacs/build --without-pop
 --without-imagemagick --without-compress-install -without-dbus
 --with-gnutls --with-tree-sitter --without-gconf --with-rsvg
 --without-gsettings --with-mailutils --with-native-compilation
 --with-modules --with-xml2 --with-wide-int 'CFLAGS=-O0 -g3
 -march=native -mtune=native''

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: ENU
  locale-coding-system: cp65001

Major mode: Fundamental

Minor modes in effect:
  counsel-mode: t
  ivy-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-nonselected-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
c:/Users/ocrespel/.emacs.d/elpa/which-key-20240620.2145/which-key hides
c:/Users/ocrespel/dev/emacs/lisp/which-key
c:/Users/ocrespel/.emacs.d/elpa/transient-20250609.1609/transient hides
c:/Users/ocrespel/dev/emacs/lisp/transient

Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring emacsbug
lisp-mnt message yank-media puny dired dired-loaddefs rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
sendmail mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils color thingatpt counsel swiper edmacro kmacro ivy
ivy-faces colir use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf ag-autoloads all-the-icons-autoloads
atomic-chrome-autoloads auctex-autoloads tex-site
benchmark-init-autoloads clang-format+-autoloads clang-format-autoloads
cmake-mode-autoloads counsel-projectile-autoloads counsel-autoloads
dap-mode-autoloads bui-autoloads diff-hl-autoloads
doom-modeline-autoloads doom-themes-autoloads drag-stuff-autoloads
dumb-jump-autoloads edit-server-autoloads elpy-autoloads
company-autoloads esup-autoloads glsl-mode-autoloads
golden-ratio-scroll-screen-autoloads helpful-autoloads
elisp-refs-autoloads highlight-indentation-autoloads
impatient-mode-autoloads htmlize-autoloads jenkinsfile-mode-autoloads
groovy-mode-autoloads json-mode-autoloads json-snatcher-autoloads
lsp-docker-autoloads lsp-treemacs-autoloads lsp-mode-autoloads
magit-autoloads pcase magit-section-autoloads llama-autoloads
cond-let-autoloads markdown-mode-autoloads move-text-autoloads
nerd-icons-autoloads nginx-mode-autoloads nim-mode-autoloads
flycheck-nimsuggest-autoloads flycheck-autoloads commenter-autoloads
epc-autoloads ctable-autoloads concurrent-autoloads
org-bullets-autoloads org-contrib-autoloads org-gcal-autoloads
oauth2-auto-autoloads elnode-autoloads db-autoloads fakir-autoloads
creole-autoloads kv-autoloads noflet-autoloads alert-autoloads
log4e-autoloads gntp-autoloads aio-autoloads ox-jira-autoloads
persist-autoloads popup-autoloads projectile-autoloads pyvenv-autoloads
rainbow-delimiters-autoloads realgud-autoloads
realgud-recursive-autoloads comp-run bytecomp byte-compile comp-common
rx cl-extra help-mode warnings loc-changes-autoloads
load-relative-autoloads request-deferred-autoloads request-autoloads
deferred-autoloads rust-mode-autoloads shrink-path-autoloads f-autoloads
simple-httpd-autoloads spinner-autoloads string-inflection-autoloads
swiper-autoloads ivy-autoloads test-simple-autoloads transient-autoloads
treemacs-autoloads cfrs-autoloads posframe-autoloads ht-autoloads
hydra-autoloads lv-autoloads pfuture-autoloads ace-window-autoloads
avy-autoloads web-autoloads s-autoloads dash-autoloads
web-mode-autoloads websocket-autoloads which-key-autoloads
with-editor-autoloads yaml-autoloads yaml-mode-autoloads
yasnippet-autoloads zig-mode-autoloads reformatter-autoloads package
browse-url xdg url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs gv
icons password-cache json subr-x mule-util map url-vars cl-loaddefs
cl-lib package-activate rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
touch-screen dos-w32 ls-lisp term/w32-nt disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty move-toolbar make-network-process
tty-child-frames native-compile emacs)

Memory information:
((conses 16 365233 44620) (symbols 48 19086 0)
 (strings 32 123234 5540) (string-bytes 1 3193021) (vectors 16 30446)
 (vector-slots 8 464492 10200) (floats 8 167 160) (intervals 56 602 0)
 (buffers 1064 13))

--00000000000046b434064eddf673
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This is my first Emacs bug report, apologies if I&#39;m do=
ing something incorrectly.<br><br>When I run &#39;counsel-ag and edit the t=
ext several times in a row quickly,<br>Emacs ends up hanging. This bug has =
the same symptoms as #52414, except<br>that one is reportedly fixed.<br><br=
>Here is a minimal (ish) .emacs file to reproduce the bug:<br><br>;;; -*- l=
exical-binding: t -*-<br>(require &#39;package)<br>(add-to-list &#39;packag=
e-archives &#39;(&quot;melpa&quot; . &quot;<a href=3D"https://melpa.org/pac=
kages/">https://melpa.org/packages/</a>&quot;) t)<br>(package-initialize)<b=
r><br>(unless (package-installed-p &#39;use-package)<br>=C2=A0 (package-ins=
tall &#39;use-package))<br><br>(require &#39;use-package)<br>(setq use-pack=
age-always-ensure t)<br><br>;; Use Ivy for completion<br>(use-package ivy<b=
r>=C2=A0 :diminish<br>=C2=A0 :init (ivy-mode 1)<br>=C2=A0 )<br><br>;; Use c=
ounsel for better default functions with Ivy<br>(use-package counsel<br>=C2=
=A0 :init (counsel-mode 1)<br>=C2=A0 :bind ((&quot;C-x b&quot; . counsel-ib=
uffer)<br>	 (&quot;C-M-j&quot; . counsel-switch-buffer)<br>	 :map minibuffe=
r-local-map<br>	 (&quot;C-r&quot; . &#39;counsel-minibuffer-history)))<br><=
br>(global-set-key (kbd &quot;C-c f&quot;) &#39;counsel-ag)<br><br><br>Here=
 is the backtrace from the main thread:<br><br>#0 =C2=A00x00007ff8a94e56e4 =
in ntdll!ZwWaitForAlertByThreadId () from C:\WINDOWS\SYSTEM32\ntdll.dll<br>=
#1 =C2=A00x00007ff8a938af5f in ntdll!RtlRaiseException () from C:\WINDOWS\S=
YSTEM32\ntdll.dll<br>#2 =C2=A00x00007ff8a938c67f in ntdll!RtlSleepCondition=
VariableCS () from C:\WINDOWS\SYSTEM32\ntdll.dll<br>#3 =C2=A00x00007ff8a938=
d8f2 in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll=
<br>#4 =C2=A00x00007ff8a7360077 in msvcrt!_setmode () from C:\WINDOWS\Syste=
m32\msvcrt.dll<br>#5 =C2=A00x00007ff8a735e662 in msvcrt!_close () from C:\W=
INDOWS\System32\msvcrt.dll<br>#6 =C2=A00x00007ff7353cb509 in sys_close (fd=
=3D5) at ../../src/w32.c:8783<br>#7 =C2=A00x00007ff73520dbe3 in posix_close=
 (fd=3D5, flag=3D1) at ../../src/sysdep.c:2604<br>#8 =C2=A00x00007ff73520dc=
23 in emacs_close (fd=3D5) at ../../src/sysdep.c:2627<br>#9 =C2=A00x00007ff=
73531f2fc in close_process_fd (fd_addr=3D0x11684674) at ../../src/process.c=
:2116<br>#10 0x00007ff735323aa1 in deactivate_process (proc=3D0x116845a5) a=
t ../../src/process.c:4840<br>#11 0x00007ff73531c4e3 in remove_process (pro=
c=3D0x116845a5) at ../../src/process.c:965<br>#12 0x00007ff73532a59e in sta=
tus_notify (deleting_process=3D0x116845a0, wait_proc=3D0x0) at ../../src/pr=
ocess.c:7921<br>#13 0x00007ff73531ca80 in Fdelete_process (process=3D0x1168=
45a5) at ../../src/process.c:1149<br>#14 0x00007ff7352afafc in funcall_subr=
 (subr=3D0x1141d8e0, numargs=3D1, args=3D0xbfc9b8) at ../../src/eval.c:3252=
<br>#15 0x00007ff7352af4f6 in funcall_general (fun=3D0x1141d8e5, numargs=3D=
1, args=3D0xbfc9b8) at ../../src/eval.c:3131<br>#16 0x00007ff7352af7c5 in F=
funcall (nargs=3D2, args=3D0xbfc9b0) at ../../src/eval.c:3184<br>#17 0x0000=
7ff83fd22180 in F636f756e73656c2d2d6173796e632d636f6d6d616e642d31_counsel__=
async_command_1_0 ()<br>=C2=A0 =C2=A0from c:\Users\ocrespel\.emacs.d\eln-ca=
che\31.0.50-e279aeb4\counsel-b89313cc-58da2751.eln<br>#18 0x00007ff7352afb9=
5 in funcall_subr (subr=3D0x115b7850, numargs=3D1, args=3D0xbfcc88) at ../.=
./src/eval.c:3258<br>#19 0x00007ff7352af4f6 in funcall_general (fun=3D0x115=
b7855, numargs=3D1, args=3D0xbfcc88) at ../../src/eval.c:3131<br>#20 0x0000=
7ff7352af7c5 in Ffuncall (nargs=3D2, args=3D0xbfcc80) at ../../src/eval.c:3=
184<br>#21 0x00007ff7352ae93a in Fapply (nargs=3D2, args=3D0xbfcc80) at ../=
../src/eval.c:2798<br>#22 0x00007ff83fd2235f in F636f756e73656c2d2d6173796e=
632d636f6d6d616e64_counsel__async_command_0 ()<br>=C2=A0 =C2=A0from c:\User=
s\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.el=
n<br>#23 0x00007ff7352afd59 in funcall_subr (subr=3D0x115b78b0, numargs=3D1=
, args=3D0xbfcec8) at ../../src/eval.c:3275<br>#24 0x00007ff7352af4f6 in fu=
ncall_general (fun=3D0x115b78b5, numargs=3D1, args=3D0xbfcec8) at ../../src=
/eval.c:3131<br>#25 0x00007ff7352af7c5 in Ffuncall (nargs=3D2, args=3D0xbfc=
ec0) at ../../src/eval.c:3184<br>#26 0x00007ff83fd32c35 in F636f756e73656c2=
d61672d66756e6374696f6e_counsel_ag_function_0 ()<br>=C2=A0 =C2=A0from c:\Us=
ers\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\counsel-b89313cc-58da2751.=
eln<br>#27 0x00007ff7352afafc in funcall_subr (subr=3D0x1151c390, numargs=
=3D1, args=3D0xbfd100) at ../../src/eval.c:3252<br>#28 0x00007ff7352af4f6 i=
n funcall_general (fun=3D0x1151c395, numargs=3D1, args=3D0xbfd100) at ../..=
/src/eval.c:3131<br>#29 0x00007ff7352af7c5 in Ffuncall (nargs=3D2, args=3D0=
xbfd0f8) at ../../src/eval.c:3184<br>#30 0x00007ff83fe85e50 in F6976792d2d6=
4796e616d69632d636f6c6c656374696f6e2d63616e6473_ivy__dynamic_collection_can=
ds_0 ()<br>=C2=A0 =C2=A0from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e=
279aeb4\ivy-cb26e51e-a85e112d.eln<br>#31 0x00007ff7352afafc in funcall_subr=
 (subr=3D0x113d2c00, numargs=3D1, args=3D0xbfd300) at ../../src/eval.c:3252=
<br>#32 0x00007ff7352af4f6 in funcall_general (fun=3D0x113d2c05, numargs=3D=
1, args=3D0xbfd300) at ../../src/eval.c:3131<br>#33 0x00007ff7352af7c5 in F=
funcall (nargs=3D2, args=3D0xbfd2f8) at ../../src/eval.c:3184<br>#34 0x0000=
7ff83fe86bd9 in F6976792d2d7570646174652d6d696e69627566666572_ivy__update_m=
inibuffer_0 ()<br>=C2=A0 =C2=A0from c:\Users\ocrespel\.emacs.d\eln-cache\31=
.0.50-e279aeb4\ivy-cb26e51e-a85e112d.eln<br>#35 0x00007ff7352afae3 in funca=
ll_subr (subr=3D0x113d2c60, numargs=3D0, args=3D0xbfd4d0) at ../../src/eval=
.c:3250<br>#36 0x00007ff7352af4f6 in funcall_general (fun=3D0x113d2c65, num=
args=3D0, args=3D0xbfd4d0) at ../../src/eval.c:3131<br>#37 0x00007ff7352af7=
c5 in Ffuncall (nargs=3D1, args=3D0xbfd4c8) at ../../src/eval.c:3184<br>#38=
 0x00007ff83fe85c04 in F6976792d2d65786869626974_ivy__exhibit_0 ()<br>=C2=
=A0 =C2=A0from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb=
26e51e-a85e112d.eln<br>#39 0x00007ff7352afae3 in funcall_subr (subr=3D0x113=
d2ba0, numargs=3D0, args=3D0xbfd6d8) at ../../src/eval.c:3250<br>#40 0x0000=
7ff7352af4f6 in funcall_general (fun=3D0x113d2ba5, numargs=3D0, args=3D0xbf=
d6d8) at ../../src/eval.c:3131<br>#41 0x00007ff7352af7c5 in Ffuncall (nargs=
=3D1, args=3D0xbfd6d0) at ../../src/eval.c:3184<br>#42 0x00007ff83fe8579c i=
n F6976792d2d71756575652d65786869626974_ivy__queue_exhibit_0 ()<br>=C2=A0 =
=C2=A0from c:\Users\ocrespel\.emacs.d\eln-cache\31.0.50-e279aeb4\ivy-cb26e5=
1e-a85e112d.eln<br>#43 0x00007ff7352afae3 in funcall_subr (subr=3D0x113d1d8=
0, numargs=3D0, args=3D0xbfd950) at ../../src/eval.c:3250<br>#44 0x00007ff7=
352af4f6 in funcall_general (fun=3D0x113d1d85, numargs=3D0, args=3D0xbfd950=
) at ../../src/eval.c:3131<br>#45 0x00007ff7352af7c5 in Ffuncall (nargs=3D1=
, args=3D0xbfd948) at ../../src/eval.c:3184<br>#46 0x00007ff7351e5d21 in sa=
fe_run_hooks_1 (nargs=3D2, args=3D0xbfd940) at ../../src/keyboard.c:1901<br=
>#47 0x00007ff7352abe8f in internal_condition_case_n (bfun=3D0x7ff7351e5cfa=
 &lt;safe_run_hooks_1&gt;, nargs=3D2, args=3D0xbfd940, handlers=3D0x30,<br>=
=C2=A0 =C2=A0 hfun=3D0x7ff7351e5d27 &lt;safe_run_hooks_error&gt;) at ../../=
src/eval.c:1769<br>#48 0x00007ff7351e62a7 in safe_run_hook_funcall (nargs=
=3D2, args=3D0xbfda20) at ../../src/keyboard.c:1959<br>#49 0x00007ff7352af1=
2c in run_hook_with_args (nargs=3D2, args=3D0xbfda20, funcall=3D0x7ff7351e6=
152 &lt;safe_run_hook_funcall&gt;) at ../../src/eval.c:3029<br>#50 0x00007f=
f7351e649f in safe_run_hooks_maybe_narrowed (hook=3D0xf690, w=3D0x58962c0) =
at ../../src/keyboard.c:1997<br>#51 0x00007ff7351e4544 in command_loop_1 ()=
 at ../../src/keyboard.c:1563<br>#52 0x00007ff7352abc3f in internal_conditi=
on_case (bfun=3D0x7ff7351e3b4c &lt;command_loop_1&gt;, handlers=3D0x90, hfu=
n=3D0x7ff7351e2f47 &lt;cmd_error&gt;)<br>=C2=A0 =C2=A0 at ../../src/eval.c:=
1689<br>#53 0x00007ff7351e3747 in command_loop_2 (handlers=3D0x90) at ../..=
/src/keyboard.c:1163<br>#54 0x00007ff7352ab1d5 in internal_catch (tag=3D0x7=
b00, func=3D0x7ff7351e371b &lt;command_loop_2&gt;, arg=3D0x90) at ../../src=
/eval.c:1369<br>#55 0x00007ff7351e3612 in command_loop () at ../../src/keyb=
oard.c:1133<br>#56 0x0000000000000000 in ?? ()<br><br>And here is the backt=
race from the reader thread :<br><br>#0 =C2=A00x00007ff8a94e1b54 in ntdll!Z=
wReadFile () from C:\WINDOWS\SYSTEM32\ntdll.dll<br>#1 =C2=A00x00007ff8a6d61=
e3d in ReadFile () from C:\WINDOWS\System32\KernelBase.dll<br>#2 =C2=A00x00=
007ff8a736238c in msvcrt!_read () from C:\WINDOWS\System32\msvcrt.dll<br>#3=
 =C2=A00x00007ff8a7361ffa in msvcrt!_read () from C:\WINDOWS\System32\msvcr=
t.dll<br>#4 =C2=A00x00007ff7353cb971 in _sys_read_ahead (fd=3D5) at ../../s=
rc/w32.c:8936<br>#5 =C2=A00x00007ff7353d8956 in reader_thread (arg=3D0x7ff7=
35610390 &lt;child_procs+144&gt;) at ../../src/w32proc.c:2024<br>#6 =C2=A00=
x00007ff8a7bde8d7 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System=
32\kernel32.dll<br>#7 =C2=A00x00007ff8a940c48c in ntdll!RtlUserThreadStart =
() from C:\WINDOWS\SYSTEM32\ntdll.dll<br>#8 =C2=A00x0000000000000000 in ?? =
()<br><br><br>I looked through the relevant code in process.c and w32.c but=
 couldn&#39;t<br>find anything obvious. Let me know if there&#39;s anything=
 I can do to help.<br><br><br><br>In GNU Emacs 31.0.50 (build 7, x86_64-w64=
-mingw32) of 2026-04-07 built<br>=C2=A0on WKS-240614<br>Repository revision=
: 4f46593668a94a19fd4da843f9b3632ca153ddd9<br>Repository branch: master<br>=
Windowing system distributor &#39;Microsoft Corp.&#39;, version 10.0.26200<=
br>System Description: Microsoft Windows 10 Pro (v10.0.2009.26200.8037)<br>=
<br>Configured using:<br>=C2=A0&#39;configure --prefix=3D/c/Users/ocrespel/=
dev/emacs/build --without-pop<br>=C2=A0--without-imagemagick --without-comp=
ress-install -without-dbus<br>=C2=A0--with-gnutls --with-tree-sitter --with=
out-gconf --with-rsvg<br>=C2=A0--without-gsettings --with-mailutils --with-=
native-compilation<br>=C2=A0--with-modules --with-xml2 --with-wide-int &#39=
;CFLAGS=3D-O0 -g3<br>=C2=A0-march=3Dnative -mtune=3Dnative&#39;&#39;<br><br=
>Configured features:<br>ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MOD=
ULES NATIVE_COMP<br>NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS=
 TIFF<br>TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB<br><br>Important set=
tings:<br>=C2=A0 value of $LC_CTYPE: en_US.UTF-8<br>=C2=A0 value of $LANG: =
ENU<br>=C2=A0 locale-coding-system: cp65001<br><br>Major mode: Fundamental<=
br><br>Minor modes in effect:<br>=C2=A0 counsel-mode: t<br>=C2=A0 ivy-mode:=
 t<br>=C2=A0 override-global-mode: t<br>=C2=A0 tooltip-mode: t<br>=C2=A0 gl=
obal-eldoc-mode: t<br>=C2=A0 show-paren-mode: t<br>=C2=A0 electric-indent-m=
ode: t<br>=C2=A0 mouse-wheel-mode: t<br>=C2=A0 tool-bar-mode: t<br>=C2=A0 m=
enu-bar-mode: t<br>=C2=A0 file-name-shadow-mode: t<br>=C2=A0 global-font-lo=
ck-mode: t<br>=C2=A0 blink-cursor-mode: t<br>=C2=A0 minibuffer-nonselected-=
mode: t<br>=C2=A0 minibuffer-regexp-mode: t<br>=C2=A0 buffer-read-only: t<b=
r>=C2=A0 line-number-mode: t<br>=C2=A0 indent-tabs-mode: t<br>=C2=A0 transi=
ent-mark-mode: t<br>=C2=A0 auto-composition-mode: t<br>=C2=A0 auto-encrypti=
on-mode: t<br>=C2=A0 auto-compression-mode: t<br><br>Load-path shadows:<br>=
c:/Users/ocrespel/.emacs.d/elpa/which-key-20240620.2145/which-key hides c:/=
Users/ocrespel/dev/emacs/lisp/which-key<br>c:/Users/ocrespel/.emacs.d/elpa/=
transient-20250609.1609/transient hides c:/Users/ocrespel/dev/emacs/lisp/tr=
ansient<br><br>Features:<br>(shadow sort mail-extr compile comint ansi-osc =
ansi-color ring emacsbug<br>lisp-mnt message yank-media puny dired dired-lo=
addefs rfc822 mml mml-sec<br>epa derived epg rfc6068 epg-config gnus-util t=
ext-property-search<br>time-date mm-decode mm-bodies mm-encode mailabbrev g=
mm-utils mailheader<br>sendmail mail-parse rfc2231 rfc2047 rfc2045 ietf-dru=
ms mm-util<br>mail-prsvr mail-utils color thingatpt counsel swiper edmacro =
kmacro ivy<br>ivy-faces colir use-package use-package-ensure use-package-de=
light<br>use-package-diminish use-package-bind-key bind-key easy-mmode<br>u=
se-package-core finder-inf ag-autoloads all-the-icons-autoloads<br>atomic-c=
hrome-autoloads auctex-autoloads tex-site<br>benchmark-init-autoloads clang=
-format+-autoloads clang-format-autoloads<br>cmake-mode-autoloads counsel-p=
rojectile-autoloads counsel-autoloads<br>dap-mode-autoloads bui-autoloads d=
iff-hl-autoloads<br>doom-modeline-autoloads doom-themes-autoloads drag-stuf=
f-autoloads<br>dumb-jump-autoloads edit-server-autoloads elpy-autoloads<br>=
company-autoloads esup-autoloads glsl-mode-autoloads<br>golden-ratio-scroll=
-screen-autoloads helpful-autoloads<br>elisp-refs-autoloads highlight-inden=
tation-autoloads<br>impatient-mode-autoloads htmlize-autoloads jenkinsfile-=
mode-autoloads<br>groovy-mode-autoloads json-mode-autoloads json-snatcher-a=
utoloads<br>lsp-docker-autoloads lsp-treemacs-autoloads lsp-mode-autoloads<=
br>magit-autoloads pcase magit-section-autoloads llama-autoloads<br>cond-le=
t-autoloads markdown-mode-autoloads move-text-autoloads<br>nerd-icons-autol=
oads nginx-mode-autoloads nim-mode-autoloads<br>flycheck-nimsuggest-autoloa=
ds flycheck-autoloads commenter-autoloads<br>epc-autoloads ctable-autoloads=
 concurrent-autoloads<br>org-bullets-autoloads org-contrib-autoloads org-gc=
al-autoloads<br>oauth2-auto-autoloads elnode-autoloads db-autoloads fakir-a=
utoloads<br>creole-autoloads kv-autoloads noflet-autoloads alert-autoloads<=
br>log4e-autoloads gntp-autoloads aio-autoloads ox-jira-autoloads<br>persis=
t-autoloads popup-autoloads projectile-autoloads pyvenv-autoloads<br>rainbo=
w-delimiters-autoloads realgud-autoloads<br>realgud-recursive-autoloads com=
p-run bytecomp byte-compile comp-common<br>rx cl-extra help-mode warnings l=
oc-changes-autoloads<br>load-relative-autoloads request-deferred-autoloads =
request-autoloads<br>deferred-autoloads rust-mode-autoloads shrink-path-aut=
oloads f-autoloads<br>simple-httpd-autoloads spinner-autoloads string-infle=
ction-autoloads<br>swiper-autoloads ivy-autoloads test-simple-autoloads tra=
nsient-autoloads<br>treemacs-autoloads cfrs-autoloads posframe-autoloads ht=
-autoloads<br>hydra-autoloads lv-autoloads pfuture-autoloads ace-window-aut=
oloads<br>avy-autoloads web-autoloads s-autoloads dash-autoloads<br>web-mod=
e-autoloads websocket-autoloads which-key-autoloads<br>with-editor-autoload=
s yaml-autoloads yaml-mode-autoloads<br>yasnippet-autoloads zig-mode-autolo=
ads reformatter-autoloads package<br>browse-url xdg url url-proxy url-priva=
cy url-expand url-methods<br>url-history url-cookie generate-lisp-file url-=
domsuf url-util mailcap<br>url-handlers url-parse auth-source cl-seq eieio =
eieio-core cl-macs gv<br>icons password-cache json subr-x mule-util map url=
-vars cl-loaddefs<br>cl-lib package-activate rmc iso-transl tooltip cconv e=
ldoc paren<br>electric uniquify ediff-hook vc-hooks lisp-float-type elisp-m=
ode mwheel<br>touch-screen dos-w32 ls-lisp term/w32-nt disp-table term/w32-=
win w32-win<br>w32-vars term/common-win tool-bar dnd fontset image regexp-o=
pt fringe<br>tabulated-list replace newcomment text-mode lisp-mode prog-mod=
e register<br>page tab-bar menu-bar rfn-eshadow isearch easymenu timer sele=
ct<br>scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors<=
br>frame minibuffer nadvice seq simple cl-generic indonesian philippine<br>=
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao<br>=
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech<br>euro=
pean ethiopic indian cyrillic chinese composite emoji-zwj charscript<br>cha=
rprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure<br>cl-=
preloaded button loaddefs theme-loaddefs faces cus-face macroexp<br>files w=
indow text-properties overlay sha1 md5 base64 format env<br>code-pages mule=
 custom widget keymap hashtable-print-readable backquote<br>threads w32noti=
fy w32 lcms2 multi-tty move-toolbar make-network-process<br>tty-child-frame=
s native-compile emacs)<br><br>Memory information:<br>((conses 16 365233 44=
620) (symbols 48 19086 0)<br>=C2=A0(strings 32 123234 5540) (string-bytes 1=
 3193021) (vectors 16 30446)<br>=C2=A0(vector-slots 8 464492 10200) (floats=
 8 167 160) (intervals 56 602 0)<br>=C2=A0(buffers 1064 13))<br></div>

--00000000000046b434064eddf673--




Acknowledgement sent to Octave Crespel <octave.crespel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80770; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 14 Apr 2026 11:45:01 UTC

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