GNU bug report logs - #75275
30.0.92; `make-thread` bug on macOS 15.2

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: Stefan Kangas <stefankangas@HIDDEN>; Keywords: confirmed; dated Thu, 2 Jan 2025 04:58:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 19:59:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 14:59:32 2025
Received: from localhost ([127.0.0.1]:46804 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTRLv-0004nY-MT
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 14:59:32 -0500
Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:48565)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTRLt-0004nO-Et
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 14:59:30 -0500
Received: by mail-wr1-x433.google.com with SMTP id
 ffacd0b85a97d-38789e5b6a7so5894615f8f.1
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 11:59:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735847968; x=1736452768; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fOSg9BWgDj68QTN78qXUqlEc8wqkR/B4M9p07+y7DY0=;
 b=ctPm/Qw1CneOAJM8YfMi+ycowf1o9KpkoFO1ZUYPS50IlHyUcKYn0UpxHIMkOEh7iV
 GFSVJ7Nxaf+OqeA4+Abt5GNRQC04U1rL3jqrOrRKWU138QXuEPVkSIBcEHD/avMFDX4x
 4Fk0mXjZe2Qm4SK+GJUHgdp4+nVOtGS4P2bFkoVva/13uNfOs+bJ9Brr2xRx9l8I42Mk
 7AhjXnUGCxPRcCq3Py1FFYz6JHAoolUhucWG1ukmcVt7XAnNoIiOBJKqlFVL9TPjAWk1
 I6mhWX27kt1UChxg7nBnp8XkiXHxba1fIjGNXiQOLmLs5y1ce7mH58ig0ENR9ZJOlLZd
 kYHg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735847968; x=1736452768;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=fOSg9BWgDj68QTN78qXUqlEc8wqkR/B4M9p07+y7DY0=;
 b=lX8oE+dvZSe/xTrJjVNsXiIB/DNWAV1x6AdeAkIh20uu5eN9fpd9XM+Qc9QEiyuTWb
 +/eD6H25HyKN9xYtt+yk0C7y72Q+TbgLEu5JbGCe1ZX16DhgMQ9HA5IqAewvUc4fVpgy
 KnpIYdHdJ6LWVvZRpVI6nKZP9w0KrQznWl5SaFFpR2jxYWLJZCsmbFO13AdzzRKu7s7I
 9YBx4rBZIZX89qfH8iakuh/J+4xWJANO/psblyJSwnemOX8nekYsI3QlbihdzbMy9P16
 8JpyQnBQHQl0FB67m4f2d/Ifn/WbOVIUyu/ARgHXk8W9xBtngEW9IVTjQY7cnHH4mHOB
 0btQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCX9Y/it9ZgXSej5q1kiamrXfskmJL70yOzj1G6ussnANeVLUzlTZ5oN7XuPSYmgGWnTgYsbag==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yy1r7+DzUcxZF4d+k+Mu+rVfCKMom+NjdXr2o6Yu8Ys5MOM/1xx
 iG4M1hBLVWwh1CktGvGIh9qMqSWs/UVoKZ85ADj1D1bBOT5wfme4R7Ytcg==
X-Gm-Gg: ASbGncvW9kf7yFEBLKHyNYziCC6CpAcaLh9gkGJ+sw1crNAPt/UWechfFNFx6RQ1j0p
 JRioKYPV/zjZQOlW6Ozfs8EnEORdvD14c8KjBTAJCcwxfV8xxMS5ZcL4+JuZJSuOZkuFNd6a2Kg
 LXKwC+R7lxIoE4gBgUh8BSK098Oj1qjpz8EdW2LD8ctuNhdSw92gdK48raYgIkBuXDENHjQAVqk
 EqGmvepf9FIXZu8CjdXPOefrXYrkxkIJiWsriTTnK8/clvXzz5WXDALBCw+dFYwbbRb8Jx79YY2
 Z7+qjDY5ZkC/m6DyUzI/i+DP5Ge6c2NYUO72AOaACDQHaWJsI4+MphO4sDMvgds+
X-Google-Smtp-Source: AGHT+IHMFHwk4UWjheoPfLb5Np7xYfBuuXBLS4+vgj7wjq5jb4rWCLRVAVeex4QkEy035eLAEbr5Fw==
X-Received: by 2002:a5d:5847:0:b0:38a:2b34:e13e with SMTP id
 ffacd0b85a97d-38a456cbf49mr17494467f8f.18.1735847967803; 
 Thu, 02 Jan 2025 11:59:27 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c89e2f9sm39892116f8f.81.2025.01.02.11.59.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 11:59:27 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3bodxZCWE9tr5cW@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 19:26:47 +0000")
References: <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <Z3bO4Dww57CNBYW6@HIDDEN> <m28qrtglce.fsf@HIDDEN>
 <m2zfk9f6ic.fsf@HIDDEN> <Z3bodxZCWE9tr5cW@HIDDEN>
Date: Thu, 02 Jan 2025 20:59:26 +0100
Message-ID: <m2v7uxf0m9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

> On Thu, Jan 02, 2025 at 06:52:11PM +0100, Gerd M=C3=B6llmann wrote:
>> >
>> > AFAIR my theory went like:
>> >
>> > - [NSApp run] + key event handler put C-g in the hold queue
>> >
>> > - ns_select_1 calls "run" (it did before my change).
>> >
>> > - I couldn't find how input events from the hold queue come
>> >   to Emacs in the whole process, so I added that
>> >
>> > - The "call run in all threads" was then a mistake
>> >
>> > Seemed to work, to a degree.
>>=20
>> Maybe I should add that that is kind of a loop. It can be that the first
>> call to ns_select_1 has no C-g in the hold queue, NSApp.run leads to one
>> being put in the hold queue. A second ns_select_1 then finds C-g and
>> gives it Emacs and so on.
>>=20
>> Why that whole thing hangs, is another question.
>
> I suspect it's because we removed the code in bug 65843.
>
> We removed that because there was a crash on start using a specific
> desktop file. Something to do with a certain amount of iconified
> frames or something. It never made much sense to me, but if the
> comment that went along with the code was right then sometimes the app
> defined event is never delivered and therefore the event loop doesn't
> stop.

That sounds a bit like the second category of freezes I've seen in the
past, the ones without beach ball, where Emacs apparently handles
Cocoa events, but no input events are transferred to keyboard.c.

I think the other category, the freezes with beach ball are older than
bug#65834. I've had them just from the start when using Emacs again.

> I can't believe that's a genuine bug in Apple's code, because surely
> they'd have fixed it by now, so probably it's something in our code,
> but who knows what.

I don't believe it's an Apple problem either, for the same reason.

> You could try reverting that change and see if it solves your hangs.
> If so then we'll have to find another solution, like perhaps just
> preventing ns_send_appdefined from doing anything while we're creating
> frames.

I'll pass. I've never found a reproducer for either category of freeze,
and now I've had enough, at least for some time :-).





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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 19:26:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 14:26:58 2025
Received: from localhost ([127.0.0.1]:46723 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTQqP-000309-IC
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 14:26:57 -0500
Received: from dane.soverin.net ([185.233.34.30]:52473)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTQqN-0002zv-F3
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 14:26:56 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPGt13rJHz2xB9;
 Thu,  2 Jan 2025 19:26:49 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YPGt074LWzC8; 
 Thu,  2 Jan 2025 19:26:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735846009; bh=sb/hl47rWZlWCplZxM0O19loactoieob1UOqPYB+qKY=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=RMtX39Idc28tTD+nsJ6hvF99fA6pHsbhfj6IIdp9zGr2ePH9YmYCYyf0SsB7iFv+B
 sO/piLe9KqgCtMmrDwpEdynfq5RinTHcoJwaxLxoBQO2BsjmwnIDz35UdfpLDLXhjB
 keZhtbZtZbW/SDVisw1fns1ai/42296nFoiNejQoQbgA3Ng8LfqqDYdiwtEy0weiWE
 pRYrJgoMIPL5uuQAaRdk2AlBWXkzFmIbagtURY5oGifkKqxv+QTX00MbVvfayB1sL8
 TygJ2ZkyeFXy61qQsZeN5uhMtnm37UezAISe6wRr4swSTdd9D9zmTHwhcNW4/HDmCh
 aik57A+rg+j+A==
X-CM-Analysis: v=2.4 cv=UsCZN/wB c=1 sm=1 tr=0 ts=6776e879
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=XfQ2KwjM35AwS284dHUA:9 a=3ZKOabzyN94A:10
 a=wPNLvfGTeEIA:10 a=9MSFP0l5Dcwi9NrB_JPx:22
X-CM-Envelope: MS4xfC2XvTW6KBd8iLdylN5G8u6b9l6z8dFtwIuu190GS1bmrZSfxKDIRotCtVmBogMEDviyYDpqDTw8yy6EN634zPXQEngiqimdYneoJlnh4J2Dg5wF7hjV
 GGGUIJU/5mg3tiumvhHdRowePSOI8LFla5TOunzGGM0HDlC+Sakp9qp4cjIVJAPyruF3cJ0ztwfwsiF5fqfRJ+bJlDI5xIZk/9ty821/CnYXjMBl2he+mBhQ
 XZtMTT1iJHYgAzkg1soa/igPkANlwbR1d6dsJnA6vwq4Ct98VmNHBN+48MMrI/d5
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id b82ebf31;
 Thu, 2 Jan 2025 19:26:47 +0000 (UTC)
Date: Thu, 2 Jan 2025 19:26:47 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3bodxZCWE9tr5cW@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
 75275 <at> debbugs.gnu.org
References: <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <Z3bO4Dww57CNBYW6@HIDDEN>
 <m28qrtglce.fsf@HIDDEN> <m2zfk9f6ic.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m2zfk9f6ic.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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: -1.0 (-)

On Thu, Jan 02, 2025 at 06:52:11PM +0100, Gerd Möllmann wrote:
> >
> > AFAIR my theory went like:
> >
> > - [NSApp run] + key event handler put C-g in the hold queue
> >
> > - ns_select_1 calls "run" (it did before my change).
> >
> > - I couldn't find how input events from the hold queue come
> >   to Emacs in the whole process, so I added that
> >
> > - The "call run in all threads" was then a mistake
> >
> > Seemed to work, to a degree.
> 
> Maybe I should add that that is kind of a loop. It can be that the first
> call to ns_select_1 has no C-g in the hold queue, NSApp.run leads to one
> being put in the hold queue. A second ns_select_1 then finds C-g and
> gives it Emacs and so on.
> 
> Why that whole thing hangs, is another question.

I suspect it's because we removed the code in bug 65843.

We removed that because there was a crash on start using a specific
desktop file. Something to do with a certain amount of iconified
frames or something. It never made much sense to me, but if the
comment that went along with the code was right then sometimes the app
defined event is never delivered and therefore the event loop doesn't
stop.

I can't believe that's a genuine bug in Apple's code, because surely
they'd have fixed it by now, so probably it's something in our code,
but who knows what.

You could try reverting that change and see if it solves your hangs.
If so then we'll have to find another solution, like perhaps just
preventing ns_send_appdefined from doing anything while we're creating
frames.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:52:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:52:17 2025
Received: from localhost ([127.0.0.1]:46517 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTPMn-0005zm-0j
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:52:17 -0500
Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:47493)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTPMj-0005za-TB
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:52:15 -0500
Received: by mail-wr1-x42d.google.com with SMTP id
 ffacd0b85a97d-38634c35129so8813192f8f.3
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 09:52:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735840332; x=1736445132; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2PpoOUZZhPx+6chU2ewDCE5gIPNBQ+S4YB9aWXGgo08=;
 b=m04n0S8OiDBBAPsO2pQy17nA6u8fENhOKMIgd6j3+GZ2hF1I43LjEEoPr5B7o4eXgS
 w6K0SGcU94k5Tqr8on7o632UE6euBNW+gYnEtB08QhLRrcUUb+8xkHHbs7WIJQNIdbFN
 41qyMZdrXaHEv3eHE/tR0ukM5/YH28rmd04vKX1ykk8GjcGsKotbLl2fsGcTvJlMq4/M
 TS06GsbB3T5E0J96h27L6hO0sEcYewjPfTCfj69pu4SDMr7zvEaA7zzyUBmAFkuLHQJ5
 aWkJEvFeoUagrT4l5KGNlTjbZvjD88CQPFu43M0R/Eu2xBxKaPUfVKZyr3Dx89LUXdBo
 +5uw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735840332; x=1736445132;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=2PpoOUZZhPx+6chU2ewDCE5gIPNBQ+S4YB9aWXGgo08=;
 b=LKSbDYdVUsJgOcg8Bv3C/m9+8s5EDjevsZvvIW4R3n+L24ZG/XneXeCUHTfVVpLsDu
 b6fC4ia/F/cqILLymAAB3GEn/2Gq3yQWKW5bktko7sAKxzUp4IwOlXj6Hl4+wTO43COM
 8LeBwT4Tx1xEmUo77JBYQzXCCxVmfV9TxzkFELQOdTfHyq+qX+FpHn+q3o1e2+Bo2z85
 yN+jJaK2KKFtXhUC5I9waJEfIzf/k2S/LVHyIOW5pHhC6kJtu9LLIHozM8d5qvCBjO+Z
 0ahxmSzRc32n5sEjkAOH8nsVSnRcO0noJX8GQtEUPPeIFXg9w7xH0/hIRm2rxHnTkKGf
 qt6g==
X-Forwarded-Encrypted: i=1;
 AJvYcCVg/Nnxi94IbhAUyjnEOWIkS4UoWVWMumDMrAerMdFbKxVzyQv5dzgagzxd8sBG41AqB9wnOQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YylVCB3Lm1LLPWDf28dxeNQKAhi+G3I2xZ96LAD+i4JUU1MOdoX
 6D23Thl2+xddva26C7qnwittLEVD2MMiuTsqY+bWZwNUsjvRRELyhcij4w==
X-Gm-Gg: ASbGncstXjtMxfFJtoVROTbFwWQs2m/P8HJw8iAXu+v+eFRSFw/mDgg37WRxa2aE9Zg
 Zug7W4W4h7PibFgOqrQ1Uvbu/HDYD0DLc4ygEhugdGisi/9BNz6lp4YQv7WphfcK0NJJNSVuSiH
 U93MKX1dEG/jsiP5C9B+NGDChkMQ3djy1vDuVVy86z/J6LgBLIzWuq12b+pMudqwncsz+YYyJcF
 pSDVoirbnRdTQ0+9NztrnLOkaEk+CjaVlWLeISAS/hv3Jv/w8z/RAEhyZVxsBhmib2r8GMrHjCa
 rnauGyxIp3k7DtRoDCDOcneWe91lFtObzJaqjDzCeTn4Dy337/ie//u9tfLJwD1M
X-Google-Smtp-Source: AGHT+IFBT8II6pSPyKGMFfXcxu52Oogi+BRWUdeKkbialatJHwH4v0PYL8D4vvCc6QUDLXdmVLx0lg==
X-Received: by 2002:a05:6000:70a:b0:385:fd07:8616 with SMTP id
 ffacd0b85a97d-38a221403c5mr43886625f8f.0.1735840332326; 
 Thu, 02 Jan 2025 09:52:12 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c832a90sm38235616f8f.28.2025.01.02.09.52.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 09:52:11 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <m28qrtglce.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
 =?utf-8?Q?s?= message of "Thu, 02 Jan 2025 18:46:25 +0100")
References: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <Z3bO4Dww57CNBYW6@HIDDEN> <m28qrtglce.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 18:52:11 +0100
Message-ID: <m2zfk9f6ic.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Gerd Möllmann writes: > Alan Third writes: > >> On Thu, Jan
    02, 2025 at 07:22:21PM +0200, Eli Zaretskii wrote: >>> > From: Gerd Möllmann
    >>> > Cc: Alan Third , stefankangas@HIDDEN, >>> > 75275 <at> debbugs.gnu.org
    >>> [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2a00:1450:4864:20:0:0:0:42d listed in]
                             [list.dnswl.org]
  0.1 URIBL_SBL_A            Contains URL's A record listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
  0.6 URIBL_SBL              Contains an URL's NS IP listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (gerd.moellmann[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  1.0 FREEMAIL_REPLY         From and body contain different freemails
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Alan Third <alan@HIDDEN> writes:
>
>> On Thu, Jan 02, 2025 at 07:22:21PM +0200, Eli Zaretskii wrote:
>>> > From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>> > Cc: Alan Third <alan@HIDDEN>,  stefankangas@HIDDEN,
>>> >   75275 <at> debbugs.gnu.org
>>> > Date: Thu, 02 Jan 2025 18:09:46 +0100
>>> >=20
>>> > Eli Zaretskii <eliz@HIDDEN> writes:
>>> >=20
>>> > >> Date: Thu, 2 Jan 2025 16:06:25 +0000
>>> > >> From: Alan Third <alan@HIDDEN>
>>> > >> Cc: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>,
>>> > >> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
>>> > >>=20
>>> > >> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
>>> > >> > That patch fixes it for me, indeed.  Thanks!
>>> > >>=20
>>> > >> Hi Stefan, any chance you could check this version?
>>> > >>=20
>>> > >> I have a suspicion that Gerd's will break C-g again.
>>> > >
>>> > > Did C-g work before Gerd's commit back in March?  If not, this is n=
ot
>>> > > a regression.  If it did work, can you explain how the change Gerd
>>> > > proposed now will break C-g?
>>> >=20
>>> > It's different. I made the change because Emacs freezed and C-g did
>>> > nothing. With my change, Emacs freezed and I could get out with C-g, =
at
>>> > least sometimes.
>>>=20
>>> Your change included 2 hunks, and the suggestion is to revert only
>>> one of them.  My question is whether this is likely to reintroduce
>>> some regression.
>>
>> Perhaps I'm wrong. Gerd, can you remember, did your change for C-g
>> require ns_select to run the NS runloop, or did it just require the
>> clearing out of the input queue? I'm just concerned because this
>> change will reintroduce situations where it won't run the runloop.
>>
>> The more I think about it the more I think I'm wrong...
>
> AFAIR my theory went like:
>
> - [NSApp run] + key event handler put C-g in the hold queue
>
> - ns_select_1 calls "run" (it did before my change).
>
> - I couldn't find how input events from the hold queue come
>   to Emacs in the whole process, so I added that
>
> - The "call run in all threads" was then a mistake
>
> Seemed to work, to a degree.

Maybe I should add that that is kind of a loop. It can be that the first
call to ns_select_1 has no C-g in the hold queue, NSApp.run leads to one
being put in the hold queue. A second ns_select_1 then finds C-g and
gives it Emacs and so on.

Why that whole thing hangs, is another question.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:48:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:48:40 2025
Received: from localhost ([127.0.0.1]:46503 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTPJH-0005mc-Pb
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:48:40 -0500
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:52589)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTPJA-0005mL-Tf
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:48:37 -0500
Received: by mail-wm1-x336.google.com with SMTP id
 5b1f17b1804b1-436341f575fso120337205e9.1
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 09:48:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735840111; x=1736444911; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=/c7EY+ETMJ3/UY4+ZG027377ufw1xYbxvnB+KGPOxNE=;
 b=Fgkk7fU5+flN+i7iFAk2fk6TPbtOR7pREO638l5I5xog3qEruWDjILTV23V7ih3up8
 jvnSSZAWS+hgu9xm06bkln22Zg1ndaZYK4AwarVHXXbDqodLAvKLMA7wG9+29CPa26D6
 i6il+Tl3rjxajhBFS0fuVwbESHKUICD/qLxra2W+gU9bSRSpaFyudaxbEfQrFhvJswAW
 55oWgUD0ageMUyH6es9ik4jyU9T7w2XpRpQvCgCnoIyxh9EDombl0ymrJYuoBeCu3Wmp
 VxcPAAfzuuFgz7GaFn3/t7RzvQgZWvc7toqYxXbm5T/BGPpiFYnUYI/RSw3A+01CvKQG
 kwaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735840111; x=1736444911;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=/c7EY+ETMJ3/UY4+ZG027377ufw1xYbxvnB+KGPOxNE=;
 b=A0qXQEQBERQEGqtc7Yzv/6tV5ncY5586fPrptU9sucJlgWNJsV8CHvry4rq+3vN8c7
 kHfRA6eun5WYOSXIayMXe9SdOcbHe+ubZWP2AhBIRc5KDAz8hz0NHf22BepOAeXYtWV+
 s5oEOiM+cZEyeaKspuVCoo3E7XFp+XaGhuKVE5PMwgnH1iuRX11zaxx2JIFIFCGuIYYX
 cK4Pq7YJRpJb9M7BYVgLlA43LX/+6h0RJxdYpXqqbjS3rTbZ0DhFIAB3Y9gK2ToXak/p
 ru5dt04ZUtaPbf1xYWUTEmkfSk/ao44VS/nwnDSag2QXJROJ+6O0yERZ9Adr7d0CJAEr
 AuvA==
X-Forwarded-Encrypted: i=1;
 AJvYcCVR81S0BZaE4u3xRFSMAJtlvQv+US3c0bF4ZSb9VF99z7pfcDx7syLEd77IIdWpUUlxodAMlw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwAsU0klEFKu6IxF6WuKypjhw8B+RnsxmWO7gyPw4Wl1v4jMgoG
 jwech5ODiZjyTf6Xvqs3cLY1zhWc6G8wBLLBLW6j7PiZeYDtJ6GuG8x9sA==
X-Gm-Gg: ASbGnctFPw8SY4tzoieg8mfluW2hQvpiNRtgjmBFwLvOhsFGoc/AYa3Lwlq4lkHDsZd
 vA+EBRLK3Mf+TNTBg3wZ12CDhb3avXREAquMDxbVN/Xg6Tg65jj8eehMsV9pfXlIafBZxKTJ4qT
 5fiUVpuikNVTy/8yrP7JHzo1PdT5eAnL79skoUBDmcZIfvPzfMcz0rV3Lc0OV6GEWkJ6cWB7skL
 j0Jf5zI+PtQgScAHcpgvdKwP0x1HcjTOh3HjFalV2UG/U41tlF3bDzAEV9feh3tEnpeheeGL2rM
 7mtf0C0BvyV5rQMKmuut+LzzOJsUhBCb9LCj7NYrl1Ao8lCDiXspxV1uEwH6ZkDY
X-Google-Smtp-Source: AGHT+IEXFxc0a2hXab2jX934dNo8dXGTdRM9C5CyCis2w5Yf4TUHtwqIPaHVtnO4ZAh6lCBOrdSK9Q==
X-Received: by 2002:a5d:5e09:0:b0:385:f909:eb2c with SMTP id
 ffacd0b85a97d-38a223f7548mr41680413f8f.38.1735840110732; 
 Thu, 02 Jan 2025 09:48:30 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a47c9b2efsm19274339f8f.91.2025.01.02.09.48.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 09:48:30 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3bQHwOMW4nVf7MR@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 17:42:55 +0000")
References: <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <m2cyh5gmat.fsf@HIDDEN> <Z3bQHwOMW4nVf7MR@HIDDEN>
Date: Thu, 02 Jan 2025 18:48:29 +0100
Message-ID: <m24j2hgl8y.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

> On Thu, Jan 02, 2025 at 06:25:46PM +0100, Gerd M=C3=B6llmann wrote:
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>=20
>> > Your change included 2 hunks, and the suggestion is to revert only
>> > one of them.  My question is whether this is likely to reintroduce
>> > some regression.
>>=20
>> Not that I know of. It restores things to what they were before,
>> prevents calling NSApplication::run from being called for non main
>> threads, and the first hunk should still work as before. But note that
>> Alan thinks differently.
>
> Sorry, if Gerd's sure then I expect I'm misremembering how it worked.
>
> Please ignore me.

Rather not :-). Please see my other reply.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:46:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:46:35 2025
Received: from localhost ([127.0.0.1]:46499 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTPHH-0005io-5V
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:46:35 -0500
Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45123)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTPHE-0005iN-PW
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:46:34 -0500
Received: by mail-wr1-x42e.google.com with SMTP id
 ffacd0b85a97d-385e1fcb0e1so6366803f8f.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 09:46:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735839986; x=1736444786; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=t4pgCdhdx1mmdkcCgJA6uMlsHq1Z1e38+wIVxZXsIbk=;
 b=VkJlSeNiMbUN8erE/DzEnKjsctq69dA0YiHmlz27wIHy3LLzaGxspqdJwuZfP3BRdp
 lO28E9TxC/5oEKI6g8qvuktnzoWzZWg/yy+JsE29Cya/fQ6dNeQLuo2WlSHxvrdTJekZ
 J8WRvP6l6vRwsFHhXLvJLE+XWlEkMIkJfqD6Y4V5mYEcoxixXz2auq5eCtHz6fX5F60V
 +rVcXNWJmRGr5TTPqjU4ym2eOd30yccHVguJMwziCH79/8xhzLjaRMhsQC6D1c6HqXq+
 PS9xpLXvkxn3yvXbosFyDV66lZd3M49DuTghlMpwOMZX4bLyrdtM8iEVuEKjQvgm1B/5
 GzaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735839986; x=1736444786;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=t4pgCdhdx1mmdkcCgJA6uMlsHq1Z1e38+wIVxZXsIbk=;
 b=DQgEWhb1VIVmUQGJ3q9dsO6TeNwYVt/UcFTnlNRxRR6RhsznLPKBmsy2Qconp0ATpK
 dbpnMvpUxoqzIUThGi9fbiigIfnod3e2mhT3gFxdjYtEbMpUsYGx35laqkeZ9SSsv5ZN
 nOxl7C3880uepkKi+BWZyBpFuijBgpcH/EI+UuK6FOQZNeqzL6LS7fjLNEENbdbL6PcA
 Y8Xo8+n7I2JN0usZl0hXG8NG33YpTCMJvlA3S8IN9r5m/a8kjc69ohycZWDKMqwugmKq
 qyoqaESHtG+dFU7m3CM8zOEsProHkvkovOxji8IVkccMWEQ/uuG9EpotochWz0Kx5JPK
 TbUA==
X-Forwarded-Encrypted: i=1;
 AJvYcCVYF+eEbf/YEuSaCPT3180egcbFFWgwq9VG6tcVOOTaFp2BkBGgRYU2zbipWh9kT3HqXMaJng==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyE+ugacytR6inPo/h+SNVGM00/qUo+dIVXsdusDNCgvLiP/xtG
 lEY8/xnLMbvK+6a1sHIO5bfc5JZC7b9LGaapHnz+dFaBrBaD25B9lCS4vQ==
X-Gm-Gg: ASbGncv3h13fv0ZXCL14HNnM2IeB68T6ZswgEsdXxWWYJn9nEuRCr74pUceK/ue2c47
 b6pVx4zn/+nYhcor0D7cC684XqSjPLE0c3eMIngXmpLMRANLpj2ifbrE/2lGJsc9LTQ9NlTamdy
 c0hfSBE9Xazz/3JMNTbGs4fNOekPeKCWp8jBuHziMy2RdTgOdoNI2x7lmAqfXXmN4Ka8z8F8GUw
 5paCj21JmvrehjsqcHtsK0BB9jCAOfH8k8QgkWZH2YinPUHTFyQvLZYoW4ahwjviBmqXipgXbQa
 tEofnRwEHIR9NvzULIAhDciQkFI8YtTg6cl26dcx01mEv+hPqkK45QrsIbsjbInT
X-Google-Smtp-Source: AGHT+IEqF0kkwJbkUt2oshvf76GwJH9JqWWWC8QGmlSEG8YnFg0pptQXyVNyizbJ5YyC2/FIe3vSSQ==
X-Received: by 2002:a5d:584b:0:b0:386:373f:47c4 with SMTP id
 ffacd0b85a97d-38a224053d8mr40698456f8f.49.1735839986134; 
 Thu, 02 Jan 2025 09:46:26 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c8a636asm39650305f8f.88.2025.01.02.09.46.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 09:46:25 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3bO4Dww57CNBYW6@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 17:37:36 +0000")
References: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <Z3bO4Dww57CNBYW6@HIDDEN>
Date: Thu, 02 Jan 2025 18:46:25 +0100
Message-ID: <m28qrtglce.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Alan Third writes: > On Thu, Jan 02, 2025 at 07:22:21PM +0200,
    Eli Zaretskii wrote: >> > From: Gerd Möllmann >> > Cc: Alan Third , stefankangas@HIDDEN,
    >> > 75275 <at> debbugs.gnu.org >> > Date: Thu, 02 Jan 2025 18:09 [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.1 URIBL_SBL_A            Contains URL's A record listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
  0.6 URIBL_SBL              Contains an URL's NS IP listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (gerd.moellmann[at]gmail.com)
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2a00:1450:4864:20:0:0:0:42e listed in]
                             [list.dnswl.org]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  1.0 FREEMAIL_REPLY         From and body contain different freemails
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

> On Thu, Jan 02, 2025 at 07:22:21PM +0200, Eli Zaretskii wrote:
>> > From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> > Cc: Alan Third <alan@HIDDEN>,  stefankangas@HIDDEN,
>> >   75275 <at> debbugs.gnu.org
>> > Date: Thu, 02 Jan 2025 18:09:46 +0100
>> >=20
>> > Eli Zaretskii <eliz@HIDDEN> writes:
>> >=20
>> > >> Date: Thu, 2 Jan 2025 16:06:25 +0000
>> > >> From: Alan Third <alan@HIDDEN>
>> > >> Cc: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>,
>> > >> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
>> > >>=20
>> > >> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
>> > >> > That patch fixes it for me, indeed.  Thanks!
>> > >>=20
>> > >> Hi Stefan, any chance you could check this version?
>> > >>=20
>> > >> I have a suspicion that Gerd's will break C-g again.
>> > >
>> > > Did C-g work before Gerd's commit back in March?  If not, this is not
>> > > a regression.  If it did work, can you explain how the change Gerd
>> > > proposed now will break C-g?
>> >=20
>> > It's different. I made the change because Emacs freezed and C-g did
>> > nothing. With my change, Emacs freezed and I could get out with C-g, at
>> > least sometimes.
>>=20
>> Your change included 2 hunks, and the suggestion is to revert only
>> one of them.  My question is whether this is likely to reintroduce
>> some regression.
>
> Perhaps I'm wrong. Gerd, can you remember, did your change for C-g
> require ns_select to run the NS runloop, or did it just require the
> clearing out of the input queue? I'm just concerned because this
> change will reintroduce situations where it won't run the runloop.
>
> The more I think about it the more I think I'm wrong...

AFAIR my theory went like:

- [NSApp run] + key event handler put C-g in the hold queue

- ns_select_1 calls "run" (it did before my change).

- I couldn't find how input events from the hold queue come
  to Emacs in the whole process, so I added that

- The "call run in all threads" was then a mistake

Seemed to work, to a degree.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:43:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:43:04 2025
Received: from localhost ([127.0.0.1]:46491 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTPDs-0005WU-FY
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:43:04 -0500
Received: from dane.soverin.net ([185.233.34.25]:58681)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTPDq-0005Vg-ON
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:43:03 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits))
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPDZ85MvczydL;
 Thu,  2 Jan 2025 17:42:56 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net
 (Postfix) with ESMTPSA id 4YPDZ818bQzL7; 
 Thu,  2 Jan 2025 17:42:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735839776; bh=zhlSLRUpPEWG+aURbJQbs7M6CHaCu0h5teLNXnuIaNA=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=b5a7Gqy/07+kURTTEIjWiu9AJdjP0zCIqlrLkoJALkpxY9J9gigBEytylIMVacfya
 rdpQoSnI/XoIWmHCFD0AiBgWivkwHYFo5gnpfvMewJJ6WxeoA21EsCISIttISIchyR
 PR9X8xx6HlprcSuDNTE1CQv0n7NoakgTOrvGp2M9g0gevAlW52m383ubGi9KzjZtOK
 4rB72Q0KWyhz5LQoyOAqZpF2qDJprVZpelJbH5LQbYB5S1MlkZ20Yxm6LISl3cNwrH
 Y0AuV9BuvXCHw+O2J5zHM1Bki2CKA8G1Ad4t+89Fg5jTJixq05knoCFPAOc0GJCcwj
 n6200AxOQYkCw==
X-CM-Envelope: MS4xfJYUb04pVGs6R3hfc68AT9HAoG+rOXRNJ34rNzqxCqBts2ktOr8MVkgqWo0bQoq/uZ4SpvPFTAIX9YFr1GMxr+BXWoRSFMRC3a5Mkug+LGnO8E5MEpyG
 sUZAWLqTpZuBLVYcwrFU4XbF8R8zDjaNzujQDec1361EKZiCMFx9hdsdaFDsZ0fHJZ0KZDTSXpKqyrHImxBe1Xm5oXqbwfvsbOAckctXyYbN8E/txqHwAECZ
 zvOS2fL3zP6FiuuBbP4NX4NdcRT/TkDeUu7vthPJsrUzWuh7aRIHy9nulknCNSD+
X-CM-Analysis: v=2.4 cv=UsCZN/wB c=1 sm=1 tr=0 ts=6776d020
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=mDV3o1hIAAAA:8 a=oZsT26Yah43c72oftlYA:9 a=3ZKOabzyN94A:10
 a=wPNLvfGTeEIA:10 a=9MSFP0l5Dcwi9NrB_JPx:22
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 550eb430;
 Thu, 2 Jan 2025 17:42:55 +0000 (UTC)
Date: Thu, 2 Jan 2025 17:42:55 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3bQHwOMW4nVf7MR@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
 75275 <at> debbugs.gnu.org
References: <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
 <m2cyh5gmat.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m2cyh5gmat.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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: -1.0 (-)

On Thu, Jan 02, 2025 at 06:25:46PM +0100, Gerd Möllmann wrote:
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Your change included 2 hunks, and the suggestion is to revert only
> > one of them.  My question is whether this is likely to reintroduce
> > some regression.
> 
> Not that I know of. It restores things to what they were before,
> prevents calling NSApplication::run from being called for non main
> threads, and the first hunk should still work as before. But note that
> Alan thinks differently.

Sorry, if Gerd's sure then I expect I'm misremembering how it worked.

Please ignore me.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:37:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:37:50 2025
Received: from localhost ([127.0.0.1]:46476 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTP8o-0005HP-AH
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:37:50 -0500
Received: from dane.soverin.net ([185.233.34.31]:49629)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTP8l-0005Gz-DJ
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:37:48 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPDS15r0bz2xgr;
 Thu,  2 Jan 2025 17:37:37 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YPDS12RrzzC8; 
 Thu,  2 Jan 2025 17:37:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735839457; bh=vcdKulzfGK7v7EHX8kwQabrKXpWtc4raytaonjhXQqI=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=m3TOsESrpCokEI4Xr6mLddmZw8REHN8oayH8nH6YCcQffjQPyj8vRauqAKXB3XQE1
 i4QcLKIWPGutFuh5Ip2PE8ZC5iys5FaVfo0PUijjWap08iPTYRdL7hEADHauaAvmhY
 T/dHUxy7OrB+2SEZ0BopNM0krnqiOuE60WdTkuHRjjcF2I50NMLTrUOAWVLenYydTf
 NO/mzTHWiMMFfrOWwe7nykYwih7WzBOhcv8AHs7CC0ToHLD7V+3IF1DF3jW8buq05O
 lIU2v1IekKay5sc/6IDJsxK6f7uKpPt/wukgQeJcBZzcCoonzZp3xq/+q0PJhIUgUh
 Kl8WVSXUHXnoA==
X-CM-Envelope: MS4xfB8bAi9si/l37/KMKgek44a39evjxZnOlh6ayECuR+Ppne5JJgKupACotQGhGNA1G6jdj256mGyvc76SVbxLd1wKiXWg9JqfqVxBD5LthqC38nWCNQ3+
 TcGBasEPtxf3e1r7PRBCtU8ZwqAhpAmjrrQncfedc47pQINlev//kfoMjAiqX/5w+DyVQ3jL+f5xUJuVfkq0bLSptgoBG6L32xthvFw/IlVEEcDnJor48RAP
 NFOhz7ksrnrHQGiD1ViY3F0ObLZ133jixJV7L1R4rdCB0W4PapHRIH+aEmJxfBLX
X-CM-Analysis: v=2.4 cv=WMmFXmsR c=1 sm=1 tr=0 ts=6776cee1
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=pGLkceISAAAA:8 a=hIj89exaAAAA:8 a=mDV3o1hIAAAA:8
 a=wyFDut7xyAg2d0VpuZEA:9 a=3ZKOabzyN94A:10 a=wPNLvfGTeEIA:10
 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 62d82032;
 Thu, 2 Jan 2025 17:37:36 +0000 (UTC)
Date: Thu, 2 Jan 2025 17:37:36 +0000
From: Alan Third <alan@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3bO4Dww57CNBYW6@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 stefankangas@HIDDEN, 75275 <at> debbugs.gnu.org
References: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <86bjwpjfle.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, stefankangas@HIDDEN
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: -1.0 (-)

On Thu, Jan 02, 2025 at 07:22:21PM +0200, Eli Zaretskii wrote:
> > From: Gerd Möllmann <gerd.moellmann@HIDDEN>
> > Cc: Alan Third <alan@HIDDEN>,  stefankangas@HIDDEN,
> >   75275 <at> debbugs.gnu.org
> > Date: Thu, 02 Jan 2025 18:09:46 +0100
> > 
> > Eli Zaretskii <eliz@HIDDEN> writes:
> > 
> > >> Date: Thu, 2 Jan 2025 16:06:25 +0000
> > >> From: Alan Third <alan@HIDDEN>
> > >> Cc: Gerd Möllmann <gerd.moellmann@HIDDEN>,
> > >> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
> > >> 
> > >> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
> > >> > That patch fixes it for me, indeed.  Thanks!
> > >> 
> > >> Hi Stefan, any chance you could check this version?
> > >> 
> > >> I have a suspicion that Gerd's will break C-g again.
> > >
> > > Did C-g work before Gerd's commit back in March?  If not, this is not
> > > a regression.  If it did work, can you explain how the change Gerd
> > > proposed now will break C-g?
> > 
> > It's different. I made the change because Emacs freezed and C-g did
> > nothing. With my change, Emacs freezed and I could get out with C-g, at
> > least sometimes.
> 
> Your change included 2 hunks, and the suggestion is to revert only
> one of them.  My question is whether this is likely to reintroduce
> some regression.

Perhaps I'm wrong. Gerd, can you remember, did your change for C-g
require ns_select to run the NS runloop, or did it just require the
clearing out of the input queue? I'm just concerned because this
change will reintroduce situations where it won't run the runloop.

The more I think about it the more I think I'm wrong...
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:25:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:25:57 2025
Received: from localhost ([127.0.0.1]:46443 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOxJ-0004fc-1g
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:25:57 -0500
Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:47185)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTOxG-0004f4-Pj
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:25:55 -0500
Received: by mail-wm1-x32d.google.com with SMTP id
 5b1f17b1804b1-4361fe642ddso122205765e9.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 09:25:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735838748; x=1736443548; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=MI7DkzslcJ4hz40hxHmI+hBZjBdBoLPJW6hPEpS3KZI=;
 b=GNv0e5zbq8waDFtW4Xpa7PF86nnmRqfP3zyyXe7inVgoBQ5RFqilLyNpyVElXoFEhY
 hw5x2pJHr2YfJ4vJ0v/PHLht9NvZ4CcY05oiUXBAvQueuGGNHNqWDT2BhQ8N/J6qGtgV
 3a8FhIGadbaZNIkfs1blMoerj5dfktWYm5Xs6U0vZyf14/UjoUSbEf63ZexK30tVlXaz
 lSsqFHjfcARf+KWrpMNIHN3KRwlTPrw4TNIN7Qu8s/RYhl7RnXDGkJW2EYnHNyVRW5Cp
 dzek5G62iYgCScrcQ5kyiWF7lzfWXlDRYr14+9Dcl7z/RUnawjqaWakvARJHOLvzA2vr
 /UDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735838748; x=1736443548;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=MI7DkzslcJ4hz40hxHmI+hBZjBdBoLPJW6hPEpS3KZI=;
 b=nAYZ7/mw9CMsUf2cXlBN0WDDm+4hD22ZdhTFgfoh/2GsksrWJuz6p9+nP7WgIZ3wFq
 dez0LBFjxpGjtohTnQT4jHRL7xFpaF2Ps3Lez4PTi06NIxfypJrNRddeHcUk0t/bQVTm
 sYIf4QFzVd57TplvrzNERt13kPn3Nyib8mooibegnuSuUCjcRFSXOKmuotxiH8Tb9gpx
 YXit3FE5FMaayZ7r7laISyAmY6zIXsSIiORPhh8p0YKzb4nbLsTtFZEXhfNEXsE8OPAV
 icG0kpptUZCGpxSIdvpf9fcBMV8wl4/XjxqTBWdsvDD3Oe+5qB1hTMJftMsbRt6GlbMl
 k9bQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCX2wJ9YlJJKRBd2IfuQX6MTkANlsFQJ23vfmSDxambEU9IKksTs/r3MXoUUOI8NbSOC32qVKw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxBzb4Mc0TZ4dr8K7G+1A7nMuOw+gg6hZ6nYSFEGKuScUdwVqnk
 MUmi/FuM3wpKQdhlZhdSOiJi994+XBRyjwQRDYkDk4yj/mx0z9zzEAEzEw==
X-Gm-Gg: ASbGncu/NmsEcKh7Vt/z5zci0aJDNwMGELxXB0wurrCHENaGAnYzQmlIzqgFcFu8AtW
 2RdYe+buBWvZ9rL9j5u+IEJlYKa15juliROgHfn4Fr3dT2jwI+1Xcd9UUxo+exRSGkIph83uaxt
 ZdNGpui6/m4XPuESGuu2XmEGDHpUx/JaB7onUBWAzgIlydLvlXPynVWBcFk0u36wCK092aP6Lpl
 qqMFgio/PGwXNCGqjhOybdh7aYZgbT66vZmka2OJPG+bWdpz8pnnzPBn4tdXW4wg2vq9N698Eq/
 SpnvIjOd5mOA95UAhkRPba0fRmaTLrV5Ci9NC6CkAI9r4Ihlugvo6TFnIRn7swwn
X-Google-Smtp-Source: AGHT+IGjPrQJjCCPCmPVNLT7WVzCIfVActacdBe3YeFHhrlCFMZhRGENDA3Xvr9PVqqFT+dtuGohcg==
X-Received: by 2002:a05:600c:3b23:b0:436:4708:9fb6 with SMTP id
 5b1f17b1804b1-43668b5e02dmr345895645e9.20.1735838748177; 
 Thu, 02 Jan 2025 09:25:48 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43661289a18sm455930155e9.37.2025.01.02.09.25.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 09:25:47 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <86bjwpjfle.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 19:22:21 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN> <86bjwpjfle.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 18:25:46 +0100
Message-ID: <m2cyh5gmat.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> Your change included 2 hunks, and the suggestion is to revert only
> one of them.  My question is whether this is likely to reintroduce
> some regression.

Not that I know of. It restores things to what they were before,
prevents calling NSApplication::run from being called for non main
threads, and the first hunk should still work as before. But note that
Alan thinks differently.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:22:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:22:33 2025
Received: from localhost ([127.0.0.1]:46411 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOu1-0004Ra-3B
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:22:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:38504)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTOty-0004R3-Qm
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:22:31 -0500
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 1tTOts-00065K-LV; Thu, 02 Jan 2025 12:22:24 -0500
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=FBLEz13PVaNk7trWlFLcGNlSfosz4jglh4cUDa7pAZw=; b=nceMEFOicB688i0uobe2
 6X9uiRAXp7XhbeUdvaLdYGrnXe+SAoZ1gprVAE3VZ7YBH09sERi7gxtzuClmJCnRn0F9Z1ErHjQmc
 +16Kf2paH/VcIyAmVegzWvMGSkYFuB3xM8CsKIDYM75feHxPJu7ByDk+sIQERiSH1h2vAJ6Re7wgY
 OVLLZwPKqDLcRYhdTz+irVhiRaLLSkiRBbF5ZlN0BYdVg/EQtNnlEuOIFyhw5bQ3m82v0TElE2X9Z
 opTq9NJa5DAkZMKam/hdmE9Eoz3x3nO2KEozhNjHpXagpMG0Vgpdx4O8cxouKhD7u/L3frMfgN4gT
 OMtuOxl8juwQRQ==;
Date: Thu, 02 Jan 2025 19:22:21 +0200
Message-Id: <86bjwpjfle.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <m2h66hgn1h.fsf@HIDDEN> (message from Gerd =?utf-8?Q?M?=
 =?utf-8?Q?=C3=B6llmann?= on Thu, 02 Jan 2025 18:09:46 +0100)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
 <m2h66hgn1h.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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: -2.6 (--)

> From: Gerd Möllmann <gerd.moellmann@HIDDEN>
> Cc: Alan Third <alan@HIDDEN>,  stefankangas@HIDDEN,
>   75275 <at> debbugs.gnu.org
> Date: Thu, 02 Jan 2025 18:09:46 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Date: Thu, 2 Jan 2025 16:06:25 +0000
> >> From: Alan Third <alan@HIDDEN>
> >> Cc: Gerd Möllmann <gerd.moellmann@HIDDEN>,
> >> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
> >> 
> >> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
> >> > That patch fixes it for me, indeed.  Thanks!
> >> 
> >> Hi Stefan, any chance you could check this version?
> >> 
> >> I have a suspicion that Gerd's will break C-g again.
> >
> > Did C-g work before Gerd's commit back in March?  If not, this is not
> > a regression.  If it did work, can you explain how the change Gerd
> > proposed now will break C-g?
> 
> It's different. I made the change because Emacs freezed and C-g did
> nothing. With my change, Emacs freezed and I could get out with C-g, at
> least sometimes.

Your change included 2 hunks, and the suggestion is to revert only
one of them.  My question is whether this is likely to reintroduce
some regression.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 17:09:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 12:09:51 2025
Received: from localhost ([127.0.0.1]:46366 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOhi-0003kj-QY
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:09:51 -0500
Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:47199)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTOhh-0003ka-Dc
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 12:09:50 -0500
Received: by mail-wr1-x42a.google.com with SMTP id
 ffacd0b85a97d-385e27c75f4so8238389f8f.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 09:09:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735837788; x=1736442588; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=MxrYxy8aAk0VFPbug9BFZzF3QERSjYRmdTkw5BRT+j8=;
 b=THelSmr7F/ogHI16334L/5PUSuUGmPeiGPKiBlYQTGj6yvr0i7opdFjubU2b2EOJER
 Q8sUE8Qzg6jIzeci7VMjLS7RlnCi2fMXSv/UdzCUs3VvgiUsm3BoDSe33U2Cpf+MsSi6
 beDA1YNH1qQlYZRGAjM+a3kiVZmZkZSQaIK+1P0ZwPwkW3BpfL6gHbvE9LIQYmquw95c
 A6QccEjrtzkfbcE6VGcai3kaKQFDW1JLEbRuqIheCoEgiNbb3xVOODlWm4wbDzJNVhKN
 kqk3PpZ+2IEuTaI6Ktvt6UE3dLpq7uSaGzZ7FoI41lH81Yb3NzA2WGsLl3Xu7Ij7hU66
 4QGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735837788; x=1736442588;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=MxrYxy8aAk0VFPbug9BFZzF3QERSjYRmdTkw5BRT+j8=;
 b=HhyhvzSikNpnmwoon50PCEwTuDGyuNmulMnFV6SERWVOnsxBOkWayLyt2VsYVUuase
 6Wvyaao/rJ6vykK9F7BevvyPDOH01PQxAtp2reSQ/BPW/AdlybCVUOVkNpUyYqvX7GiE
 JWw7IQdBZ53/Qucb6IBz8mjzC2q31JaOHuHV+/ufXY1ZtyXvgu6uewPafqZqyMGvvBjV
 CTZi2QKwroZyLzst8pE+PA1M4nRva6whruji37yu1EYjn3PBMuiHLt9rHLHHfvOHVFyI
 dXnMhjWwSbeASkP7X8rJO8EVI6vrBSpJAugi4bb+AwCbKMSk1mcl+wAEF6FHz71EKv5P
 2Cbg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWKOtNv/n8WB72A7E5A+KT7UQOpJyI4LAEXwuZ0OpyzEBxbcOifqJ9L4EBjjMD6mU5Vc6e3RQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxjgrdZmsijcpOHXoAnH2DjDufU3eqOXMt1ua2b9CJAfmPy0qc0
 u+tPOgvNJ+db8PAa9HTZ6vkHYFtnI94bjmQeFcsHtB3Fau9I2YzbG5MGyA==
X-Gm-Gg: ASbGnct/vVDHkk8S7m9HSL0t6MajceiMdxvkheW/CggFa9Q9f1CybJGFiKH2sp9uchs
 1jkaTPOhx0V6lqX9TVcEQXVfg1hNE2eDNUI1wO7OOUmzG9gTq4ep7adut7GRYHTuJLh4KdFLUL8
 Qj9AFiqHvOR9OPCeZAxxIzC/oi2Y97W7M423u2rOIM7GFc6I6DZQHhqyxKQO45Yb7pmS8/qzMaj
 pCAvwOr47FSJawSNkpCexMHDGxLb7XcxFQuq0DdNYz2efoij18pQuLnpsSzHmN4cqSzEmO4ZwGV
 71qSe8NJG6WCmbodW0vWY0Y3Mq+pDhdOmYAXB7wzqVO1kuP1mVzIOynmoBT+LKM3
X-Google-Smtp-Source: AGHT+IHP2ydAJGonaKlefZLi/zSdicA2Gh/PO4Oj4XVcUOT+4o4Ew2U/tjf8dRDdJue71YNhyuJRCQ==
X-Received: by 2002:a5d:47c5:0:b0:38a:4184:1216 with SMTP id
 ffacd0b85a97d-38a4b9a98d4mr16639442f8f.46.1735837787789; 
 Thu, 02 Jan 2025 09:09:47 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c89e2f9sm39576852f8f.81.2025.01.02.09.09.47
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 09:09:47 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <86frm1jgpq.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 18:58:09 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN> <86frm1jgpq.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 18:09:46 +0100
Message-ID: <m2h66hgn1h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Thu, 2 Jan 2025 16:06:25 +0000
>> From: Alan Third <alan@HIDDEN>
>> Cc: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>,
>> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
>>=20
>> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
>> > That patch fixes it for me, indeed.  Thanks!
>>=20
>> Hi Stefan, any chance you could check this version?
>>=20
>> I have a suspicion that Gerd's will break C-g again.
>
> Did C-g work before Gerd's commit back in March?  If not, this is not
> a regression.  If it did work, can you explain how the change Gerd
> proposed now will break C-g?

It's different. I made the change because Emacs freezed and C-g did
nothing. With my change, Emacs freezed and I could get out with C-g, at
least sometimes.

Note that this didn't address the freezes themselves. The reason for the
freezes is still unknown to me. As is the reason for the freezes without
beach ball.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 16:58:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 11:58:23 2025
Received: from localhost ([127.0.0.1]:46334 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOWd-00039R-3n
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:58:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46108)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTOWa-00039A-Kp
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:58:21 -0500
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 1tTOWT-0001JE-Bn; Thu, 02 Jan 2025 11:58:13 -0500
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=JRhRmDYbl6ARSim6q0O/Z6ytvhqkj9TYMRfSgdWKPu0=; b=SMx/Kl2LtQoiI4KfiL7+
 XgrN6CWxeBAIyjwjVrRngJNvh/nmwRp9AMHW25FZW2pxPmL5FpxeUax3lyLwC0Q0hI31S/Pnxy9fI
 XLgFhxPJ9KiIq3xdGmuTQtqcWX1irwG4hQAnG2RHWcsnCc3PLtD1LFGGvdEENFH5f3UroSdhfszDF
 Hxx/9wj3LdfcAoH3xcEdUOKJVpSAiM2FtbvIwtENt2XSklBdZXBzX2nUL9GFALi8HkAbDhNeiPwHU
 LHlwc1jUOVWXcp/6Dh9US1HVUHPAipbYhaQQr6O6sz/4DKTAs4V3Ca+SKnOTpBM3fEJ7feM+krpNK
 5zP1JpxW1t40YQ==;
Date: Thu, 02 Jan 2025 18:58:09 +0200
Message-Id: <86frm1jgpq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alan Third <alan@HIDDEN>
In-Reply-To: <Z3a5gQqv7_7qHjrf@HIDDEN> (message from Alan
 Third on Thu, 2 Jan 2025 16:06:25 +0000)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <at> debbugs.gnu.org, stefankangas@HIDDEN
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: Thu, 2 Jan 2025 16:06:25 +0000
> From: Alan Third <alan@HIDDEN>
> Cc: Gerd Möllmann <gerd.moellmann@HIDDEN>,
> 	75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
> 
> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
> > That patch fixes it for me, indeed.  Thanks!
> 
> Hi Stefan, any chance you could check this version?
> 
> I have a suspicion that Gerd's will break C-g again.

Did C-g work before Gerd's commit back in March?  If not, this is not
a regression.  If it did work, can you explain how the change Gerd
proposed now will break C-g?

> I'm not sure this will be suitable for Emacs 30 though as it's a
> slightly larger change.

It isn't, indeed.  We could install it on master, but not on emacs-30.

Thanks.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 16:47:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 11:47:28 2025
Received: from localhost ([127.0.0.1]:46317 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOM4-0002eS-Iv
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:47:28 -0500
Received: from dane.soverin.net ([2a10:de80:1:4091:b9e9:2218:0:1]:47483)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTOM1-0002e3-Ej
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:47:26 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPCKy2wyNzycV;
 Thu,  2 Jan 2025 16:47:18 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YPCKy0WT9zC8; 
 Thu,  2 Jan 2025 16:47:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735836438; bh=BurRxEfUUcdDzJ9V5FP2J3S/nNl1mckTbiYO3fVjyd4=;
 h=Date:From:To:Subject:References:In-Reply-To:From;
 b=R1Frpcc+P2r7fTIWNUSvKto92CiWo6rB6ao1zH+WBfcTz+24lC66W13oMbp0PXziF
 kLnp4O+3XORY9YE2zs9JBmhqWcXWBmS6zAiUo77RFIpGh28UTlKUJqyR7xogFGgyc4
 NWhOXiocNMtTrAy2j1zaMrE7cxyVvqZhfWr+wo2LXXac+maqhgpRmjxvtOxoEagvb6
 U3hlQoGurf0oS1RQJKKhHEULkVCAYuR0lKPz322NzjATrD9+qvBatIaJVKKhJ5nv+0
 Isl7I/zL+pUPghtjBQ2wM62hb0STkvXXcFNS7y9axoChp6sDB8GgIDagebJXLCEkYX
 ZGpofFNIjEDpQ==
X-CM-Analysis: v=2.4 cv=UsCZN/wB c=1 sm=1 tr=0 ts=6776c316
 a=SDE2LKe6h6JkMCd/0VQazQ==:617 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10
 a=GETlnOtdsTEvLn-sA7wA:9 a=CjuIK1q_8ugA:10 a=M91JV_wKSCcA:10
X-CM-Envelope: MS4xfDWy4LrJwsyCkopcWCiq19O1QJ4M0hf8iUOkZ//r3djVBrBFAc7MQARWTaTWrGXmFfQeWIeK1e+1LexUsuQD9LUsNqDkN4KpKhhkzjotEhOLij3/ziSw
 S26zQn4WuQ0v9mY/BEIFREDQPaqmUoxs1x/XiugsUO/mZVOR8goLce0Eylsm95VQzwgftmHLQDw04ZXW8ZGWEGpiuFao6Uc9tA6btKpyDUriT1kFp4Z4LV4Y
 HUADZsgdKloKCpJ1eBHU/TJ8YSZHC4Fmf/ux5r/Ao/N18MTMxPAvY/D0IL3vJhc4V54J3TmifunF+aeOvkjeufpZUu1tm3yew+ROqhLhERM=
Date: Thu, 2 Jan 2025 16:47:15 +0000
From: Alan Third <alan@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3bDE9cHx7FDh-n4@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 <Z3a5gQqv7_7qHjrf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Z3a5gQqv7_7qHjrf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
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: -1.0 (-)

On Thu, Jan 02, 2025 at 04:06:25PM +0000, Alan Third wrote:
> On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
> > That patch fixes it for me, indeed.  Thanks!
> 
> Hi Stefan, any chance you could check this version?

Actually, don't bother. It hangs after some random amount of time.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 16:46:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 11:46:35 2025
Received: from localhost ([127.0.0.1]:46311 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTOLD-0002ch-3a
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:46:35 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58008)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTOLA-0002cA-9G
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:46:33 -0500
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 1tTOL1-00081i-Nd; Thu, 02 Jan 2025 11:46:24 -0500
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=jjc8hbWCIYrWbUV57tORWqtd3+97X5lBvf+im7ns6jE=; b=ZuEUsNOlE9zJjDC3k/o1
 foPIdqePL+RGTYewqvnYjT8nVn66Z3x2QmsrA3c2NORMDnsPlChpA/8O7hw5a9cjm6c3N+Ivz+qw0
 MTGvU/JW0wDQlakKZed1R88pM2bexvr3ckqc7gOdoHi2LN9sfQ4bSFIuKgqEiYRsHnq2eYcijEL23
 myFXDRedi4asskJOddQAnQWtEpbNZSkutW4rIk1lE/+Ve3aFCkFBLTvMpk5YVA03Cc1BziJhKDgoQ
 Nhf292R053rNXRBpik9HHPG7ZefgROSwng7lHFg+gGO1lRXRZNgh9m7rQCkMMlSXYTAP2lw/joD1G
 dNDihdL7SLtJBw==;
Date: Thu, 02 Jan 2025 18:46:18 +0200
Message-Id: <86ikqxjh9h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
 (message from Stefan Kangas on Thu, 2 Jan 2025 09:19:36 -0600)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@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: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <at> debbugs.gnu.org, alan@HIDDEN
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: Stefan Kangas <stefankangas@HIDDEN>
> Date: Thu, 2 Jan 2025 09:19:36 -0600
> Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
> 
> Gerd Möllmann <gerd.moellmann@HIDDEN> writes:
> 
> > Maybe this one, after what Alan explained. Could you try it?
> >
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > src/nsterm.m | 4 ++--
> >
> > modified   src/nsterm.m
> > @@ -4875,8 +4875,8 @@ Function modeled after x_draw_glyph_string_box ().
> >
> >    if (![NSThread isMainThread]
> >        || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
> > -    thread_select (pselect, nfds, readfds, writefds,
> > -		   exceptfds, timeout, sigmask);
> > +    return thread_select (pselect, nfds, readfds, writefds,
> > +			  exceptfds, timeout, sigmask);
> >    else
> >      {
> >        struct timespec t = {0, 0};
> 
> That patch fixes it for me, indeed.  Thanks!
> 
> Eli, since this is a regression, do you agree that this should go to
> emacs-30?

Yes, thanks.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 16:08:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 11:08:40 2025
Received: from localhost ([127.0.0.1]:46260 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNkW-0000au-EU
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:08:40 -0500
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:49219)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTNkT-0000aY-UC
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:08:38 -0500
Received: by mail-wm1-x32e.google.com with SMTP id
 5b1f17b1804b1-43623f0c574so78484205e9.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 08:08:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735834112; x=1736438912; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=xel1HQ0wDpWSAqyeETimeRRPwj7qRo33gIRiseN7feU=;
 b=nEwbcSgZU4usFqvoW445ND/qVXOHydlckkDTmVI6UFiMHURYW3/SKGgLVTJL1wL63p
 GwLFTkc42V4UVL8bg/ayeDYNITJEFlZ4af0rHxcNC4H3drmTSnvQ+tHw7NAxXBvaNzOk
 avVLE41d4p5eteHWp9bsoMSNcYEz03cZ7I85PrLQs9YCMlVX22bjc5g3K0K2Z9hU461c
 eXhzICBPmvDAIv02tGw9RgE7XJKo7D66Jp4OhEz7A2LfuvyZIwkftNSKlVipyEd2JRy7
 GgClyh0LECz3+3XmxKeTziCv7Sbvzm8AjppkqkJDkb8FsZheEmmlrfF70S3F7+HXgCqh
 Zgzg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735834112; x=1736438912;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=xel1HQ0wDpWSAqyeETimeRRPwj7qRo33gIRiseN7feU=;
 b=QIz2wX8lD5fbcFMeHlQ+tmJ+vidsicetyA7qn3uYKz42957vlefE7HnbiprBDpAGEE
 hLhuxJ5lC5JoUn0y7Nl6UyjW/Fh3mv8Qt03s3Q6l1x6duU6nmrfokueDTe1cGZJcf7Bw
 33SiasvLoyVdR6ftGyh6+ZybnhHxACWEg834arx5SWGuESGltmUaG/cT6ENvlxydzScq
 dojLXwrNyafaDeg0QU4RvU5qQBE6lvbJ22VmhfT+Jzu/Qp38K9B4m3F7FiMMYZQuwwc2
 cus+YBLp7I0nIZ6Muj5Y23JEam2ZEkmGxCPuc3WSDC9GSpIzqcKM0risXZJJbSpbQkDv
 7/Jg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWKLWZCTiNgwzBsMFZSsLZAarm/fWNObRaoWd1P1nGNRTTqowFrkhCyv/1YtIln3wi8vN0E1g==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yx9FZQV+LarIDqv7++MpXzuCB+oepNYENMan6+Y1JRlhMoybXzi
 bWaFLkpjJDXqv5j+PeBXQSzZB/2fkIg8jnlxNh4KcpBzq6IC4D1r
X-Gm-Gg: ASbGncsQDAdKxKmu8PSFAmHTRxEDX1k6xSZ0cTuCs8mkD3i0ll0doxC3kTUJkrpTxQe
 C6VnjZO6zTF0c3YE8mlEmordeS3bdd8SUo5ac/2E/8NjAGfn5hm4k1yANtztmy+XsQ4AjFsy7FY
 lXcdLIhp2o7OkfHY+//bHt8Y9s6P8B+CLOjcZPBtLgPIAvckUztPaW2bMxKuN06Qa9i+L671pfv
 1xbcT+dsNYkfnJhj9JXaWteKB5d2vnOycWCIAZ1vAHMnIeymlWSW3hRftNEgQTyMDsWZcywKUrG
 eCNL6iYz2jSrzSx7fHPIUSi+1bou0uq2Dr7WCAT8r2G+RRQV1XVBitjp3H/eiE+x
X-Google-Smtp-Source: AGHT+IHMB2DEV04fdMTVUyv2mF8crL7j/4j0se4hKFbf5nWxDLN5u8MBwUcvs7qaEpVUHrqJNVWaMw==
X-Received: by 2002:a7b:cb93:0:b0:434:f270:a4f0 with SMTP id
 5b1f17b1804b1-43668b49981mr348148425e9.21.1735834111454; 
 Thu, 02 Jan 2025 08:08:31 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c8bb4bcsm38624957f8f.111.2025.01.02.08.08.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 08:08:31 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3a2-RmDhLWYWBoU@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 15:55:37 +0000")
References: <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN> <Z3ZylsXjH2vbX8LB@HIDDEN>
 <86msg9jkqs.fsf@HIDDEN> <m2pll5grbk.fsf@HIDDEN>
 <Z3a2-RmDhLWYWBoU@HIDDEN>
Date: Thu, 02 Jan 2025 17:08:30 +0100
Message-ID: <m2ldvtgpvl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

>> But... when I look at fd_handler, that function calls pselect directly.
>> 
>>           result = pselect (nfds, &readfds, wfds, NULL, tmo, NULL);
>> 
>> 
>> Can that be right?
>
> I think that's OK as we've already called thread_select further up.
> I've a vague memory of putting this in as a work-around.
>
> We call thread_select with a zero timeout to give other threads a
> chance to grab the lock, then carry on as normal, running the run loop
> and fd_handler which calls pselect.
>
> To be fair, though, I think when we set this up I didn't understand
> the code as well as I do now, so perhaps it was the wrong thing to do.

OK, thanks!




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 16:06:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 11:06:38 2025
Received: from localhost ([127.0.0.1]:46254 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNiX-0000VV-OH
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:06:38 -0500
Received: from dane.soverin.net ([2a10:de80:1:4092:b9e9:2296:0:1]:33077)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTNiU-0000VA-J0
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 11:06:36 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPBQp74vPzKh;
 Thu,  2 Jan 2025 16:06:26 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YPBQp3ykYzC8; 
 Thu,  2 Jan 2025 16:06:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735833986; bh=ci/XmvFlNckshaXPIUcuicM+tfR/efr6FZqb+aCoZ6Y=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=j6YTGG8tHhtJ9E5xyfcTtztvcWwtS9CCEfOb6VRP+lk2CXdESJ6Czw3cB2BwgmA+H
 0/nnwS70fD7ufVUgfU25AJx+ubkJms9M+oykKztPSoHkklTwcnwrKJAIgURLXbztpq
 6ZUyD1nQmxfn+RtVYa2UaJoi4b+5ijipdgVy34VSI3relbgfB94kGgRbyOJA+KVjR5
 4ul4ipr51B/UUHZFZdVOZHwKtFIPbiUPVZVsX/K8WyXIQgXLPLbLsbRzHESFHsfXn5
 z5OCgi1bAukgQWL4pEnY/6ZZ7EOdPeA2vv/BJ42ykucKClIj9D0fgpQnyUZaruL9Km
 YcNPMo2CblXFw==
X-CM-Envelope: MS4xfHUuyHLlZ9mGKpLn9l+KkLJ3uAMKNuGwQXyWCis1Ku5XKDj/DhsfH7nxpcBbOo16iph7mOnSVpO73gOvQyMKoTw1IxSbSA9YXcNyNzxYJA6RUUJLPjT/
 eJeJiCDryjr5nZZwzEDZAkqp59owAwIaOp2/zUBAPgraJ16arfldTjbmrIj/5iXv1bOL7pykmeZTBkyR5XuqveEZUzyN6HdvQU0OsFv62vixx0d7qBaXup8f
 G6NJyPguE1sHTW4BKvJpIGM74I2yiUuOI2RhQpdSK9U+YXVDfbi/bUVnJDTfiOhPgV7qWigbGTTrncE51Z0IU6K9YtlfyjVMXvHBcpHGUTw=
X-CM-Analysis: v=2.4 cv=e8f8Sbp/ c=1 sm=1 tr=0 ts=6776b982
 a=SEWtJhW1qPLXjQrMhrOCWw==:617 a=xqWC_Br6kY4A:10 a=IyVuqPy-3UG8q-HI7ZcA:9
 a=CjuIK1q_8ugA:10 a=hIj89exaAAAA:8 a=Bjl_9Qrc-hz0sYYJxfEA:9
 a=lS9wXHQM5UdnNJ4u63Ry:22
Date: Thu, 2 Jan 2025 16:06:25 +0000
From: Alan Third <alan@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3a5gQqv7_7qHjrf@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
 <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="q6gNDNEXHHafaEcm"
Content-Disposition: inline
In-Reply-To: <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
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: -1.0 (-)


--q6gNDNEXHHafaEcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Jan 02, 2025 at 09:19:36AM -0600, Stefan Kangas wrote:
> That patch fixes it for me, indeed.  Thanks!

Hi Stefan, any chance you could check this version?

I have a suspicion that Gerd's will break C-g again. I'm not sure this
will be suitable for Emacs 30 though as it's a slightly larger change.

The C-g thing is hard to test as I think it relied on Gerd's machine
randomly hanging and him hammering C-g and it doing nothing. I'm not
sure how to replicate that original hang.
-- 
Alan Third

--q6gNDNEXHHafaEcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Fix-C-g-handling-on-NS-bug-75275.patch"

From 528dcb934485a5a1331b4cf851216a3750df3210 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@HIDDEN>
Date: Thu, 2 Jan 2025 15:56:20 +0000
Subject: [PATCH] Fix C-g handling on NS (bug#75275)

* src/nsterm.m (ns_select_1): Remove function.
(ns_select): Reinstate by copying the contents of ns_select_1 back
in. Add check for C-g at top. Stop fall-through to NS run loop when not
required.
([EmacsView showFontPanel]): Just call [NSApp run] directly, calling
ns_select for this makes ns_select more complex.
---
 src/nsterm.m | 44 ++++++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 26 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index a4398e79211..652eee1f988 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4826,9 +4826,9 @@ Function modeled after x_draw_glyph_string_box ().
 
 
 static int
-ns_select_1 (int nfds, fd_set *readfds, fd_set *writefds,
-	     fd_set *exceptfds, struct timespec *timeout,
-	     sigset_t *sigmask, BOOL run_loop_only)
+ns_select (int nfds, fd_set *readfds, fd_set *writefds,
+           fd_set *exceptfds, struct timespec *timeout,
+           sigset_t *sigmask)
 /* --------------------------------------------------------------------------
      Replacement for select, checking for events
    -------------------------------------------------------------------------- */
@@ -4837,6 +4837,7 @@ Function modeled after x_draw_glyph_string_box ().
   int t, k, nr = 0;
   struct input_event event;
   char c;
+  NSEvent *ev;
 
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
 
@@ -4844,15 +4845,16 @@ Function modeled after x_draw_glyph_string_box ().
   check_native_fs ();
 #endif
 
-  /* If there are input events pending, store them so that Emacs can
-     recognize C-g.  (And we must make sure [NSApp run] is called in
-     this function, so that C-g has a chance to land in
-     hold_event_q.)  */
-  if (hold_event_q.nr > 0)
+  /* Check if there are any C-g events on the queue.  */
+  while ([NSThread isMainThread]
+         && (ev = [NSApp nextEventMatchingMask:NSEventMaskKeyDown
+                                    untilDate:nil
+                                       inMode:NSDefaultRunLoopMode
+                                       dequeue:NO]))
     {
-      for (int i = 0; i < hold_event_q.nr; ++i)
-        kbd_buffer_store_event_hold (&hold_event_q.q[i], NULL);
-      hold_event_q.nr = 0;
+      if ([ev modifierFlags] == NSEventModifierFlagControl
+          && [[ev charactersIgnoringModifiers] isEqualToString:@"g"])
+        Vquit_flag = Qt;
     }
 
   eassert (nfds <= FD_SETSIZE);
@@ -4863,13 +4865,10 @@ Function modeled after x_draw_glyph_string_box ().
     }
 
   /* emacs -nw doesn't have an NSApp, so we're done.  */
-  if (NSApp == nil)
-    return thread_select (pselect, nfds, readfds, writefds, exceptfds,
-			  timeout, sigmask);
-
-  if (![NSThread isMainThread]
+  if (NSApp == nil
+      || ![NSThread isMainThread]
       || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
-    thread_select (pselect, nfds, readfds, writefds,
+    return thread_select (pselect, nfds, readfds, writefds,
 		   exceptfds, timeout, sigmask);
   else
     {
@@ -4992,14 +4991,6 @@ Function modeled after x_draw_glyph_string_box ().
   return result;
 }
 
-int
-ns_select (int nfds, fd_set *readfds, fd_set *writefds,
-	   fd_set *exceptfds, struct timespec *timeout,
-	   sigset_t *sigmask)
-{
-  return ns_select_1 (nfds, readfds, writefds, exceptfds,
-		      timeout, sigmask, NO);
-}
 
 #ifdef HAVE_PTHREAD
 void
@@ -6790,7 +6781,8 @@ - (Lisp_Object) showFontPanel
 	 && [[fm fontPanel: YES] isVisible]
 #endif
 	 )
-    ns_select_1 (0, NULL, NULL, NULL, &timeout, NULL, YES);
+
+  [NSApp run];
   unblock_input ();
 
   if (font_panel_result)
-- 
2.41.0


--q6gNDNEXHHafaEcm--




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 15:55:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 10:55:50 2025
Received: from localhost ([127.0.0.1]:46228 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNY5-0008LN-Tq
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:55:50 -0500
Received: from dane.soverin.net ([2a10:de80:1:4091:b9e9:221f:0:1]:49237)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTNY2-0008L2-Pr
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:55:47 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YPBBN3HzVz2xkF;
 Thu,  2 Jan 2025 15:55:40 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YPBBM3pDyzC8; 
 Thu,  2 Jan 2025 15:55:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735833340; bh=cPmrdISazpmVckZ00Wp/TAmCziJj+16NxUvRwTS/gZc=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=hD8AXSv1zzMjLxA+LSStF1kPpWcGs+nGdfp9kQIHThsnJ6wyybAbIOXSbbtUGMtdC
 Sw0D+E6nrA4SX1YroMh+c1tgKfMrHAe04ijXecOcwO4WLbHg3toBoD/GT6OB25Gt3s
 LELeQS1tNlPRd5CIv3EICN8jf7NH6dtXUucOxWbyQBZEHgm+9SNwD1RxkQij2XzrlM
 zAVG8FfDYt/F8IBk+cdU4+dP39lHHyKeB8f7LYgULIK1WfhjpPrxWivCr/5wPMGofY
 KxXXZgevCROnTAM99jgr8GhMUeoUNsgTAjok9irhOWlkEYM4lMFLEdgF84sMU9ByVh
 98S921EGhAMnA==
X-CM-Analysis: v=2.4 cv=e8f8Sbp/ c=1 sm=1 tr=0 ts=6776b6fb
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=mDV3o1hIAAAA:8 a=hIj89exaAAAA:8 a=pGLkceISAAAA:8
 a=4nSHAfT06UWI38Xl6nwA:9 a=3ZKOabzyN94A:10 a=wPNLvfGTeEIA:10
 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22
X-CM-Envelope: MS4xfHqaCgfYiGdqMxfTi5M56kmOISzpZpQ4HUL+ld+XMAvkItaVQgwcW1oM1AfXTiBEX3LLO0TpijcI1ygf8x0xiK968z3hWXqIbk2Eg7ieWnGCkVkc5/bG
 rOez+aFllmTi1mDJAYRR4Zy8P9RspC4vFFXJBa4qZ1F/LUlbit+8XqIWOa8RaTzESWJBb0937IWot18q4c0SrTB0eQen7zjcudj/lCleHJNo7JKseMZKgOb4
 uSRImX88LK4JOIVyB6ziO5bQDoCahw58wPRESMwlrF2dIV9hIUfgXXSg7JSDnVyp
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id a078eaa1;
 Thu, 2 Jan 2025 15:55:37 +0000 (UTC)
Date: Thu, 2 Jan 2025 15:55:37 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3a2-RmDhLWYWBoU@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, 75275 <at> debbugs.gnu.org,
 stefankangas@HIDDEN
References: <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN>
 <Z3ZylsXjH2vbX8LB@HIDDEN> <86msg9jkqs.fsf@HIDDEN>
 <m2pll5grbk.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m2pll5grbk.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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: -1.7 (-)

On Thu, Jan 02, 2025 at 04:37:19PM +0100, Gerd Möllmann wrote:
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Date: Thu, 2 Jan 2025 11:03:50 +0000
> >> From: Alan Third <alan@HIDDEN>
> >> Cc: Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
> >> 	75275 <at> debbugs.gnu.org
> >> 
> >> > > I don't know.  Is there anything in the following code that can be
> >> > > relevant to a non-main thread?  Note that non-main threads can
> >> > > legitimately call wait_reading_process_output, which calls ns_select.
> >> > > For example, what happens if a non-main Lisp thread starts a
> >> > > sub-process? we do expect to be able to read the output from that
> >> > > sub-process.
> >> 
> >> My take on how this works was that in a non-main thread ns_select
> >> should just act like pselect, hence it used to literally just call
> >> pselect and return.
> >
> > In general, this is not right: calls to ns_select are expected to call
> > thread_select, in all threads, so that other threads could get a
> > chance on grabbing the global lock while this (non-main) thread waits
> > for sub-process output.
> 
> I think Alan meant thread_select(pselect, ...) because that's what is
> already done in ns_select_1.

Yes, sorry. What Gerd said.

> But... when I look at fd_handler, that function calls pselect directly.
> 
>           result = pselect (nfds, &readfds, wfds, NULL, tmo, NULL);
> 
> 
> Can that be right?

I think that's OK as we've already called thread_select further up.
I've a vague memory of putting this in as a work-around.

We call thread_select with a zero timeout to give other threads a
chance to grab the lock, then carry on as normal, running the run loop
and fd_handler which calls pselect.

To be fair, though, I think when we set this up I didn't understand
the code as well as I do now, so perhaps it was the wrong thing to do.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 15:37:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 10:37:30 2025
Received: from localhost ([127.0.0.1]:46166 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNGM-0007Pp-As
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:37:30 -0500
Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:47110)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTNGJ-0007PZ-UI
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:37:29 -0500
Received: by mail-wm1-x333.google.com with SMTP id
 5b1f17b1804b1-4361fe642ddso121227295e9.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 07:37:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735832241; x=1736437041; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=iDIzvYwm7f1EBax4AeMA5LRbwazi7ylK2+G/IfduHaw=;
 b=WOhr9rnjwUED74ayetfkMkhQMi6XxLUp/Gzi+0hMXOJuix7v12cBjDmc1BriMBg7lj
 0miE8qHniih8zTYvtpSwFa/FgaD6jWbEcbm4ie3dBrjh8299T41aIVjQ6sGZEml8T+Rg
 +Wwz7VDfZPQCUF/f9YL4LLxIrAHoOqfo6R4k9NZxu6xVhHFshOLOYvyhF/MQt+pFugGv
 cxxxQHIqUTaZXlU44YLMus/wA+o4VeFhKbtElTvW159+9Xm5DIt5OxREFfW2wpMfNelG
 AnUAQZq5+8jp9kkKdFJuTF/wfPUy0GpUWmvXGNOP1VVa6V98ZuHyM3tl0ZJdvUo0/ksw
 P26Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735832241; x=1736437041;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=iDIzvYwm7f1EBax4AeMA5LRbwazi7ylK2+G/IfduHaw=;
 b=w6qq5OQawnvyQdraA3idT5mHp753VZvsnqIHgobLMeWFdiFxKLrshEg/r4tuZcvwzK
 /a23cvijpCH4EbKpGU9ta+vL86nfi8TqNLyY17o6VtlzNFL9GZMCfV9VWdrceQIlwv+j
 Qw7B4t9m7kXPfO/XsetckiJUyCEHgHivQjbbUJN30cpafT8sOBeJeH6z07pWzWhtWgOa
 GCGH3OnuYUGYg4jNOW2kUQHuvOAi7fOZqyqCPVD6hdM86lAiA/kR1kqQmEBF3ke+JOee
 G9NRv4PSQhfySK0zAGEixWT43xSc7XnxJT9XKQhL6yr8orRH6tyTABai8Y+pOIuOyIsK
 0pOA==
X-Forwarded-Encrypted: i=1;
 AJvYcCUjTvC3IfzOV4xPF8xISEOsZ4Elof8u0fw+vZqS7vwoBUH11AYdbvK1OrHF+/80POtul5RlXw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyCFFjxZUl34W8AlcPehvtolYGjHS6d0DxfajPie1WfUk6ppYSt
 KIzFPOLUg0YDj0ZdC1YTCUNi5ue9gdKfvpPQ2SQgiynqDQu2oHYZm+43Nw==
X-Gm-Gg: ASbGncuep6PEJFssXhx9YKGtbFdLT/hk32DQV3uc0qPiyxQ0VxjFOJQe9TQumasNl4X
 h4+fiBsHfswLpTpjrRJAE5QujufeVFDOqcfr9kXl/loIX24iPCUizDWUVYbc4Qz6YzKaRwPcgBl
 70QQIxmOalSW7ttvf/YK5lB1A1/cC662lnySx8k5cLyD0i2qnBdO0P4SvwE7xsCaLEO8nn7ss7a
 fVOtCa6vFuW18bJvnzVi1yjhpPI59xiyTctRJrURuZaO+HWJpvvircIGAI6FtBfMvzD+LeC1FKH
 0spiGdX+Kqs+45z5lpDedFPAIUTiD9FeirGN8VBPSMiXrCRLYnf2uWvw7X66bcM2
X-Google-Smtp-Source: AGHT+IHR3oyQx4L0qTm0AneeU7eRBQTDT2iFKI/euZuDI930TXTws0aJP2shsvw/AlwM0Gph7OM6Eg==
X-Received: by 2002:a5d:47ab:0:b0:385:e16d:51c0 with SMTP id
 ffacd0b85a97d-38a221eaca5mr38788495f8f.18.1735832241090; 
 Thu, 02 Jan 2025 07:37:21 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a546e822bsm12866283f8f.22.2025.01.02.07.37.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 07:37:20 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <86msg9jkqs.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 17:31:07 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN> <Z3ZylsXjH2vbX8LB@HIDDEN>
 <86msg9jkqs.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 16:37:19 +0100
Message-ID: <m2pll5grbk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>, stefankangas@HIDDEN
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Thu, 2 Jan 2025 11:03:50 +0000
>> From: Alan Third <alan@HIDDEN>
>> Cc: Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
>> 	75275 <at> debbugs.gnu.org
>> 
>> > > I don't know.  Is there anything in the following code that can be
>> > > relevant to a non-main thread?  Note that non-main threads can
>> > > legitimately call wait_reading_process_output, which calls ns_select.
>> > > For example, what happens if a non-main Lisp thread starts a
>> > > sub-process? we do expect to be able to read the output from that
>> > > sub-process.
>> 
>> My take on how this works was that in a non-main thread ns_select
>> should just act like pselect, hence it used to literally just call
>> pselect and return.
>
> In general, this is not right: calls to ns_select are expected to call
> thread_select, in all threads, so that other threads could get a
> chance on grabbing the global lock while this (non-main) thread waits
> for sub-process output.

I think Alan meant thread_select(pselect, ...) because that's what is
already done in ns_select_1.

But... when I look at fd_handler, that function calls pselect directly.

          result = pselect (nfds, &readfds, wfds, NULL, tmo, NULL);


Can that be right?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75275; Package emacs. Full text available.
Added tag(s) confirmed. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 31.0.50. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 30.0.93. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 15:31:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 10:31:44 2025
Received: from localhost ([127.0.0.1]:46148 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNAl-00077t-Po
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:31:44 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:53984)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTNAj-00077S-IH
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:31:42 -0500
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 1tTNAd-0001Me-4h; Thu, 02 Jan 2025 10:31:35 -0500
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=A7IYCk62vsiXrHAtzEe1MgMlVjMk6a56n6ML/6eDyRM=; b=a0ja27QpPz1x
 Y0DrGi8DZl0YUQIpA4aW8dux1H4yrJ5GA8C/7G5vNtB0gCy7SuVSrlrPT+2NbRv4EmeTksndHkp3R
 OBe4pALfs5C5D5q2WErJexZlw9FpgtKiUpNfrYl47L+8QmVe336YtCPkqy67rNg5fPoJD4QlwTb/z
 aXVXPEQvzBbxhKcCxUcnsI/hQfPsJKkRNAQ8c53bCOtQpUI9p7qyZn16BdYSnxXHyy5Jr3CdWEN7I
 ls0ii8RXzsIAIlFXxgY01Vm3cStGWzi6wmD81W8UdJRwS/IPOGk7TbUXlV4tlQtCLy2SxlCvY7Dzt
 y5uhd9nKG14Vor4fe/jDJw==;
Date: Thu, 02 Jan 2025 17:31:07 +0200
Message-Id: <86msg9jkqs.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alan Third <alan@HIDDEN>
In-Reply-To: <Z3ZylsXjH2vbX8LB@HIDDEN> (message from Alan
 Third on Thu, 2 Jan 2025 11:03:50 +0000)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN> <Z3ZylsXjH2vbX8LB@HIDDEN>
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <at> debbugs.gnu.org, stefankangas@HIDDEN
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: -2.6 (--)

> Date: Thu, 2 Jan 2025 11:03:50 +0000
> From: Alan Third <alan@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
> 	75275 <at> debbugs.gnu.org
> 
> > > I don't know.  Is there anything in the following code that can be
> > > relevant to a non-main thread?  Note that non-main threads can
> > > legitimately call wait_reading_process_output, which calls ns_select.
> > > For example, what happens if a non-main Lisp thread starts a
> > > sub-process? we do expect to be able to read the output from that
> > > sub-process.
> 
> My take on how this works was that in a non-main thread ns_select
> should just act like pselect, hence it used to literally just call
> pselect and return.

In general, this is not right: calls to ns_select are expected to call
thread_select, in all threads, so that other threads could get a
chance on grabbing the global lock while this (non-main) thread waits
for sub-process output.

Maybe this cannot currently work in the NS build, but then it means
any non-main thread will never relinquish the global lock until its
function returns or signals an error.

> FWIW, I still think the NS code in its current form is unsuitable for
> multi-threaded use and must be rewritten.

Then maybe we should stop supporting a with-threads build in NS?




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 15:19:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 10:19:45 2025
Received: from localhost ([127.0.0.1]:46106 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTMzB-0006QZ-22
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:19:45 -0500
Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:57583)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTMz9-0006QG-AY
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:19:43 -0500
Received: by mail-ed1-x52c.google.com with SMTP id
 4fb4d7f45d1cf-5d4e2aa7ea9so20864941a12.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 07:19:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735831177; x=1736435977; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=JD06BLvevrUtGnyeG4CqnNYLr3Vew3wKv1pN89slod4=;
 b=BLsf+4hRW70sv9mKhNID/mKuP5Qr1PvVQ0k5jsQpy3WIrWcBRee6oJJef0DGqoR/79
 oSCkkv+Bh9yM/szalBoIuysUgM90E4zddV1UDTQ0ydmCH6rHgUBhCFk5nyg+9nEopbMm
 ALNj59N0UuQroj6492+kp94ayhBtmWkv/zmvgB1Pr+Kp6TwpBq1eZVwWF3pkNWmhKVZx
 Lv+XRsacxsxC1gVQRigAk0jzsvVApnN1fkFmE6Nmfgwxjp9bdMBWsx0il7uLPkpAwYKi
 D0gSzA/f3X/n1DDhR4lkyckHtGFgOK/OuxiQ927SjDFzxR4/Oqa69UoWVvW5FR3DLymD
 QcFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735831177; x=1736435977;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=JD06BLvevrUtGnyeG4CqnNYLr3Vew3wKv1pN89slod4=;
 b=QcFFJ/yaCTViY3cIc6u3RkC7Lqr0bPTPvzKPmycJqgFzXdVFSbXoqI9O97ZSwsQIUk
 6H3PVylSZZmyORJYUSwyNuEu3J/bT9IfYiKjuFZq7N7CY4MHKHswO7NJ7oor0dbbRJrb
 4pVuxGnBjiFPUGMqRK6ySkld2YSkR5aB0VOy0eh/1YSnDtfUVCI6as7sM8olIKBHkCVp
 3ldw5/O/d9qlQqz7EodnsFSOmBeR6y8WXojkTUVvt/wvba/EExE8uhPA4JvShE3mprk1
 XlMF9ZOf9Zi1PY1dbUF8zA1qijxZk2ROMF9y5vZaLXqwQXd6HNNgraqrUwE4FXCmFYCQ
 fEVQ==
X-Gm-Message-State: AOJu0Yx41M2TMzN98qYYRSszxoNseHUhSP09vs4p2OFX4h4Y09NU+sVF
 6ghcFjP8XRudcmoYJf2cGDph+mREgSwgNEt/ga3RC20+tStXe6xssOOAU/2Q8ROPwvZCsv5wfWE
 YaAtdOiH2Xv1/3h3s2/PSHkgxAnE=
X-Gm-Gg: ASbGncu0xXBiq0BB9Eqo7wWS9gifijXMXYEG/DB5Gti80w+RVVTTICM0UtxA6bJ+sPN
 F8aL7YIiaiscLC8Wkhg2tIV2W93pwjfWMxl7bcOO6
X-Google-Smtp-Source: AGHT+IEIhfDx8bW16NGPJa4pT/GHV+JLpQb637a5WAIoSzWkUqeEO8Xa6bAp5uAiVe91ghDxflCxzAuPMsCl2Lflpd4=
X-Received: by 2002:a05:6402:5109:b0:5d3:e766:6140 with SMTP id
 4fb4d7f45d1cf-5d81de22cb7mr39793011a12.24.1735831176707; Thu, 02 Jan 2025
 07:19:36 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 2 Jan 2025 09:19:36 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <m2ttahgtqb.fsf@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN> <m2ttahgtqb.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 2 Jan 2025 09:19:36 -0600
Message-ID: <CADwFkmk6ekS_BwNdLRJu-JRk8TOkawjatUXEp6e0Gtxnh6AxMQ@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
To: =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>
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: -1.0 (-)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Maybe this one, after what Alan explained. Could you try it?
>
> 1 file changed, 2 insertions(+), 2 deletions(-)
> src/nsterm.m | 4 ++--
>
> modified   src/nsterm.m
> @@ -4875,8 +4875,8 @@ Function modeled after x_draw_glyph_string_box ().
>
>    if (![NSThread isMainThread]
>        || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D=
 0))
> -    thread_select (pselect, nfds, readfds, writefds,
> -		   exceptfds, timeout, sigmask);
> +    return thread_select (pselect, nfds, readfds, writefds,
> +			  exceptfds, timeout, sigmask);
>    else
>      {
>        struct timespec t =3D {0, 0};

That patch fixes it for me, indeed.  Thanks!

Eli, since this is a regression, do you agree that this should go to
emacs-30?




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 14:45:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 09:45:21 2025
Received: from localhost ([127.0.0.1]:43363 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTMRs-00048E-W7
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:45:21 -0500
Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:44207)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTMRr-000485-8W
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:45:19 -0500
Received: by mail-wm1-x335.google.com with SMTP id
 5b1f17b1804b1-436345cc17bso83191035e9.0
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 06:45:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735829118; x=1736433918; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Sra4zY2wDwO62QsFn7TSeb8hTIxQZUw/6QO6uOv0GoE=;
 b=grqYeno9xql1DSHfIL1njzdVHQuJeEmrIlixic8mQf0RnJ8gAxjsxZdQMnZeXk2TAA
 Br+3X5gatDV59k3xAtgai5lbLrjDjB+uv6j7bfbg97n9feSIO7CMWoMPgjmT1ZZp3kCr
 LzDQ5mLp77I60KjGSJoBTaXyK3o6RPearBW+MyLEt2ZEHrVfJITQSKz5isrx3n5rCUuW
 v6pBt+/3iDW21Fpg3AnDfCqNWsiPGU0XEhcqHZTusjn1RMdGem6DNJS3B1v1Q21pClwO
 katGOd6V9d/aIEuqZ/Cdlankj9WGpHHkKsThi1v09HvB2zFM09sckaa694PJ+oHyu1sx
 Z9aw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735829118; x=1736433918;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=Sra4zY2wDwO62QsFn7TSeb8hTIxQZUw/6QO6uOv0GoE=;
 b=WygxJtJTMOZmrF0P3oii6UZ7XtMldghISGXrgZcvuxdJjsmjHyKAZW8NVfouqN2kOG
 JqplWew52rJjYpbOC65B0WoA8F/d8zfd78LEGQdwvdVnqEX2Uz5RXiZ3ITs5zt4taMKc
 ps4/dyRPY1lXjQIKlntDBCaAlJM8hdJdUZiXp21cyqQEGtTp4ZJXRLKrIwTyHUA8mztd
 V5Y/lteS2t47qnf0ne5LvNdTDY6JojhCIERlE+DnAgQgtpbuJRoU5q/jSKYo7+pu3ZMR
 wQTaw22RBNJRu5xRimX/UMT1P5sGqPK2X0ruZNqLC3LzkkpKNPYB1lxBAWEbT+0/CITX
 Fjww==
X-Gm-Message-State: AOJu0Yw7PEXqjPUEUwf1GgiK28yVelYhZT9myTryJJppKfUfD91sn19T
 nrklraMFmyqXjoUgtoy/LdynxWcDrHQd71tA9HRQgkxVNoNpMZIj/oGj9A==
X-Gm-Gg: ASbGncshaY2gYyJUgL0VwueQ8jqS4vUl5A47oFDCIGu7Fkebl7s8UPgcg8EG12BlWGI
 7qrVEJI82xxmXoCfmp2zYZKUU2L8aUcsJHRAHi/cPmDBrEv2C5xYzGuXsESc/4UE9ikk/mrbJP5
 WmlhVqiePmXiFd6obMkT+/2h04c9nca1AQpWuZ7bUWUzSTqIqZRppfZBURf04RKjYYtP0nfzsSE
 H+Obssw7e00OE0EBxUZ5wgS8B1Pd7DjJxK0YczqSm4rYSn3iwGqHZcZc1GtHuN9wU5MG1bPaszd
 GwPq9HW7a0MEa/Qs/YteEs2lVhyj2JrjuTuWru5hy9nxzxQi4n4fFRF7qg/VUCwR
X-Google-Smtp-Source: AGHT+IE+fw7BdrdPQUH/gr2aIsZkSspjQ9HB0SVID/tJ3f+RhySdIa/uHSfl9fdMUHAkPHHNe0XdBA==
X-Received: by 2002:a05:600c:19c6:b0:434:f2bf:1708 with SMTP id
 5b1f17b1804b1-4366854740fmr332456815e9.7.1735829117615; 
 Thu, 02 Jan 2025 06:45:17 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43656b417afsm493574275e9.36.2025.01.02.06.45.16
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 06:45:17 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <m2y0ztgu0z.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
 =?utf-8?Q?s?= message of "Thu, 02 Jan 2025 15:38:52 +0100")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 <m2y0ztgu0z.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 15:45:16 +0100
Message-ID: <m2ttahgtqb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>
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: -1.0 (-)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Stefan Kangas <stefankangas@HIDDEN> writes:
>
>> Thanks, I didn't have time to look into the above yet, but I noticed
>> that the bug wasn't there on emacs-29 and bisected the issue:
>>
>> 4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68 is the first bad commit
>> commit 4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68
>> Author: Gerd M=C3=B6llmann <gerd@HIDDEN>
>> Date:   Sat Mar 9 15:06:29 2024 +0100
>>
>>     Prevent freezes on macOS (bug#69561)
>
> Thanks, there he is, the culprit :-).
>
> I don't know what to do now.

Maybe this one, after what Alan explained. Could you try it?

1 file changed, 2 insertions(+), 2 deletions(-)
src/nsterm.m | 4 ++--

modified   src/nsterm.m
@@ -4875,8 +4875,8 @@ Function modeled after x_draw_glyph_string_box ().
=20
   if (![NSThread isMainThread]
       || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D 0=
))
-    thread_select (pselect, nfds, readfds, writefds,
-		   exceptfds, timeout, sigmask);
+    return thread_select (pselect, nfds, readfds, writefds,
+			  exceptfds, timeout, sigmask);
   else
     {
       struct timespec t =3D {0, 0};





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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 14:38:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 09:38:57 2025
Received: from localhost ([127.0.0.1]:43345 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTMLg-0003kL-GU
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:38:56 -0500
Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:60435)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTMLf-0003kB-0l
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:38:55 -0500
Received: by mail-wr1-x435.google.com with SMTP id
 ffacd0b85a97d-385deda28b3so7927966f8f.0
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 06:38:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735828734; x=1736433534; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ixExP8KMcb0o8fw4hxQT3bnaCkp+/0q9aUfpK0zKRAQ=;
 b=VrnJdQQjC/drt2MHKQAIeznKPIXl8vR280Ymw3Eat7/C0540Rau8Dlw0unkMp93Sbf
 RnthWso5/XPomec+b5CF4MULM2tEAat7s+LiJzirrI1ppWUVL6Gk/TTQBg8QhGRQ4xLL
 N7OTiN9CVyha/mGNqXdUCRyqQKSugdXHHCnxjVWRmP4DvvpiA+rseVJjco0wn7REol6v
 WGAIcdLx/tiE42thQQvl2Z7v1JV+rWoqcxSmaHYK+ms4eeagtONRSuqnq/Yj1+sKgHTX
 2NsqvgUPcBocTXGy+qj+MF44al85+1M7TM4iu+9lrhFTlkYQ6E8cIybUk0omxUpYD/9/
 aJmw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735828734; x=1736433534;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=ixExP8KMcb0o8fw4hxQT3bnaCkp+/0q9aUfpK0zKRAQ=;
 b=Hc6MKuXZwCnAMqWpwNbdhqB8KHyvcg6asr02VdchwUeiPBdz2AMZ2xuqq666+bEb9h
 Su55+fXPQG828Ugn4ApuKe7aZ4k0DUXEQdwTU0CE25o73BQvqdwVwFCg7sR8CDe0vmfT
 iVAoxv+lwctAZYveztmbiRYp0XS3TFECvbmC4DS8p8iwyapnM1dQlzsge+pc69XdozoP
 PGpBC7l/brjKABHd6+iLDqHSAiNir//mweLuU/bzkBHMyhzxoZXIkwwFXpaWvgQCuAZ0
 zvF+NU4ztgm7Twy/KtgKrCX2CIvfsvzxnEcRl6HARIwqs+HagoH9OMaAVtocDB5/PI39
 Ga/Q==
X-Gm-Message-State: AOJu0YzVj8k9JveqoWQieA1IO4PujyDuujgM1NRGq6lkrFEc8wSgH6S8
 Xe4PpDUVxrscGKGI9O8gKTMWRwbKIFzth+n4WPB5CahhAKOmG2M8
X-Gm-Gg: ASbGncsO8B0mmXnthk4da6gbdJuJUdrbEolzeCDCQu/sa75gE66MpD6QS2Kkx7k/Kek
 lok9qtL9o1obx3JKtYNZ19ChXLYPd0gygJNf65NiRh9eqZFa/DWfVeLJql7orjInwxOkchqX7uv
 AjwIjjPaMN3IYDLJn2RWTpk8Xayd9HNebuaEWSB/zy/z+2qahY7PoRa6MTOJ1WKQgA3CmOyRW3v
 KStNKN+4VV0+0lurP0Pxtq34MN+PHsnF2LSVzQFQ42eqMbM6FhJ2t3DI6s9h72XPt7qxdqQKuAj
 zp4hld9ALweDymzrAtmObXj9C9I8WuoxbRu+X+ZXnAoXQfBNIJ8unkwKLlI22ShE
X-Google-Smtp-Source: AGHT+IGxdIHF2kE4czKPvq7g1Yn/FhGfLNH1MXLbh2lU9u/bbRkrxrq3goRqT+NHK++o6JxWxHSIiw==
X-Received: by 2002:a5d:6d0a:0:b0:382:3754:38fa with SMTP id
 ffacd0b85a97d-38a223fd105mr39011372f8f.51.1735828733626; 
 Thu, 02 Jan 2025 06:38:53 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38a1c829235sm37669540f8f.15.2025.01.02.06.38.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 06:38:53 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
 (Stefan Kangas's message of "Thu, 2 Jan 2025 08:35:14 -0600")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
 <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
Date: Thu, 02 Jan 2025 15:38:52 +0100
Message-ID: <m2y0ztgu0z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>
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: -1.0 (-)

Stefan Kangas <stefankangas@HIDDEN> writes:

> Thanks, I didn't have time to look into the above yet, but I noticed
> that the bug wasn't there on emacs-29 and bisected the issue:
>
> 4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68 is the first bad commit
> commit 4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68
> Author: Gerd M=C3=B6llmann <gerd@HIDDEN>
> Date:   Sat Mar 9 15:06:29 2024 +0100
>
>     Prevent freezes on macOS (bug#69561)

Thanks, there he is, the culprit :-).

I don't know what to do now.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 14:35:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 09:35:19 2025
Received: from localhost ([127.0.0.1]:43337 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTMIA-0003de-KE
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:35:19 -0500
Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:60600)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTMI8-0003an-0O
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:35:16 -0500
Received: by mail-ed1-x536.google.com with SMTP id
 4fb4d7f45d1cf-5d3ecae02beso13952984a12.0
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 06:35:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735828515; x=1736433315; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nps4cLXleBOR7KPeSZi3NjnF4xg3hwZOjFDH8rqj4eQ=;
 b=SV3TgsHojRhEXCY80LM1rm/sHMQp4Gfei0N+F3FSp40uxHmebemt4jSnL/DfFEVtTf
 eWyCqcYtFxoo+pLLcF0tw0mRFyevXeYOrpdUak/6TkioAEsUZRRHUIf+pWcZmkSfM41R
 oU9hd4hzwANvm5kZB6Vefyi17uNEGO+RG3E7O+S8dsKkkkNZ14VrjdltYDH/cUupCZPl
 sjpSJQfqGZeOvSJVjAMnvq3cXh8KE9TPip9W4mKYVaFR0QZGqJqc5fA6C09FKRZXhRLS
 Hn1QnKvNcG9jz1r7+feSfGeKny3r0cIe4LDftWBKWzupbkiRsNjgrm+V/AMlOJOn+cUJ
 XC0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735828515; x=1736433315;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=nps4cLXleBOR7KPeSZi3NjnF4xg3hwZOjFDH8rqj4eQ=;
 b=UFyX1g5lhYyI5JaQNd9v/evxEWF5UvwcVwZqVNSKRcwwa7mjxGXsaV2oclzD13VTNt
 kA+537CXu7ppn+1bSRT9DVcs8S2JV2acf2t4TBc47dDZ49t+i0RpUqiruyajXS7qKCp4
 L5kpOGGPnGsrrJlr80nO3gardNsXHMJJV223oHMhnk9c8+5/FUUeIJ2evAyKcfXu077U
 tUgzNr6Q5lA+Lss7z44iBuaY1HImi0MYSU4sz+pWgJcN/SHu+XXmhP78Ci26xn0toduW
 q1yV6Qp1F1YjK/LA1jtN6apV8HiS1iWmgbFMUghfQEzPQVxOkwYNphHbv8B4cGqCmY72
 54xw==
X-Gm-Message-State: AOJu0YxzhlSStGSWA+pTVmOVL6zDmTdG3KyYlxg1PfJI0WdTwDqmMOl+
 qZwburw4/XXs78K48F7hiQzoEsWJi4ubx8zT00HTrafI+fXW+yRy35qtmuIdYWVnL+rpnygd2cq
 TQU1zgcp9yQFkBmvB0Ovz+S8dF/I=
X-Gm-Gg: ASbGncv0pMEXFwHYudboK9b0Oty/4ItepU3nBxPcA6casnnVNUpCd0QDrE5PJwFVOus
 wpt556DLHRikvXq5HMO3zFedX4O84oYiAc9Er4+yv
X-Google-Smtp-Source: AGHT+IEUZlisvVxa7S8nLLht9Ns5qgju1l2i5t4Yj6WhiuGhB7E7zI8tDbkDBSX4eZTqMGCr2JOzQH1DWmMqcIB/LyA=
X-Received: by 2002:a05:6402:270d:b0:5d6:66cf:2a3a with SMTP id
 4fb4d7f45d1cf-5d81dda7e79mr41706927a12.17.1735828514474; Thu, 02 Jan 2025
 06:35:14 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 2 Jan 2025 08:35:14 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <m2a5c9k7um.fsf@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <m2a5c9k7um.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 2 Jan 2025 08:35:14 -0600
Message-ID: <CADwFkmnkob8xZk2kpwnDBq-=RVBso15MTgiJ_Zsfy7B0+L3w-A@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
To: =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>
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: -1.0 (-)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> I have something in my notes which might or might not help:
>
>   * Breakpoint for errors displayed by macOS on stderr
>
>   Set a breakpoint on CGPostError to find sources of errors.
>
>   #+begin_src sh
>   To find out from where macOS prints stuff to stderr, like
>   023-07-20 13:41:17.073449+0200 emacs[53072:1205906] [default]
>       CGSWindowShmemCreateWithPort failed on port 0
>   b _os_log_error_impl
>   b _os_log_impl
>   b _os_log_debug_impl
>   b _os_log_fault_impl
>   #+end_src
>
> If on of these breakpoints is hit when the error is displayed, we could
> perhaps see why ns_select_1 calls EmacsApp.run. In my understanding, it
> shouldn't because Cocoa event handling should only be done in the main
> thread.
>
> If the breakpoints are not hit, we could instrument ns_select_1 to call
> an empty function do_break on which we could set a breakpoint.
>
>   if (![NSThread isMainThread])
>     do_break ();
>   [NSApp run];
>
> Or something like that. The question would be what in the code above the
> [NSApp run] is wrong so that we land here. Probably some if condition.
>
> CC to Alan Third.

Thanks, I didn't have time to look into the above yet, but I noticed
that the bug wasn't there on emacs-29 and bisected the issue:

4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68 is the first bad commit
commit 4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68
Author: Gerd M=C3=B6llmann <gerd@HIDDEN>
Date:   Sat Mar 9 15:06:29 2024 +0100

    Prevent freezes on macOS (bug#69561)

    * src/nsterm.m (ns_select_1): Store pending input_events. Always call
    [NSApp run].

 src/nsterm.m | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 14:17:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 09:17:10 2025
Received: from localhost ([127.0.0.1]:43280 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTM0c-0002V2-3X
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:17:10 -0500
Received: from dane.soverin.net ([2a10:de80:1:4091:b9e9:2218:0:1]:40509)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTM0a-0002Uh-QD
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:17:09 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YP80Y5MBWzyfJ;
 Thu,  2 Jan 2025 14:17:01 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YP80Y1plczF1; 
 Thu,  2 Jan 2025 14:17:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735827421; bh=8uK53Bz3Q8B0L0zslDazL1BBW+0+OKPtDOH1SWyi3dM=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=HpMbdeWjY/lW5hnWUrHtsnf/yFwVcahonfBCwuDQO2lpdjSZKCcF/WciVVkd1O/nO
 y7+uNyUQvNIgY0iZKhTZkUfNu88E0fEAGxJQqHKdNqqbrFhoSdK7yKqSi4p85UDU9c
 cjGMlsu8uJAevB2Sc+wFihzhBMb+1T81dE7OlDm40z/s0NG6q6J6VjFTiiDqEIkAZP
 br4leQ9q2xLfXqMA0i/WRWYerTy748qgexSo99twVtqaTG2exfLmRZICQSAUNrnkOq
 zgYfLshIfMtbZ/gjKACEb8kncJKAxWvluwamEZUWdrhO7Y/NXud8zFzX4gRF0J/vx/
 fcC3ACP01ZB7A==
X-CM-Analysis: v=2.4 cv=WMmFXmsR c=1 sm=1 tr=0 ts=67769fdd
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=gGsWDzhJd7dwKvQW5dgA:9 a=3ZKOabzyN94A:10
 a=wPNLvfGTeEIA:10 a=9MSFP0l5Dcwi9NrB_JPx:22
X-CM-Envelope: MS4xfEOmvYc8sSszAOKmyPPJZLZjQiyP/k2ffWTPoJ7TBNf27Oinh5fS9wcwI5rhoSlyMUSqbcjGj6araUNjPToR8ZjYEsW6COHD1zMX+516N63llvND+hS8
 aeP5+D/OvyzhkCnufF/x+YpU/PT07tSLGMEXTUEG/vwgl7L6ZYXBdTGn6KutLhfX72z7zDnJG9FhyK2ppph2TyJCaGvTBl8VITG7cj9Qw5BLO/qisKR3c7Ou
 feOZb55ZN83qpQb2YRvb90gzMGIPIVof9dAflKN7Kg1RTvT5Pf+6uss6FVbjUd5ldd1fSXRyjx43U+yTJWWov2s+7EaR3H0fGjYvxjU/Z+E=
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id b6d58467;
 Thu, 2 Jan 2025 14:17:00 +0000 (UTC)
Date: Thu, 2 Jan 2025 14:17:00 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3af3CEfK21nYgZd@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
 75275 <at> debbugs.gnu.org, Po Lu <luangruo@HIDDEN>
References: <m234i1k6zy.fsf@HIDDEN> <865xmxlivo.fsf@HIDDEN>
 <m2y0ztipi2.fsf@HIDDEN> <m2ttahip4t.fsf@HIDDEN>
 <86y0ztk323.fsf@HIDDEN> <m2ldvtilb8.fsf@HIDDEN>
 <Z3ZylsXjH2vbX8LB@HIDDEN>
 <m2bjwpicwn.fsf@HIDDEN>
 <Z3aadivS90hcvXCM@HIDDEN>
 <m234i1ia7p.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m234i1ia7p.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: Po Lu <luangruo@HIDDEN>, 75275 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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: -1.0 (-)

On Thu, Jan 02, 2025 at 03:03:54PM +0100, Gerd Möllmann wrote:
> >> One strange thing about threads having their own event queue is that the
> >> message Stefan sees comes from the NSApplicaiton::run in ns_select_1. Be
> >> that at it may.
> >
> > Indeed, ns_select_1 is being run in a sub-thread and it therefore runs
> > a thread-specific run queue which has no events in it. It requires an
> > event to be sent to it so it will stop but none ever is because we
> > only ever send events to the main thread's event queue.
> 
> What I meant was the the NSApplication::run in ns_select_1 in Stefan's
> case seems to call something complaining about being called in the wrong
> thread. I guess it would also complain if there were an event in the
> queue. I don't know.

Oh yeah, that's a good point. The queue in NSApp will be the main
queue rather than the thread's queue.

> This whole code gets on my nerves :-).

Tell me about it.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 14:03:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 09:03:59 2025
Received: from localhost ([127.0.0.1]:43253 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTLnq-0001pL-Ix
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:03:58 -0500
Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:47382)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTLnp-0001pB-8H
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 09:03:57 -0500
Received: by mail-wm1-x32d.google.com with SMTP id
 5b1f17b1804b1-4364a37a1d7so120281585e9.3
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 06:03:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735826636; x=1736431436; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=d1psWu4N2skRWGLTXhrR8X+KltzZz5l7LOqrLV+U8iQ=;
 b=NwDK42I5alwm1OtiQGI2dfQy9i2mhW4yCstpD1gFW/rph7BsiyV3ZZG298BRwHuc0K
 ku/S04Lo78b1SgEWVJVG5LHWqW0v6iYuBsXWpW4OQ5rh8UiQ2Qk1HS/Swp+t08xGs9TK
 QYx7gGKj3gqQeXmO2hkin6d9bYAG2n0bcAqNM2dXqr4JX3znsorl/JK47hD75vUO+aUT
 XSdP16/3GM7GNYq8ck2/T+N6lijKd3BDegEFAP35/ZhUmApewkOzlNGA2A7cbSf1DtdY
 OMmpjdODOQrPUjQRrUmjA0ZDuUSP4hw046dK7/ugdms8cAZZ6MtBL9LrIW42IDikKa5b
 DacA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735826636; x=1736431436;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=d1psWu4N2skRWGLTXhrR8X+KltzZz5l7LOqrLV+U8iQ=;
 b=SmdQ1raOFoNcrC2l8TM4mC2zFHoHbKtVg1j79X9Ev33E9PWBwUxdWYEsyE67KGQ5Z8
 5o6qGOx/mcdg1HpUCByDP3DRjVsLvvW4idBXsxralGyJnzmmGsoFmzmFGZ38KK38cmMD
 lWh/gjFjE9QvGryQJO6VaN+fVpuImB15GX1XUzrLLJViMeuCwS7nJGcPWH52gRhc4jza
 O0Zgr9JegnydvZGRZQcZTZvwspBtrPG/ghP0JMytWbrZl7yMLkMVTYwSzu/d7lo7pGvN
 ffVzhxRSwdvPOO8yl8GGRx4Em77hD+ahlodRWkXSLt2XV0VbvEB5EX5+JAkaje46sD8K
 n0Jw==
X-Forwarded-Encrypted: i=1;
 AJvYcCW8PVeN+K1bD0d29fMr3SZRIHicmcBo4qycFoMLHRQ7q8oq+1rTOO1SrepMPgIqMcoVuuyxFA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxFYQU+wAS4GWR0JK7mTfrhrm25oxXYg3W7LJpTQLXaQWRFCdZG
 +AMhSb7MNDsDOwYkuQIccDPF/lFXCsp4OyKINSrahZAdH4mrPzLz
X-Gm-Gg: ASbGncsCnPm/bVCsLvHpyPHTQo96nnyz3PLLcfxTDPsvTLbRb5y2FP0oABeCq9z4NLi
 M0fkIbC0NaHOzsex2yUh8pt4r8krjlSjks9DpP9Tw09WHBlGxobEupBtPN7kq58Hqx4WPzSFQPC
 /NAtT65hrHgBjbwd7+aBgmMXgc9ApgUgQZ5SjnCxoshEshSflArsGw4k2wNo9GjMQCo62npNn0o
 1ZZ/5AsrF8fXT1F/QpjVB8wjmro6CwdB5QttGywI/8yU9lC+IZXszn3Awe4tlAADtobBHJhBCn0
 FkVgtigqPYQZSgzOxZOSBa5lqAn/4QuqlOnuYkbYwUBBjKAKNo7V5zUhRCdsxgVv
X-Google-Smtp-Source: AGHT+IHAdgLPpwTpNLn6Ti4Embfdoi0QBEjrnIbWBX96Cre/WdEeyCI0RNXcVuJYWKhrCGplKvFF9g==
X-Received: by 2002:a05:600c:3b9d:b0:434:f739:7ce2 with SMTP id
 5b1f17b1804b1-436686436ecmr366947875e9.8.1735826635828; 
 Thu, 02 Jan 2025 06:03:55 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-436612899f0sm453727745e9.38.2025.01.02.06.03.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 06:03:55 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3aadivS90hcvXCM@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 13:53:58 +0000")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN> <Z3ZylsXjH2vbX8LB@HIDDEN>
 <m2bjwpicwn.fsf@HIDDEN> <Z3aadivS90hcvXCM@HIDDEN>
Date: Thu, 02 Jan 2025 15:03:54 +0100
Message-ID: <m234i1ia7p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: Po Lu <luangruo@HIDDEN>, 75275 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

> On Thu, Jan 02, 2025 at 02:05:44PM +0100, Gerd M=C3=B6llmann wrote:
>> Alan Third <alan@HIDDEN> writes:
>>=20
>> > No, none of that needs to run when we're not in the main thread.
>> > fd_handler run pselect in a separate thread because the NS main thread
>> > has to run the ns main thread run loop to handle incoming IO from the
>> > window system.
>> >
>> > The NS run loop can emulate parts of pselect, but not the whole thing,
>> > so we are required to run both the NS runloop and pselect
>> > simultaneously, hence fd_handler. If we don't need to run the runloop,
>> > i.e. we're in a non-main thread, then we can just run pselect directly
>> > and ignore fd_handler.
>>=20
>> So IIUC, you'd write this in ns_select_1
>>=20
>>   if (![NSThread isMainThread]
>>       || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D=
 0))
>>     thread_select (pselect, nfds, readfds, writefds,
>> 		   exceptfds, timeout, sigmask);
>>=20
>> as return "return thread_select(...)"?
>
> I don't know. The code that in Emacs 29 looked like:
>
>   if (NSApp =3D=3D nil
>       || ![NSThread isMainThread]
>       || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D =
0))
>     return thread_select (pselect, nfds, readfds, writefds,
> 			  exceptfds, timeout, sigmask);
>   else
>     {
>       struct timespec t =3D {0, 0};
>       thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
>     }
>
> Now looks like:
>
>   /* emacs -nw doesn't have an NSApp, so we're done.  */
>   if (NSApp =3D=3D nil)
>     return thread_select (pselect, nfds, readfds, writefds, exceptfds,
> 			  timeout, sigmask);
>
>   if (![NSThread isMainThread]
>       || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D =
0))
>     thread_select (pselect, nfds, readfds, writefds,
> 		   exceptfds, timeout, sigmask);
>   else
>     {
>       struct timespec t =3D {0, 0};
>       thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
>     }
>
> and I don't know why. The change (9370a4763aa) has no bug report
> listed and I'm pretty sure I wasn't asked about it, so I have to
> assume Po Lu had some reason for the main thread and timeout checks to
> result in falling-through to the rest of the function.

OK, let's see if Po Lu remembers.

>> One strange thing about threads having their own event queue is that the
>> message Stefan sees comes from the NSApplicaiton::run in ns_select_1. Be
>> that at it may.
>
> Indeed, ns_select_1 is being run in a sub-thread and it therefore runs
> a thread-specific run queue which has no events in it. It requires an
> event to be sent to it so it will stop but none ever is because we
> only ever send events to the main thread's event queue.

What I meant was the the NSApplication::run in ns_select_1 in Stefan's
case seems to call something complaining about being called in the wrong
thread. I guess it would also complain if there were an event in the
queue. I don't know. This whole code gets on my nerves :-).




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 13:54:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 08:54:16 2025
Received: from localhost ([127.0.0.1]:43208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTLeR-0001GZ-Dz
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 08:54:16 -0500
Received: from dane.soverin.net ([185.233.34.149]:35483)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTLeJ-0001Fg-OI
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 08:54:13 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YP7V01gLfzySk;
 Thu,  2 Jan 2025 13:54:00 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net
 (Postfix) with ESMTPSA id 4YP7Tz2gGzzL7; 
 Thu,  2 Jan 2025 13:53:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735826040; bh=2orCO/vaM4OVEmJtSrnb1LAWYBuO8ab1zmlVFc7cD3E=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=Zj3lyAfS15QhzTMl87HoyxhWeUHRvH8IfsNfCOSNdsDAK35fE15RNjEtEXwUjela0
 PPvWPmhprkI/U83L4KLAuVfyuQ4yU9dQuUDbbk0qZINv6fmC3otuGqNtE9E3daMBus
 5BLnTA8z+8gI2QUTT19VCK2vuKHv58tfHmUVrHRSMSPI3ROqQ8jH2IH3ggKvwmq5w6
 scVslp57rduds1Av9bR1k7Hj/G5xsuEga6UXpIyOP4BvRYrb5aAjbCf9ZIFwbeY82C
 UvH+fJdHSFXd5O8xLOBxYI24jnMDuhil29v9j4almZN04LEBrqfrVkaHKCDnBhsIva
 WhgrDN0Tg3Qkw==
X-CM-Envelope: MS4xfC8IpSF9oVblggsLRiAY/l5kFZnYtqm2e2M52/SUJvMAPGHSvVT3PHnu5Q1xfRD3s2bXUSKKftuB+/kqLFZwe2BElL/umYInTbGk6/cMQs7PFTr1I1Qg
 lePXfyiSMg8TWKgSASFR3ccKAD7Qa/so7uhe2LCSNPVxunLnYiEhgZ58TXk4HG5yUqV68HDWj5BVSeHSUFIwEDqGvos52xOSvC/ej+RbbqveSrQi1zs0WvEi
 VSlZ85m4G+Xh2nnz58edSsIZ0ygEpBD4RbwbYKmHBdfUvDFuE1K2qH6glBGsm9uLf2wg4CzgJ7q4COKBJqffP2wXpH5wfMXa1wb0Ia3kYYs=
X-CM-Analysis: v=2.4 cv=UsCZN/wB c=1 sm=1 tr=0 ts=67769a77
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=hIj89exaAAAA:8 a=-rFPl6gYrVxbYPGSLJkA:9 a=3ZKOabzyN94A:10
 a=wPNLvfGTeEIA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id b6ec9783;
 Thu, 2 Jan 2025 13:53:58 +0000 (UTC)
Date: Thu, 2 Jan 2025 13:53:58 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3aadivS90hcvXCM@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
 75275 <at> debbugs.gnu.org, Po Lu <luangruo@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN>
 <Z3ZylsXjH2vbX8LB@HIDDEN>
 <m2bjwpicwn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m2bjwpicwn.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: Po Lu <luangruo@HIDDEN>, 75275 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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: -1.0 (-)

On Thu, Jan 02, 2025 at 02:05:44PM +0100, Gerd Möllmann wrote:
> Alan Third <alan@HIDDEN> writes:
> 
> > No, none of that needs to run when we're not in the main thread.
> > fd_handler run pselect in a separate thread because the NS main thread
> > has to run the ns main thread run loop to handle incoming IO from the
> > window system.
> >
> > The NS run loop can emulate parts of pselect, but not the whole thing,
> > so we are required to run both the NS runloop and pselect
> > simultaneously, hence fd_handler. If we don't need to run the runloop,
> > i.e. we're in a non-main thread, then we can just run pselect directly
> > and ignore fd_handler.
> 
> So IIUC, you'd write this in ns_select_1
> 
>   if (![NSThread isMainThread]
>       || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
>     thread_select (pselect, nfds, readfds, writefds,
> 		   exceptfds, timeout, sigmask);
> 
> as return "return thread_select(...)"?

I don't know. The code that in Emacs 29 looked like:

  if (NSApp == nil
      || ![NSThread isMainThread]
      || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
    return thread_select (pselect, nfds, readfds, writefds,
			  exceptfds, timeout, sigmask);
  else
    {
      struct timespec t = {0, 0};
      thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
    }

Now looks like:

  /* emacs -nw doesn't have an NSApp, so we're done.  */
  if (NSApp == nil)
    return thread_select (pselect, nfds, readfds, writefds, exceptfds,
			  timeout, sigmask);

  if (![NSThread isMainThread]
      || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
    thread_select (pselect, nfds, readfds, writefds,
		   exceptfds, timeout, sigmask);
  else
    {
      struct timespec t = {0, 0};
      thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
    }

and I don't know why. The change (9370a4763aa) has no bug report
listed and I'm pretty sure I wasn't asked about it, so I have to
assume Po Lu had some reason for the main thread and timeout checks to
result in falling-through to the rest of the function.

> One strange thing about threads having their own event queue is that the
> message Stefan sees comes from the NSApplicaiton::run in ns_select_1. Be
> that at it may.

Indeed, ns_select_1 is being run in a sub-thread and it therefore runs
a thread-specific run queue which has no events in it. It requires an
event to be sent to it so it will stop but none ever is because we
only ever send events to the main thread's event queue.

-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 13:05:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 08:05:55 2025
Received: from localhost ([127.0.0.1]:43082 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTKtf-0007TI-6d
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 08:05:55 -0500
Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51303)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTKtc-0007T3-TZ
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 08:05:53 -0500
Received: by mail-wm1-x335.google.com with SMTP id
 5b1f17b1804b1-43621d27adeso78467935e9.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 05:05:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735823146; x=1736427946; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=jrVq33zu4kRTuao5Z9YtFrbO4o7AbSAStuN39v5D5f4=;
 b=Z2YhvoJ3Xj++dpWvmOJ5N3ftwEMKY6ZWvq0khKZ1AEWKDupUSyTEqjmITJpq4u4z09
 mN/yrwCvVCmgjmiFtGsVBiqtrzK+VjVOV8pXaSIqTcodsGLSBsY4kgEGyq604Ss/+Yrf
 wVYqPN6w40H20Ee5JF3f+RCuY0ceDxGonJh4ov1qOPid7jvmRpfaxT+8PVvpXnj5M9EI
 H9dvMBfUdq+v5NOXczhDdkGr6cfX5vtnlx9PEjJOgULHkyfqJk7ppE6S0Yj/IXokkhCg
 io6NTvxD5TVOXyVfQTnsNkvpER3oZ4aa6PtHT+PEKkyYD0o+h/9tCSBG7rFZPcD5MR5r
 /u6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735823146; x=1736427946;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=jrVq33zu4kRTuao5Z9YtFrbO4o7AbSAStuN39v5D5f4=;
 b=Gp+jGBwNiykjGv1XmOXHOgelBm2rAllJZ7iNdIzYwNS5iG70xh0PaIxiz7FvqQqz16
 VM9BHOd8AAXlTKCWeiQ3isdcgnZYRzns5iMk+m1UwI2mcU0LlNq8mvcVZmdxtTWcMm8b
 b1rX7GlGGwSBK0BGMXhsxCcY0JyDNFgBNGg6vCF5116VCNkWWomp1sJMWPOF6mQPH0Fd
 WKU5XjIwA7onqRs1bpcKSHo0qbbWAs6aB0YJK7q+WgdHnTo0RAN89yVVboCYLzMVNTCP
 NCYkDfs+uFEgACW3s0k3WpW+7AwDEGJrixvCLQnuROHnv56qkPW2gF7n/y/Yj2jt6C6f
 +H7Q==
X-Forwarded-Encrypted: i=1;
 AJvYcCXbEWz+XYG5cvr3uWjLcDATcJLLb1PhWyJ0CJrtBNcaBIMKWRiSVlaoB0mwgmrjcty5KHI5cQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YydwuoBihysm/1JHbo36aSsvHuc9pFagHhemUdmD4t4GVgCIHPC
 3dtJ9VUKX5Q1eNSLOoYBlA/sPQm3jZxmFsAKJAAy93Plo94IWqq9Fhy7Ag==
X-Gm-Gg: ASbGncv4nbTNaZzz/W1erAksZE4+mXZCtnMHFiZtGbTNGM2A3HViNHe7b4gzK7hJ14i
 vjUaCrz7z8QfeRaWWjTAIUwwcSESmspq8GgS8kapOeF25nUTzXPihFLXQxq8MiWTdH0upLV7Pnv
 5jYUovnjZCW5gpSREzpO93ru21+C5HcGyds3ram3J4kaumR8/vr0toxsjVX/oHyyWUBcIj2zwnu
 UZ306R5SxshJXkuSJhVtjacJoxGh5ovgll5zfDZBSOJNlVQCLEFa+TlSD7psKmHFZ+lW5hMq4zW
 z85/ZfjASGszftQiiV2gMktcsqG5VYh7hUHBUtrxVJQNm25O/Z7Ux6cY5918iF6J
X-Google-Smtp-Source: AGHT+IE7ULK2M/Cvf1Df415SIJuM/3fUibKy1hdSaHwODE7z2jw6VMxnY4fBNvxc4pPV46vDFEaK4g==
X-Received: by 2002:a05:600c:1c91:b0:434:f219:6b28 with SMTP id
 5b1f17b1804b1-43668b499f6mr344534935e9.24.1735823146029; 
 Thu, 02 Jan 2025 05:05:46 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-43656af6cbbsm485548855e9.3.2025.01.02.05.05.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 05:05:45 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Alan Third <alan@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <Z3ZylsXjH2vbX8LB@HIDDEN> (Alan Third's message
 of "Thu, 2 Jan 2025 11:03:50 +0000")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN> <Z3ZylsXjH2vbX8LB@HIDDEN>
Date: Thu, 02 Jan 2025 14:05:44 +0100
Message-ID: <m2bjwpicwn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.3 (/)

Alan Third <alan@HIDDEN> writes:

> No, none of that needs to run when we're not in the main thread.
> fd_handler run pselect in a separate thread because the NS main thread
> has to run the ns main thread run loop to handle incoming IO from the
> window system.
>
> The NS run loop can emulate parts of pselect, but not the whole thing,
> so we are required to run both the NS runloop and pselect
> simultaneously, hence fd_handler. If we don't need to run the runloop,
> i.e. we're in a non-main thread, then we can just run pselect directly
> and ignore fd_handler.

So IIUC, you'd write this in ns_select_1

  if (![NSThread isMainThread]
      || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
    thread_select (pselect, nfds, readfds, writefds,
		   exceptfds, timeout, sigmask);

as return "return thread_select(...)"?

One strange thing about threads having their own event queue is that the
message Stefan sees comes from the NSApplicaiton::run in ns_select_1. Be
that at it may.

(BTW, I've given up on NS completely, meanwhile. Always building
--without-ns.)




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 11:04:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 06:04:04 2025
Received: from localhost ([127.0.0.1]:42882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTIzj-0002C7-T5
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 06:04:04 -0500
Received: from dane.soverin.net ([185.233.34.31]:57603)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1tTIzg-0002Ba-64
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 06:04:02 -0500
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4YP3jj4HNkz2xKd;
 Thu,  2 Jan 2025 11:03:53 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4YP3jh1w5yzF1; 
 Thu,  2 Jan 2025 11:03:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1735815833; bh=IfS/terr+nzlvnsEE3GgW4Lch+1Eh9JScLA5Cv/KL1E=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=earxgMYg0LFXg2H6OWOIp8zc2zjftcwWihob65VuDSiGEkfulooHS7AgYCJlvl20x
 JrH7CDlnezchRKdcuzROSVNcUKzb89D9/WH1R7TWovgrpY18wxv/iRrIhYAJfqOrCP
 FWeupOfi2g957Ue+bOekAhl+BgIcON0aHe0JBAosV5aVEFjD1sySj/w2/lIAiXgg+M
 1zl0VfQa0PB5ogEFpMeCW7k7HI0RFqShQnIW3uTLxP7CXjDLDbOrx0o3QmwVBohd+6
 vmvzi8vos8wRmVazyLDlZ8G9GjpGJalSPzSErWbjlfp+qd23WjZw80w0Z/F3LLQst/
 oxoq/LynNFG+w==
X-CM-Analysis: v=2.4 cv=e8f8Sbp/ c=1 sm=1 tr=0 ts=67767299
 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=8nJEP1OIZ-IA:10
 a=VdSt8ZQiCzkA:10 a=mDV3o1hIAAAA:8 a=pGLkceISAAAA:8 a=hIj89exaAAAA:8
 a=FD9y6Vhym89-YHjGetcA:9 a=3ZKOabzyN94A:10 a=wPNLvfGTeEIA:10
 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22
X-CM-Envelope: MS4xfOGPni5aqlGCakHfbwq0r1K83bUk04D3gE/4v31FqzZmYVqXnJ/lAPmKqhOtCb1Kj75bt4RI9xNvDaDQnwOJ6BV7ismOXLQquLuMiMOMY4/Z5tpAaRPr
 yBBGO5F7n5uhlly3yzsWSzH9xMRgo+TzcprFKGWeVxbEdJKts1ryHQ0EAeK8g/OAn7Bq4LpOHNoRItJfh4+zQ2tVnqTMN4o3WCypLkeAmMP9eXHy6INIWG9X
 Ipwzwp7T1KygNQY4xhG57xnfRjaqf8cZMxWFdaKB+1TIqtGAgw7CuK5j2jSD7IIw
Received: from localhost (faroe.holly.idiocy.org [local])
 by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 61f4fff6;
 Thu, 2 Jan 2025 11:03:50 +0000 (UTC)
Date: Thu, 2 Jan 2025 11:03:50 +0000
From: Alan Third <alan@HIDDEN>
To: Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
Message-ID: <Z3ZylsXjH2vbX8LB@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Gerd =?iso-8859-1?Q?M=F6llmann?= <gerd.moellmann@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN,
 75275 <at> debbugs.gnu.org
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
 <m2ldvtilb8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <m2ldvtilb8.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.1 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, stefankangas@HIDDEN
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.9 (/)

On Thu, Jan 02, 2025 at 11:04:11AM +0100, Gerd Möllmann wrote:
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Gerd Möllmann <gerd.moellmann@HIDDEN>
> >> Cc: stefankangas@HIDDEN,  alan@HIDDEN,  75275 <at> debbugs.gnu.org
> >> Date: Thu, 02 Jan 2025 09:41:38 +0100
> >> 
> >> Gerd Möllmann <gerd.moellmann@HIDDEN> writes:
> >> 
> >> > Eli Zaretskii <eliz@HIDDEN> writes:
> >> >
> >> >> So should we add a condition before calling [NSApp run] that we are in
> >> >> the main thread?
> >> >
> >> > ATM, I don't understand how we land in that line in ns_select_1 if not
> >> > [NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
> >> > can see something in LLDB.
> >> 
> >> It must something in here:
> >> 
> >>   if (![NSThread isMainThread]
> >>       || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
> >>     thread_select (pselect, nfds, readfds, writefds,
> >> 		   exceptfds, timeout, sigmask);
> >> 
> >> Should we return here?

Yes. We used to be but it was removed:

9370a4763aacbb9278b5be9c92a2484e3652bc29

I don't know why it was removed, but I'd bet that, at the very least,
the isMainThread check should have moved with the 'NSApp == nil'
check.

> > I don't know.  Is there anything in the following code that can be
> > relevant to a non-main thread?  Note that non-main threads can
> > legitimately call wait_reading_process_output, which calls ns_select.
> > For example, what happens if a non-main Lisp thread starts a
> > sub-process? we do expect to be able to read the output from that
> > sub-process.

My take on how this works was that in a non-main thread ns_select
should just act like pselect, hence it used to literally just call
pselect and return. This would hopefully allow Emacs to handle IO
correctly without having to make the NS runloop code do things it
can't do.

FWIW, I still think the NS code in its current form is unsuitable for
multi-threaded use and must be rewritten.

> Really hard to tell. Perhaps someone could try to follow what I write
> below and tell if it makes sense? Everything in ns_select_1.
> 
> 1. I think this code must run in a non-main thread:
> 
>   if (nr > 0)
>     {
>       pthread_mutex_lock (&select_mutex);
>       ... set some variables ...
>       /* Inform fd_handler that select should be called.  */
>       c = 'g';
>       emacs_write_sig (selfds[1], &c, 1);
>     }
> 
> selfds is apparently some pipe, NS-specific. The function fd_handler is
> called when writing to the pipe I assume. fd_handler is set up like
> this
> 
>   [NSThread detachNewThreadSelector:@selector (fd_handler:)
>                            toTarget:NSApp
>                          withObject:nil];
> 
> Looks to me like it runs in a thread of its own. fd_handler then
> pselects on the fd sets set in the if above. That looks like it is
> relevant to reading process output. And that means we may _not_ return
> from ns_select_1 early when ![NSThread isMainThread].
> 
>   else if (nr == 0 && timeout)
>     {
>       /* No file descriptor, just a timeout, no need to wake fd_handler.  */
>       double time = timespectod (*timeout);
>       timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time
>                                                       target: NSApp
>                                                     selector:
>                                   @selector (timeout_handler:)
>                                                     userInfo: 0
>                                                      repeats: NO]
>                       retain];
>     }

No, none of that needs to run when we're not in the main thread.
fd_handler run pselect in a separate thread because the NS main thread
has to run the ns main thread run loop to handle incoming IO from the
window system.

The NS run loop can emulate parts of pselect, but not the whole thing,
so we are required to run both the NS runloop and pselect
simultaneously, hence fd_handler. If we don't need to run the runloop,
i.e. we're in a non-main thread, then we can just run pselect directly
and ignore fd_handler.

> 2. This code
> 
>   else if (nr == 0 && timeout)
>     {
>       /* No file descriptor, just a timeout, no need to wake fd_handler.  */
>       double time = timespectod (*timeout);
>       timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time
>                                                       target: NSApp
>                                                     selector:
>                                   @selector (timeout_handler:)
>                                                     userInfo: 0
>                                                      repeats: NO]
>                       retain];
>     }
> 
>   means basically only to send an app-defined event after a timeout. I
>   interpret this as "leave the NS event loop to let Emacs do things
>   after a timeout". Looks okay to me.

Correct. In more detail it sends an "App defined" event to the main
thread which signals to the run loop to stop itself.

> 3. This
> 
>   else /* No timeout and no file descriptors, can this happen?  */
>     {
>       /* Send appdefined so we exit from the loop.  */
>       ns_send_appdefined (-1);
>     }
> 
>   is likely also okay because send_app_defined has code checking for
>   being in the main thread.

This will send the app defined event to the main thread run loop. The
code in ns_send_appdefined actually instructs the main thread runloop
to send itself the event if called from a non-main thread.

> 4. The [NSApp run] follows, and it can under no circumstances be done
>    in a mon-main thread. We should put that in an if for sure.
> 
>   if ([NSThread isMainThread]) [NSApp run];

In this circumstance no. In *Step each thread has its own run loop and
event queue, so if you call [NSApp run] on a sub-thread it will look
at its own queue, which in this case likely has nothing on it, and it
will run forever. That's by design, that's how you're supposed to
write NS apps. We obviously don't want to do that.

> 5. The code below is another enigma.
> 
>   I can't figure out why that is done, and what
>   last_appdefined_event_data is for. But since it is run today, I'd
>   propose to just let it run. I don't see that it does immediate harm.

It's essentially just working out how the run loop was terminated (by
fd_handler, by some window system input, or by timeout) and creating
suitable return values by, for example, gathering the results of the
pselect run in fd_handler.

Basically, none of this needs to run in a sub-thread. We should be
able to just run pselect directly and return. Perhaps there's some
other edge case that prevents that, but I suspect it was just
overlooked. After all, nobody understands this code.
-- 
Alan Third




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 10:31:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 05:31:14 2025
Received: from localhost ([127.0.0.1]:42851 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTITx-0000sX-Rg
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 05:31:14 -0500
Received: from mout.gmx.net ([212.227.17.20]:56595)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1tTITw-0000sL-2Q
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 05:31:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1735813863; x=1736418663; i=michael.albinus@HIDDEN;
 bh=Btl8aFYq7MvsX3OtGNROPj6UALMOFhuCfK2GflkwTuw=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=s7DO8t4V9V8d2Wy1hma7O6Vzq9IOG/VjxSJhWI1GDcaDJv4oW1r4PYCYPPzh7QHH
 AdQtl2t0qkRsJBcojLXUhHbBvsWY4T/dwLfnwq6w9eI9fRYNbPMzTwDSqqXQNJqlZ
 wzR/m5eHVPxN37jeMnNjmLP/JqJrI1tnEHVGsAr9fsG+uMbmFMRFOKeM3pSW4Zdfr
 2th63NltOP9QAYBVAHRqv+wU7aSpG4orhGj5ScCjUIDoRfjMZ15tREJLQZuEC6OSW
 2L7NV9puzfETpjPpZY5/uOQXoifV18rWzj1ivLjViw4Y4yvdHePePV0t3ZUNwfZKx
 BpRzZQ0d5DMlm3zKcA==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MybGX-1thx9e0Wgn-00xe19; Thu, 02
 Jan 2025 11:31:03 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <CADwFkmmf8sC99qZHHiP9Gm+8GRAu-mLRmQghU0gUuVnj_e80qQ@HIDDEN>
 (Stefan Kangas's message of "Thu, 2 Jan 2025 01:31:39 -0600")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN>
 <CADwFkmmf8sC99qZHHiP9Gm+8GRAu-mLRmQghU0gUuVnj_e80qQ@HIDDEN>
Date: Thu, 02 Jan 2025 11:31:01 +0100
Message-ID: <87msg933tm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:iCTJsteCE3Ocnp/K9uoSbfwR1w/N9BSEZ8ds6wRkTAoeCJVP1X1
 du8gifBLDYO6EmeAgTBWjqv0vGUDsB6DW3/IHoTduwU8s6GHsKkvNavDIp4IdPKzLYFZQa1
 IMpuGDichHCY1u/6ZOhb4AkGtsKkqzq13cGE02zVwzkCRMGmYXtEbPsK0ywJdm+FufMTodl
 1uo9Hd1p8KOFYb/79Gv6Q==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:fPNfP+xBRT0=;+cOXsoreddbAf8yABR2I7NIloVC
 qnRbCtISlux6PJQKj9hM/eJ8r+/hOnd19Nk/wv7rAOW9d1KIOyNdE1eNRXHr2yrvBojKa5611
 zBLuqKARF8FWIthT1wexzYEBiQIwxjR3vS7xE8VnndnnknVobs/Kpt8Z7YGe1b8r5BdD9IJw0
 TRIjoUbgnK6u1xonKZ/15bJ0FWfy/Y70dbv4fOu4OqciU5drIErg/WaYO72Nk+7YyWEU1fpCs
 YMXNULQVf10zqz6idZ91DRPJF8Rj4RxqWRFBxR3bBmmPUCW5zUcYBk4PLrGDVv8blHGTPminW
 K0ONdMsOjFZBWmqURYS7UNVYKGxJ0RofW9Gd0ERpVqf+614Q8MavDrgNK7HR9t3+iCSB7A19S
 +NDKZmZoVdk3QoBSydA6ahkxpc0cLdneW8pOT9JZ90ndFWoyb91eymtDsnNgABZkOnxP9SREU
 6nYQ/h8f2tleAHKrJtThx+RHoj3KI82fMydMo2AOpcUUmy6VLhGUMmThYTSyV+VmxO/iEbqNW
 WxBBEfZZerIhJ4mOVnkJ055dq7ivDw+25OsFpvonKDwOtqmkmVc4LqvLfHS1b6K+65IP/6LY1
 aZfR8AYm4Wg6jsSZ/+WpQqrjuKZZbeLXf65Dua4IJPdsanKL4AQx7aYzP0bdu6KNb3DjnU5V9
 LjWCxMWziMY/qwLpE6D4gm69bNYBBwp3Ab9QHGvoR6lInXA849PqqYo3NfvNoB5xfjfO5hwCt
 3FKYNFraqzGtFYiqpLNqQFHSAFAgCm0Zpwh0L7/vVBwyoCKkmzwdvI+kIvDWQ9zE6Hv0RYpHM
 3ooQAsYzlHPZd87Pm3jUQFuSZqVsXyZO7gel9B1zuqSjoyXzye4oboqg8V4krABeRL+T6+Bu8
 TFcYr9IfI0cl/VBPaoxYdC2k5gNiJ4LDU0BiPuoB6TLqa98ma0PmIuPM+jSXUg7gDNYLJLFmI
 adC0wveWWhWbPygeotbjaS/o2SzGFitqz8E7Sj2UZypXrhCzJoD1zHEu/ZOjaCBjpEIesJxcX
 jT6haY3H+DNkuiA0IO8vGW/nRlVFm4RUfmU8W9DqS+oI03V9SlzbJZeStsAAZPBIakgDRK4sC
 ixrVzQAbw=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>,
 75275 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Alan Third <alan@HIDDEN>
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: -1.7 (-)

Stefan Kangas <stefankangas@HIDDEN> writes:

Hi Stefan,

> Note that this is a minimized reproducer.  I first noticed the issue
> after I upgraded the GNU ELPA package debbugs, which recently got
> support for threads using `make-thread'.
>
> In that package, the function `debbugs-gnu-show-reports' in
> debbugs-gnu.el is called in a thread, and the backtrace is the same.
> See debbugs-gnu.el:897.
>
> I don't see `sleep-for' called directly there, but I didn't yet
> investigate it very closely.  Maybe Michael (in Cc) knows more.

In debbugs-gnu.el, there are some invocations of sit-for. But they are
not related to the threads machinery in debbugs-gnu-show-reports.

Best regards, Michael.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 10:04:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 05:04:23 2025
Received: from localhost ([127.0.0.1]:42798 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTI3y-000849-Lj
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 05:04:23 -0500
Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:46153)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTI3v-00083u-Ik
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 05:04:21 -0500
Received: by mail-ej1-x62b.google.com with SMTP id
 a640c23a62f3a-aa67333f7d2so1593607166b.0
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 02:04:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735812253; x=1736417053; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=qe0QFBJeaL14qSQ1SxvN5guBqIGlHXEOXrEYN5CHSXk=;
 b=KV+gk+0gay32pKXg2NUV+uDPVkmiac5V35CoJFFVp1Lz9rl3MqC9/RwbYT7+J+Nh5W
 dsfvn6pEYC2qDhhDT6S2ieVx/MebvxqTFpnodu2yIbWVm1j9qN4L/MqhWGWEn+s7mXbl
 FfTvxzhgIBDNjx2x+sr9ETbRXnHoMQrJ6W0vwc/KwXibEazOOnxcyGOfg1NzAiP8gp9A
 aVXdXhS1ol5cLL8LV8AN+GwK804iejYIOdiv8eEB6bmFS+lQ2C/ngzlHjMooGj/zSw8o
 Jk9FQC/ezp4nKEd+G7V3cxwGZzZYFrsd8VgtgRB+h73KfrLNA+fH+Fma3mfF7u4MeUMW
 Gs/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735812253; x=1736417053;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=qe0QFBJeaL14qSQ1SxvN5guBqIGlHXEOXrEYN5CHSXk=;
 b=P0yhhPeW2gELVv50aOZGsD25sTJe01MxjKLz8K/pxXhAyTBUjWhOEb2HckEbLV2NQi
 k9AtolviLeOf45E8L0lmUXqvQ1FMNEtMkqFO4//8w2K60y3PQ1PlZ/My3cfiLnmOHoDS
 yf4NZs7ZNaQ8hl1ZwCzkkEyQ76ssLRB1DU59zMiH/CYGeICWPn+sPsBQUjzfO0aTXYsv
 vWjBmGvQeT+0gohW1XtTqj5ADyBYHbUyH38hoJndUW5iF0fs3PnZRphVokt4bB8BJvgO
 07Id/OzenipuBQxLH2/dqF0UWLJLBjIXJtKQPNhJVOXT2eQXk0ujbLd74sNl78VehepG
 LoUA==
X-Forwarded-Encrypted: i=1;
 AJvYcCXiTtmnP/o49lrp1TU78dPlWXYY+8O8B1ZOopKU0JdjeZ8CJZ/USMcfv80TyCGih58PoA2q3g==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzTPfJJ+qBbHf9a5A26IfNJpkJOXVELcgvXJ6HOxDjG+i0ScCIf
 uaDGOqjDlSxFwDuhOr5TXgussfRwDPPMolkVdyEkOhA9s8SeuYiHTUGUjw==
X-Gm-Gg: ASbGncvbXTxqD4qgwUC/YWo00cCwFwr7gbJctYz4zfXPNqK2iuPcFpKKf12MOlETtWK
 l9Wyg4doy0RfHJFcy4TerKr5baCyy2teFiRTvfSwsZP8LnEYWsiynNRxZuO6BMba3goZZsj3+ON
 HjwbcF4WpGoMYJrEyWtquN/nLjcgBXwMvez7kH0EJGVvAEuebgs34yaC+1zxqytQY50H6Z7sCql
 VcSQgHhtz5WRR54d6NxiDVhRX+tPvLLdy+AxnpUJeYlctWpiJNOovdgSxLfCNCqV1zjCPxbXfg/
 I0O3nUMLoxvxMryKCQRr8NzqT4oGVZrGm0LP0kGEqKQOi0cXo4jQdW2EfWbhv+2l
X-Google-Smtp-Source: AGHT+IEDbZp63h54smf3pOp1mJwVOR9YZ+LYNHwS9dhRJl4BgFH7bm4DMcJmgo0u15iiFeKBfn9ORA==
X-Received: by 2002:a17:907:7f88:b0:aa6:3f93:fb99 with SMTP id
 a640c23a62f3a-aac2d230f1cmr4366387966b.36.1735812252738; 
 Thu, 02 Jan 2025 02:04:12 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aac0f06da76sm1765157166b.194.2025.01.02.02.04.12
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 02:04:12 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <86y0ztk323.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 10:55:32 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN> <86y0ztk323.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 11:04:11 +0100
Message-ID: <m2ldvtilb8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Eli Zaretskii writes: >> From: Gerd Möllmann >> Cc: stefankangas@HIDDEN,
    alan@HIDDEN, 75275 <at> debbugs.gnu.org >> Date: Thu, 02 Jan 2025 09:41:38
    +0100 >> >> Gerd Möllmann writes: >> >> > Eli Zaretskii writes: [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (gerd.moellmann[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.1 URIBL_SBL_A            Contains URL's A record listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
  0.6 URIBL_SBL              Contains an URL's NS IP listed in the Spamhaus SBL
                             blocklist
                             [URIs: idiocy.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2a00:1450:4864:20:0:0:0:62b listed in]
                             [list.dnswl.org]
  1.0 FREEMAIL_REPLY         From and body contain different freemails
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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.3 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> Cc: stefankangas@HIDDEN,  alan@HIDDEN,  75275 <at> debbugs.gnu.org
>> Date: Thu, 02 Jan 2025 09:41:38 +0100
>>=20
>> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>>=20
>> > Eli Zaretskii <eliz@HIDDEN> writes:
>> >
>> >> So should we add a condition before calling [NSApp run] that we are in
>> >> the main thread?
>> >
>> > ATM, I don't understand how we land in that line in ns_select_1 if not
>> > [NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
>> > can see something in LLDB.
>>=20
>> It must something in here:
>>=20
>>   if (![NSThread isMainThread]
>>       || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D=
 0))
>>     thread_select (pselect, nfds, readfds, writefds,
>> 		   exceptfds, timeout, sigmask);
>>=20
>> Should we return here?
>
> I don't know.  Is there anything in the following code that can be
> relevant to a non-main thread?  Note that non-main threads can
> legitimately call wait_reading_process_output, which calls ns_select.
> For example, what happens if a non-main Lisp thread starts a
> sub-process? we do expect to be able to read the output from that
> sub-process.

Really hard to tell. Perhaps someone could try to follow what I write
below and tell if it makes sense? Everything in ns_select_1.

1. I think this code must run in a non-main thread:

  if (nr > 0)
    {
      pthread_mutex_lock (&select_mutex);
      ... set some variables ...
      /* Inform fd_handler that select should be called.  */
      c =3D 'g';
      emacs_write_sig (selfds[1], &c, 1);
    }

selfds is apparently some pipe, NS-specific. The function fd_handler is
called when writing to the pipe I assume. fd_handler is set up like
this

  [NSThread detachNewThreadSelector:@selector (fd_handler:)
                           toTarget:NSApp
                         withObject:nil];

Looks to me like it runs in a thread of its own. fd_handler then
pselects on the fd sets set in the if above. That looks like it is
relevant to reading process output. And that means we may _not_ return
from ns_select_1 early when ![NSThread isMainThread].

  else if (nr =3D=3D 0 && timeout)
    {
      /* No file descriptor, just a timeout, no need to wake fd_handler.  */
      double time =3D timespectod (*timeout);
      timed_entry =3D [[NSTimer scheduledTimerWithTimeInterval: time
                                                      target: NSApp
                                                    selector:
                                  @selector (timeout_handler:)
                                                    userInfo: 0
                                                     repeats: NO]
                      retain];
    }

2. This code

  else if (nr =3D=3D 0 && timeout)
    {
      /* No file descriptor, just a timeout, no need to wake fd_handler.  */
      double time =3D timespectod (*timeout);
      timed_entry =3D [[NSTimer scheduledTimerWithTimeInterval: time
                                                      target: NSApp
                                                    selector:
                                  @selector (timeout_handler:)
                                                    userInfo: 0
                                                     repeats: NO]
                      retain];
    }

  means basically only to send an app-defined event after a timeout. I
  interpret this as "leave the NS event loop to let Emacs do things
  after a timeout". Looks okay to me.

3. This

  else /* No timeout and no file descriptors, can this happen?  */
    {
      /* Send appdefined so we exit from the loop.  */
      ns_send_appdefined (-1);
    }

  is likely also okay because send_app_defined has code checking for
  being in the main thread.

4. The [NSApp run] follows, and it can under no circumstances be done
   in a mon-main thread. We should put that in an if for sure.

  if ([NSThread isMainThread]) [NSApp run];

5. The code below is another enigma.

  I can't figure out why that is done, and what
  last_appdefined_event_data is for. But since it is run today, I'd
  propose to just let it run. I don't see that it does immediate harm.

:-/




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:55:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:55:47 2025
Received: from localhost ([127.0.0.1]:42729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGza-0005DC-UW
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:55:47 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:52228)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTGzY-0005Cz-50
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:55:45 -0500
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 1tTGzR-0001sW-LY; Thu, 02 Jan 2025 03:55:37 -0500
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=Xxz8fMw1JEzhEHshl+m3NEeynCB/kJtd45wWgW9neTM=; b=QraaH8JvHdqyVPeQj4+9
 nILXdox5iyVU1i/F/FgDTW12DNhblZek0o6z/cO7crXGGcBe37z7xM0qKDmfBiRFvKMOiFcfBBym6
 Uhqk0dkOAvt9JMYjJZJ88aeTfwxVPGXkbjIUo/IdoGe3Aa6HF2HvpqYL6Ov8trav6F3yD1qbZSHhs
 eI2ocrpg0y3z+KcJ32D0etgb/fVIoNE56wtAvCy4NBCT3yeXHbGiTDxVDJUIUndBkVrc3G+HR/no8
 zpNeOLfAlGaweK+XrefCbl5r3GAhMMXvjyuBjuyf5hcZufHoVekIIK5ua5g3CayVf9t6Whh+aiLGN
 F611s0McROb8Xg==;
Date: Thu, 02 Jan 2025 10:55:32 +0200
Message-Id: <86y0ztk323.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <m2ttahip4t.fsf@HIDDEN> (message from Gerd =?utf-8?Q?M?=
 =?utf-8?Q?=C3=B6llmann?= on Thu, 02 Jan 2025 09:41:38 +0100)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
 <m2ttahip4t.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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: -2.6 (--)

> From: Gerd Möllmann <gerd.moellmann@HIDDEN>
> Cc: stefankangas@HIDDEN,  alan@HIDDEN,  75275 <at> debbugs.gnu.org
> Date: Thu, 02 Jan 2025 09:41:38 +0100
> 
> Gerd Möllmann <gerd.moellmann@HIDDEN> writes:
> 
> > Eli Zaretskii <eliz@HIDDEN> writes:
> >
> >> So should we add a condition before calling [NSApp run] that we are in
> >> the main thread?
> >
> > ATM, I don't understand how we land in that line in ns_select_1 if not
> > [NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
> > can see something in LLDB.
> 
> It must something in here:
> 
>   if (![NSThread isMainThread]
>       || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
>     thread_select (pselect, nfds, readfds, writefds,
> 		   exceptfds, timeout, sigmask);
> 
> Should we return here?

I don't know.  Is there anything in the following code that can be
relevant to a non-main thread?  Note that non-main threads can
legitimately call wait_reading_process_output, which calls ns_select.
For example, what happens if a non-main Lisp thread starts a
sub-process? we do expect to be able to read the output from that
sub-process.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:51:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:51:35 2025
Received: from localhost ([127.0.0.1]:42721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGvX-00051l-6S
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:51:35 -0500
Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:59643)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTGvT-00051Z-4r
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:51:33 -0500
Received: by mail-ed1-x52c.google.com with SMTP id
 4fb4d7f45d1cf-5d3bbb0f09dso19175173a12.2
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 00:51:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735807889; x=1736412689; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=TKvVkY3SrIDuJz7GuG3SFenbL11zEhNEjYSOazp0gqQ=;
 b=Fwu6rkfmEqgkJv7FWHy9EG7vbXBu2Oqn/0aWjspnYfx3IYvlFAWB167c/AlOlcXU4F
 xyeBGdOO7HGOpi8P3+STfYHp2ZJ4t3uxp/zPH3BPJXRyUwJ3NpQMSaoJTLX+Hnt2zs80
 VYiu8ibeZRMnCij3Wfh9Fk2Si9xEhfhcyIhDTbtMxt2j1I0D8cM7Nawrb1PuHJ3j7BLA
 qYQrRq+StsQk8O4plhz77HEdVhiby1slEFPxthfK758iQPRxdr3g0ajxx1UAGCSXj/xc
 6nAQneqrkdff08Hy8wpvIKodCWSeq1O6QCUfDjfUnevcMmg/KJUYSJDWhaHd6w0N+DIF
 1x9w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735807889; x=1736412689;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=TKvVkY3SrIDuJz7GuG3SFenbL11zEhNEjYSOazp0gqQ=;
 b=fIxy1eNiyhB08g8iHe/qw8GvLJEwAfVeKjnMwo5d2x+4K8ciM1JarwjMiUyJG+PkSD
 rm75fLaEuoAWl6NO6GEUfzShb3t1Az/l4SWqrQmAfIf1CvCn7DnUdWJr5RXQavJWRWE8
 uVv2TVWgTQ8+ZVuGDZ8X+xhbUYySnW7djAFzWtg0WbjQ/ZyFPape3Q7sLPHLW4at7+8X
 s5KoBMTgILlkxZNCa+Wduj+AlJb793pUjbsGjGsTJABxhDd0AIoY84Xqxs21OFJyzjS+
 Ivbm9U1kuilp9Am9y00gL/+GZJ/B75omswxrEaJeAVaJ0IwADlvYe5AHN0n4MPkmfhN4
 hkRQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCU9GPSsMDdyM0V9raGlD1H1UsNxTfUZfVJ+BuV3K2tQgCakTzwVWzIYnqvbrZw/PxHrlfhRtA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxnW2cbCDJq596vaZmtNCOxewIGVsmJL7u99boagduJzXsEfdli
 udNkYhLYlfj59JQyBCyC4HykQ6GRiD41nkA3t3kIT/1JNO+Wo2oYzSQtLQ==
X-Gm-Gg: ASbGncuistJM0HSz6IjRZbI4j0anM5BJ/+DKtlf8nq5emsZTK2YsPNyWguQvQSlP4Dg
 s1LXJhQWWAmHlIAak/6u5RVPeDtu96VhbC7T7Rv0u5LaAEsKqmzowN9nyMW+FROhEDhulJYdsPX
 2mCt5xaIQ/tiM64Zy57z0d4ke/FPv1OqiT6rK4FZfAv0KHWfPxUpGbIRX3LQwk/3aFEWQPBf4LY
 K1WHaDvQ16JJRuKo50vDGgROHnGLSyZtjp3bB4tiAgFH5GJ++3eFW5uheUuxSTd4pwiKR30E3pi
 ixijeqJQkTihULe649wiVikIcEZPDmEvvgnWKqndNxNC4vR80COi2YkzdEVQnMp4
X-Google-Smtp-Source: AGHT+IG9yN0+KKf3gsJB/o//zBpCcqb/n8hoFem/unvR49iuAHgu4aPCcSvBZQ8S07GB55eTr7bEWw==
X-Received: by 2002:a05:6402:2794:b0:5d3:d8bb:3c5c with SMTP id
 4fb4d7f45d1cf-5d81ddf3bd5mr40645233a12.12.1735807889169; 
 Thu, 02 Jan 2025 00:51:29 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5d806fedbd0sm18600921a12.55.2025.01.02.00.51.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 00:51:28 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <m2y0ztipi2.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
 =?utf-8?Q?s?= message of "Thu, 02 Jan 2025 09:33:41 +0100")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 09:51:27 +0100
Message-ID: <m2pll5ioog.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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.3 (/)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>> Cc: Stefan Kangas <stefankangas@HIDDEN>,  Alan Third <alan@HIDDEN=
g>,
>>>   75275 <at> debbugs.gnu.org
>>> Date: Thu, 02 Jan 2025 08:30:25 +0100
>>>=20
>>> Eli Zaretskii <eliz@HIDDEN> writes:
>>>=20
>>> > From the backtrace of the new Lisp thread, it looks like it finished
>>> > sleeping for 1 sec and then it proceeds to calling [NSApp run]
>>>=20
>>> I think that's the problem, see my other reply to Stefan.
>>
>> So should we add a condition before calling [NSApp run] that we are in
>> the main thread?
>
> ATM, I don't understand how we land in that line in ns_select_1 if not
> [NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
> can see something in LLDB.

Actually, consider that fast explained. I somehow hallucinated a return
in that here. But I still don't know if putting an if around the NSApp
run is sufficient or not. I don't understand the code, TBH.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:41:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:41:49 2025
Received: from localhost ([127.0.0.1]:42708 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGm4-0004c2-Tc
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:41:49 -0500
Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:53751)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTGm2-0004bo-FH
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:41:47 -0500
Received: by mail-ed1-x532.google.com with SMTP id
 4fb4d7f45d1cf-5d7e527becaso18231507a12.3
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 00:41:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735807300; x=1736412100; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=VqFv02C2EEpuhPfE1RZ1g9akak9Dx5aY2dqLZrsrRY4=;
 b=AMlqhOV8ppcEPYvqXMBEOXcdEzyOdflrx1t72nzsShmwVCONujHrFEO1PcZJ9Iea2t
 cYeczm5nQwLKwcJOAprALhM8wa8NOeY3Kf8oOumYryclt8AbtwUZzOxPOOlM81ad/jQp
 ksjG6HqgXfVAqEDoWtkZj0mX0pjk+SQQJTNRxDfhH4RQqwYsK+j/tZJh+j5I8pX2C2Z8
 0Ejlub0M8I+Q6Nc9YSv1K++5Lhg3PEsDRb7jQCQiVRkMYmunOzf+jLxgCFNjLS9FPhQp
 71tUnY9w6cWKtrDOYHwmzyCc/dRQUGDJ5qNxuzYL71cMzoBkH1k9Is1iyohaNIIBYwKJ
 ncmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735807300; x=1736412100;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=VqFv02C2EEpuhPfE1RZ1g9akak9Dx5aY2dqLZrsrRY4=;
 b=AwWdwcbL/Iro8dfk3gAG6A3OlG0T1SOb7D2j1VIjcCaoJbRI97eDWO61ghtu/RM2HH
 i9BIOJy7dKjtzXN+qUCncgfqHQSRtf5WgU+bKpclTzsuy9iR1PtncLArP7aVjACHFVix
 0MzswkUfJqtPxgEWn6Zfv/5sWa4YmJhzk6mKgX2ZNZNkvabZRuyqWO7UfP8Cdu2m23Xm
 BirFETgnjh1DSB2LPnKB3Vj5GEUeiLNbM9SYW/Pw+2kGIwWy1vJ7g+lFHyazWOqlWBNr
 fAhzPTMtoIbbPT5n1w7bw+6bF8nGZR/P8EO2uYtQQZORso/Aq0fDoQG8WaROJJIF7dGC
 6MlA==
X-Forwarded-Encrypted: i=1;
 AJvYcCU0I77Sh5LyNugCEoFmGhJib0pKLpqm7FCZZAusQHEtaeFX+56AP45nO1qdnGtfusTLOSigeA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YywkyFtRS/KMiwD6ncshk2RRkTTBIBjqA8rEvhCcXxlGH6toNFA
 FZ8DHMnavKuNVakJm3FNUTG2AJyrnZcY4Ln8o4k3snU/KM95XOiqm872ew==
X-Gm-Gg: ASbGnctx1X9CQp/DFwk6QuowmIpCMl8VEdW+Uh+5nfS4JY9QvesJ+5MpMInNCGlErKH
 YtalCdK1/cod/FrtkhMKb8IQmjyw4WpPIhcITPEBv5mRsVhoIKd8iOmX7pk6+Cj1Bw7r8RizcP4
 JZOySdrrrg3sIpi/za4QyrHOiJv9YV5L3LtWM14Y01P6WcJAasNe0z6kKxjJC+u/9Mxzl6OkMeV
 dJ/a4nRd545STNc24hRznsw4ZUgfoCzIZfgulR+gT6DPu2JixSuoIkxj0DuUKHffsQz7X/1iEUW
 4oRJ3/uGdZeXXMJUH4dnAEwG3F053RhVydNaqHmrN8N8fnl8JtTA2ZEWqoF1TNp/
X-Google-Smtp-Source: AGHT+IFxICrNuqh1AxLXYFVaZxDqFDTdqki+sH0x4ZPVUcFZyhTu6/iBUUC9wdEaNMRuD0hHrYl+CA==
X-Received: by 2002:a05:6402:1590:b0:5d0:d818:559d with SMTP id
 4fb4d7f45d1cf-5d81dda6576mr110924146a12.11.1735807300019; 
 Thu, 02 Jan 2025 00:41:40 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aaf5ca700a8sm431469566b.173.2025.01.02.00.41.39
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 00:41:39 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <m2y0ztipi2.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
 =?utf-8?Q?s?= message of "Thu, 02 Jan 2025 09:33:41 +0100")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN> <m2y0ztipi2.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 09:41:38 +0100
Message-ID: <m2ttahip4t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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.3 (/)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>> Cc: Stefan Kangas <stefankangas@HIDDEN>,  Alan Third <alan@HIDDEN=
g>,
>>>   75275 <at> debbugs.gnu.org
>>> Date: Thu, 02 Jan 2025 08:30:25 +0100
>>>=20
>>> Eli Zaretskii <eliz@HIDDEN> writes:
>>>=20
>>> > From the backtrace of the new Lisp thread, it looks like it finished
>>> > sleeping for 1 sec and then it proceeds to calling [NSApp run]
>>>=20
>>> I think that's the problem, see my other reply to Stefan.
>>
>> So should we add a condition before calling [NSApp run] that we are in
>> the main thread?
>
> ATM, I don't understand how we land in that line in ns_select_1 if not
> [NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
> can see something in LLDB.

It must something in here:

  if (![NSThread isMainThread]
      || (timeout && timeout->tv_sec =3D=3D 0 && timeout->tv_nsec =3D=3D 0))
    thread_select (pselect, nfds, readfds, writefds,
		   exceptfds, timeout, sigmask);

Should we return here?

  else
    {
      struct timespec t =3D {0, 0};
      thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
    }

  /* FIXME: This draining of outerpool causes a crash when a buffer
     running over tramp is displayed and the user tries to use the
     menus.  I believe some other autorelease pool's lifetime
     straddles this call causing a violation of autorelease pool
     nesting.  There's no good reason to keep these here since the
     pool will be drained some other time anyway, but removing them
     leaves the menus sometimes not opening until the user moves their
     mouse pointer, but that's better than a crash.

     There must be something about running external processes like
     tramp that interferes with the modal menu code.

     See bugs 24472, 37557, 37922.  */

  // [outerpool release];
  // outerpool =3D [[NSAutoreleasePool alloc] init];

What is the following about? What is select_mutex or, for example?

  send_appdefined =3D YES;
  if (nr > 0)
    {
      pthread_mutex_lock (&select_mutex);
      select_nfds =3D nfds;
      select_valid =3D 0;
      if (readfds)
        {
          select_readfds =3D *readfds;
          select_valid +=3D SELECT_HAVE_READ;
        }
      if (writefds)
        {
          select_writefds =3D *writefds;
          select_valid +=3D SELECT_HAVE_WRITE;
        }

      if (timeout)
        {
          select_timeout =3D *timeout;
          select_valid +=3D SELECT_HAVE_TMO;
        }

      pthread_mutex_unlock (&select_mutex);

      /* Inform fd_handler that select should be called.  */
      c =3D 'g';
      emacs_write_sig (selfds[1], &c, 1);
    }
  else if (nr =3D=3D 0 && timeout)
    {
      /* No file descriptor, just a timeout, no need to wake fd_handler.  */
      double time =3D timespectod (*timeout);
      timed_entry =3D [[NSTimer scheduledTimerWithTimeInterval: time
                                                      target: NSApp
                                                    selector:
                                  @selector (timeout_handler:)
                                                    userInfo: 0
                                                     repeats: NO]
                      retain];
    }
  else /* No timeout and no file descriptors, can this happen?  */
    {
      /* Send appdefined so we exit from the loop.  */
      ns_send_appdefined (-1);
    }

  block_input ();
  ns_init_events (&event);

  [NSApp run];




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:33:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:33:55 2025
Received: from localhost ([127.0.0.1]:42684 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGeR-0004Ek-7F
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:33:55 -0500
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:43211)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTGeM-0004ER-0c
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:33:53 -0500
Received: by mail-ej1-x635.google.com with SMTP id
 a640c23a62f3a-aa679ad4265so2188612366b.0
 for <75275 <at> debbugs.gnu.org>; Thu, 02 Jan 2025 00:33:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735806823; x=1736411623; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=k3gYnLAYHfku+iAZRkLaUuLH9EEmp8m0YmhKvVNo3+o=;
 b=DT6vwe/juQr79MfrwT/MgXj0oo/9egtaUyXzeM39rMowQW8Bsv4mjaiaLAY558vjsn
 tJicTexgmf1+WvPQIk8QJDiuhN4UEgBmZRFArwx+04en6kwFXRSFKhsY3gGuD+b8n1Z6
 E+3Zg4l2qTf2wWC68sDqZWM53+hzUHyMBpgkTbdYgcD7OZPaycarKFnv4YwMczVdyC5J
 KYOP0B653OY5LM9KqIde6xDiX//lbB2KhIvNEwr5LgRg//5oqML9a2ANtWwBzd/w5xkm
 7JtYdJ432II/j1Yh7zSxi1DAaDCQl7svCUyllqnAj+mzGOXrfWc0JiWnWeKyQYV9Uqo7
 6rwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735806823; x=1736411623;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=k3gYnLAYHfku+iAZRkLaUuLH9EEmp8m0YmhKvVNo3+o=;
 b=kwyB0t4qIR1pgQuk1C9Yt/rEm7i2UrXkWfsWDYK96ohxoIpTtzf+VXzwK+/FFMCUqF
 lni3uIuRdKnV9jlMypLwt9to6O5Mq5Lgfsqa7VKHD1hxLpvH/64uNd18o2sb9BALd+5h
 PyFkqaWKzhWmrXEulPlGzQ3DzbxkYnQ9mKB1Do3q3M7UPQA8/j+5vNEFWq3rvOTsMkWq
 AI4ZwsAiP7QS/2YDwAC34A1TOcmQBh8nDkq673eQAQmuSgH6HkFI8NF+Q2Kixj34SRS2
 HMzIBE/NN3USk6k+IDdkWe+lrvs2CJonbb6n9NBnI8pvTdl8L6XF4GZSRqzonQI5+IA0
 29Bg==
X-Forwarded-Encrypted: i=1;
 AJvYcCX7zz38ICulQ7uPI3nf/aVJliWcM3DaFXTS9YyTBbJO+5dJ6pyEp5dJGS5FwLrPLBKcXWOw0w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Ywc66WrAVkf8gQFZ21N2GGQAUj/aBe5BeY1STaUgqANk3gNcOc6
 Dtqlj9k22otnd9m2TtEA4gws2ujEBj6eIxL//33HhUxwfKBcEBtG/0PSKQ==
X-Gm-Gg: ASbGncsPUdBEAAzGIvpWp/DOSgZ6nT2HfL4DgBQY2AkH8b8Jw+521tAg3du18ZyVAhp
 kcd2XDVqLXK4Nj5J7pLeD/C8cKsMmO5PELEOw4bX+ZGceW/hZD7Ea2XSh4h76dhmwolIOWIe5n8
 jJk/No4qHdc1LUhVnfssdyxzU2sLZJZzTPJTaJ1Wjl5bMYc6RYKOzpYwDdyoZmXlt6cThwtT1FT
 LKDbx649//twnY0KZrTyo+Gfn8tJf2vnrJs31vIHps1JHmJw7rhvV14i98CRnJHv9MriR2NEs+2
 wWeEZyD2rX4gkBhjiN2I52QknfwjIQDSSxF65Vz7GI1ihZ5az6QSPd4woGi8aF2i
X-Google-Smtp-Source: AGHT+IHFfWQgTozSCs6ca/C4UrDgePz+J8UfO2Rx6yYq0s9Y9tPEVSuPna7AoHfBdh2hQwmuWh84tw==
X-Received: by 2002:a17:907:2d93:b0:aa6:7c8e:808c with SMTP id
 a640c23a62f3a-aac3367569dmr4523485766b.17.1735806823420; 
 Thu, 02 Jan 2025 00:33:43 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aac0efe41a6sm1781133966b.102.2025.01.02.00.33.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Jan 2025 00:33:43 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <865xmxlivo.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 10:28:27 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
 <865xmxlivo.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 09:33:41 +0100
Message-ID: <m2y0ztipi2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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.3 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> Cc: Stefan Kangas <stefankangas@HIDDEN>,  Alan Third <alan@HIDDEN=
>,
>>   75275 <at> debbugs.gnu.org
>> Date: Thu, 02 Jan 2025 08:30:25 +0100
>>=20
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>=20
>> > From the backtrace of the new Lisp thread, it looks like it finished
>> > sleeping for 1 sec and then it proceeds to calling [NSApp run]
>>=20
>> I think that's the problem, see my other reply to Stefan.
>
> So should we add a condition before calling [NSApp run] that we are in
> the main thread?

ATM, I don't understand how we land in that line in ns_select_1 if not
[NSThread isMainThread]. Maybe I need new glasses. I asked Stefan if he
can see something in LLDB.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:31:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:31:24 2025
Received: from localhost ([127.0.0.1]:42680 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGc0-0004B8-Ir
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:31:24 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:41498)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTGby-0004Av-L8
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:31:23 -0500
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 1tTGbs-0006MV-K3; Thu, 02 Jan 2025 03:31:16 -0500
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=bDHSeDudm8I6VVfQAwQj3y5FMopj4MybJilkd2iz19w=; b=RH56XnVhsv2X
 /HWcypdrQiZRMOITJHz6c3eCxOMwAQd73bXmJql0Zg8cw8TI3NwyWFAHHKjxD4wss4cak7/a3NguE
 vuc5ZmQJKW6j1eWebVBPDoKfIz3AoenGgYnikKwkTyQYgnuzB23r5aV3OPrEUjDT4mwGbQxH4a5bm
 W3whLq7AeHwILXzliSQld4sp76T5qxcMA3DR2vKDwnNhrnBZh1441EBXW88poIFEhmNN2c/o8TQlO
 Sijv6jH62YI4XwNZXdRiGlq8PgB0dDGsTBtLKlot9nkCnutB6uMpCpfcymAwJdM8W66LB1qANWo3B
 zE8SK6RVCP7ldIO0OwrHNQ==;
Date: Thu, 02 Jan 2025 10:31:09 +0200
Message-Id: <864j2hlir6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmmf8sC99qZHHiP9Gm+8GRAu-mLRmQghU0gUuVnj_e80qQ@HIDDEN>
 (message from Stefan Kangas on Thu, 2 Jan 2025 01:31:39 -0600)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN>
 <CADwFkmmf8sC99qZHHiP9Gm+8GRAu-mLRmQghU0gUuVnj_e80qQ@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <at> debbugs.gnu.org, alan@HIDDEN,
 michael.albinus@HIDDEN
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: Stefan Kangas <stefankangas@HIDDEN>
> Date: Thu, 2 Jan 2025 01:31:39 -0600
> Cc: 75275 <at> debbugs.gnu.org, Michael Albinus <michael.albinus@HIDDEN>
> 
> Note that this is a minimized reproducer.  I first noticed the issue
> after I upgraded the GNU ELPA package debbugs, which recently got
> support for threads using `make-thread'.
> 
> In that package, the function `debbugs-gnu-show-reports' in
> debbugs-gnu.el is called in a thread, and the backtrace is the same.
> See debbugs-gnu.el:897.
> 
> I don't see `sleep-for' called directly there, but I didn't yet
> investigate it very closely.  Maybe Michael (in Cc) knows more.

The call to sleep-for is just a trigger.  What you need to look for is
a call to ns_select_1, which calls [NSApp run].




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 08:28:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 03:28:46 2025
Received: from localhost ([127.0.0.1]:42668 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTGZS-0003zt-0X
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:28:46 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57342)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTGZP-0003zd-Gq
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 03:28:45 -0500
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 1tTGZI-0005XQ-Pf; Thu, 02 Jan 2025 03:28:36 -0500
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=clBsmej4DJ1fa4bA465xheKr21kJ6JNk16qPSSuQvSw=; b=mZrM0HsJX5q9EQdoIEza
 Y53Du4eJ18OOHXlk7F3e9m89lUDWygLs4mjkK3CHM80VzKJd2RQVYdBzESE9T8FT+sxn5RyXDSQI2
 PttfcdvJdMMKDqVQkz2zvNbt3xgUKzMVQIvfqtZNtbSBbzQZLyMWeKf9RckeqxuAu93mK6AZBthXx
 lkV6L/IH29aImuhF44c7xtKe8Gk0KtNon2AtbV168cSZ6ZgU9U9FqAizQTInTrpmkHDnH2OBnXaXQ
 47V7I+jbruFphWsAqynzrOAw/cSnrXvngqzS/4tPdg6LuJrYQ1fNDs6KeVJx1qM+vvZCFG1tJWti/
 26GA5Upvl33B6A==;
Date: Thu, 02 Jan 2025 10:28:27 +0200
Message-Id: <865xmxlivo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <m234i1k6zy.fsf@HIDDEN> (message from Gerd =?utf-8?Q?M?=
 =?utf-8?Q?=C3=B6llmann?= on Thu, 02 Jan 2025 08:30:25 +0100)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN> <m234i1k6zy.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, alan@HIDDEN, stefankangas@HIDDEN
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: -2.6 (--)

> From: Gerd Möllmann <gerd.moellmann@HIDDEN>
> Cc: Stefan Kangas <stefankangas@HIDDEN>,  Alan Third <alan@HIDDEN>,
>   75275 <at> debbugs.gnu.org
> Date: Thu, 02 Jan 2025 08:30:25 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > From the backtrace of the new Lisp thread, it looks like it finished
> > sleeping for 1 sec and then it proceeds to calling [NSApp run]
> 
> I think that's the problem, see my other reply to Stefan.

So should we add a condition before calling [NSApp run] that we are in
the main thread?




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:58:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:58:14 2025
Received: from localhost ([127.0.0.1]:42634 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTG5t-0002dL-Kd
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:58:13 -0500
Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:61635)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTG5r-0002d9-Ee
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:58:12 -0500
Received: by mail-ed1-x530.google.com with SMTP id
 4fb4d7f45d1cf-5d3f28a4fccso17211875a12.2
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 23:58:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735804690; x=1736409490; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=jYUU86Rp5G9/ZRLjslrv/Tl8k87okLvp7p1YJh0FH8o=;
 b=Pfs/3hRUndzzr+QjXaUdk3i5u3u/VQX8kFdVapFEhvYOoeb0ouUNEaQAZngiltMsxQ
 zpsbWSOMaiAck5y/z8IrwjGlSSoQIo3BXomRfpl7oUZgAugd/SgCn6Qz11hSbgjXGSlz
 10s+iPiLg9mzwwCChGrncdm93E86tk52t1gsHyNu+tuSFtncq4YzMFdjRB0I1aV8GM3K
 Vp6Jaop2rdcsKrtTCSQ0wxijoIyt1TBaSAH1QWqbbQ0F9Chsq5oQr45wMvqzfXQZZQEZ
 bF2rIYGY12CI3Z+sVcvCFmbVWJ9GNMl14X/wXX7YsHbJxPDAR4xhTN492o5GHsmj3j6y
 EPuA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735804690; x=1736409490;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=jYUU86Rp5G9/ZRLjslrv/Tl8k87okLvp7p1YJh0FH8o=;
 b=Pix+zxafn5avgQUtQrA24iqx7ryRgypYBmEZ39X3zBk9ywKyd7txwXK0r11SwceHqt
 vwS7I4ecrEVjbMCw2TsyqLRmudU/otQawDBAvgdnONVF7REWwQykdtIfyyy821Rbx69x
 ocUdOJhbG/X+3ZoMnLBMnwypJvwCX9DJCVwJa7BH0Rmy2CQv7YYei9doXAZXMaFzRZRf
 /mAGkuE23KVv6tfdCFKku3Ehlo7ys8dSfvio0UkNV7oHgpsFNfXbkd0trn2NnNaIlsDt
 4JtCr5zilG38ZQPPbf+aQIKzxYhOL+zmrTQrpnkHHalrOlPcs/5E0RnMTj43QrFy4L1p
 BOaQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCV/IIUYCaQErffWxOcnlQRlKbXWHAf7qe13S5AUNO0tkNQASwyZ2Hm6ybD9vNKVVQyCQrCAPA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwYC4WinJqO7P4ihxRR9hexxLwX0ZszC61oOqa/Bco6RdVnXLrV
 Usv6HN8pARHueQKcHyXrCsoAWHF+2ELeMdDiU/EdGKLWAtRX4jfm+ozudC3/NG7CVO8W/GeV4vu
 P8I3/trv0SNl+P1IGnV4rjuBRPbs=
X-Gm-Gg: ASbGncvQScoTWJW/xnnnd5+IjdgdBoSBQimEjbCk3yKasLzCkosQgXxinfSECd9SZny
 T/7ZWFH8pvOaT0PhpkpgZ0f4+Wmw5LOWNzA9o/uHJ
X-Google-Smtp-Source: AGHT+IG3EDzz8vsXGwot6k+ZcnpKsc3j8Bu+4HhZIAGD2kuPvm8ipCHYXG0DWeJatml0M1ls84h/aztvPuTNJQwEQWY=
X-Received: by 2002:a05:6402:2349:b0:5d0:d183:cc05 with SMTP id
 4fb4d7f45d1cf-5d81dd5ee27mr34216939a12.5.1735804689902; Wed, 01 Jan 2025
 23:58:09 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 2 Jan 2025 01:58:09 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <868qrtlkiq.fsf@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 <868qrtlkiq.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 2 Jan 2025 01:58:09 -0600
Message-ID: <CADwFkmkQRyjG5a59T3D_bpgECX9QsoHYyHo3d2MHMU284gh+6g@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Cc: 75275 <at> debbugs.gnu.org
>> From: Stefan Kangas <stefankangas@HIDDEN>
>> Date: Thu, 2 Jan 2025 00:47:06 -0600
>>
>> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>>
>> > Stefan Kangas <stefankangas@HIDDEN> writes:
>> >
>> >> I have run into a bug with make-thread on macOS 15.2, running on an M=
2.
>> >>
>> >> I can reproduce the issue consistently both on emacs-30 and master by
>> >> evaluating this in emacs -Q:
>> >>
>> >>     (make-thread (lambda () (sleep-for 1)) "bug")
>> >>
>> >> This leads to Emacs freezing up completely within a fraction of a
>> >> second.  I have time to move point once or maybe twice before it gets
>> >> non-responsive, let's say within a few tenths of a second.
>> >
>> > Curious question: Do you see a beach ball?
>>
>> Yes, I do see a beach ball.  It takes a second or so to show up, which I
>> guess is expected.
>>
>> >> When I kill the process in the lldb window with Ctrl+C, I can get the
>> >> following (this is on emacs-30):
>> >>
>> >>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
>> >> run](self=3D0x0000000156610fe0, _cmd=3D"run") at nsterm.m:5938:7
>> >>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=3D0,
>> >> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> >> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> >> sigmask=3D0x0000000000000000, run_loop_only=3DNO) at nsterm.m:4954:3
>> >>     frame #14: 0x000000010040202c emacs`ns_select(nfds=3D0,
>> >> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> >> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> >> sigmask=3D0x0000000000000000) at nsterm.m:5006:10
>> >
>> > I'm asking because of bug#72496. The part of the backtrace above remin=
ds
>> > me a bit of what I trued to describe in that bug: EmacsApp.run never
>> > returning to ns_select_1. Can you see if it ever returns?
>>
>> After recompiling with NSTRACE_ENABLED, and based on reading at the
>> terminal output, it seems like it does not return to ns_select_1 after
>> the first line that reads
>>
>>     nextEventMatchingMask should only be called from the Main Thread!
>>
>> Is there a better way to see if it returns to that function?
>
> Who calls nextEventMatchingMask?  I don't see it in the backtraces you
> posted.

I believe the below two lines are relevant, but note that the function
in that case is actually called "_nextEventMatchingEventMask".  IOW, I
had assumed that "nextEventMatchingMask" is just what the error message
(perhaps confusingly) said:

2   AppKit 0x0000000192721c24 -[NSApplication(NSEventRouting)
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3072
3   AppKit 0x0000000191db0060 -[NSApplication run] + 480




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:53:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:53:13 2025
Received: from localhost ([127.0.0.1]:42618 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTG13-0002OU-0v
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:53:13 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:54046)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTG0z-0002O8-J6
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:53:11 -0500
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 1tTG0u-0000Ub-8e; Thu, 02 Jan 2025 02:53:04 -0500
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=PEqRgwpStu4tDDgatcnTn49+IY38mJ+qjEkGmcs2Z8I=; b=ZarOUWQd0TRC6AXRaPwg
 RU43hdtW7T0ARv7xY8Ho/VlhISx6zICpz1f1Pn1V6gwvQKQ0OOJHmULzBrd7X9NOZVWW72Zdru3a+
 AC8XvKEGCS/KvVBwy2f/QzoPiZ0EhQTVd5IUVPHAUnFM7F4bccmAae9M08pPWv+JHi3PW8Bq4oGK+
 CUh7h/LkUvgG8UB6FitL0k2O0NDTrDvNleIKhkV25Pmmt2Hu85Deogt2d+ph3pM7YPvfk21IrM0k4
 5B/HajQn7X0RdpTXyDo2h24az0PvDB3Aai3GVhO3MLT1LmmxPFwOvNAE0zIAwoX+pVw/QMMewe0CI
 JDIfGYsTCJFFwg==;
Date: Thu, 02 Jan 2025 09:53:01 +0200
Message-Id: <868qrtlkiq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 (message from Stefan Kangas on Thu, 2 Jan 2025 00:47:06 -0600)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@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: 75275
Cc: gerd.moellmann@HIDDEN, 75275 <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: 75275 <at> debbugs.gnu.org
> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Thu, 2 Jan 2025 00:47:06 -0600
> 
> Gerd Möllmann <gerd.moellmann@HIDDEN> writes:
> 
> > Stefan Kangas <stefankangas@HIDDEN> writes:
> >
> >> I have run into a bug with make-thread on macOS 15.2, running on an M2.
> >>
> >> I can reproduce the issue consistently both on emacs-30 and master by
> >> evaluating this in emacs -Q:
> >>
> >>     (make-thread (lambda () (sleep-for 1)) "bug")
> >>
> >> This leads to Emacs freezing up completely within a fraction of a
> >> second.  I have time to move point once or maybe twice before it gets
> >> non-responsive, let's say within a few tenths of a second.
> >
> > Curious question: Do you see a beach ball?
> 
> Yes, I do see a beach ball.  It takes a second or so to show up, which I
> guess is expected.
> 
> >> When I kill the process in the lldb window with Ctrl+C, I can get the
> >> following (this is on emacs-30):
> >>
> >>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
> >> run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
> >>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
> >> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> >> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> >> sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
> >>     frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
> >> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> >> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> >> sigmask=0x0000000000000000) at nsterm.m:5006:10
> >
> > I'm asking because of bug#72496. The part of the backtrace above reminds
> > me a bit of what I trued to describe in that bug: EmacsApp.run never
> > returning to ns_select_1. Can you see if it ever returns?
> 
> After recompiling with NSTRACE_ENABLED, and based on reading at the
> terminal output, it seems like it does not return to ns_select_1 after
> the first line that reads
> 
>     nextEventMatchingMask should only be called from the Main Thread!
> 
> Is there a better way to see if it returns to that function?

Who calls nextEventMatchingMask?  I don't see it in the backtraces you
posted.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:31:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:31:43 2025
Received: from localhost ([127.0.0.1]:42567 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTFgF-0001U0-D7
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:31:43 -0500
Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:58657)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTFgD-0001Tr-EF
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:31:42 -0500
Received: by mail-ed1-x532.google.com with SMTP id
 4fb4d7f45d1cf-5cecbddb574so19236138a12.1
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 23:31:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735803100; x=1736407900; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=ZwVJLqJByJeGARoY1UUwP8CuKXaJKS62pVCYei/xyCA=;
 b=KQ6ddortOsZCQbHxeh17Tcq8HPiSitBcrUyHJILg8eoPs18I6erpuvYMTjtOxPH668
 pSmJfzjDdE02BPo+w5Xoo6hP8KCwyI0XjqwMjfXH7h8D52inLTa8T42zaO4JIjesi04p
 C8oFzzmjtAMmjm2463VH4g+DyMG6kpFqJEhIX4yp6YdHH6JyT2vJfVS+514n2LTxtD5f
 8J+uHmxpZGFxtAflvBKOJEF7UCJbMcLe9eZyhStaE06N2YkwaJKKubr19sY78MLqcyZp
 uWLFo2QCR4mdLd5ms3UW+5pKbZHKYEwey0ivX/Fg/UlqaN9C+3gvU3m2RIJTkzDmTtZn
 tqow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735803100; x=1736407900;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=ZwVJLqJByJeGARoY1UUwP8CuKXaJKS62pVCYei/xyCA=;
 b=QiHRQ2zJX+ByV5jp8rFPiPrSJSh0TfCU+iEIo4jMog7CJ/0LZhxGlG8qENa/3SLSid
 MDpxSh750ntTbEsN2O3ZCF0NQCU7gj7Kabf7lE6DXaJM9LdbbFKQInizVPT+Jsd2tXfq
 1FioidNiPQA89Fy9LuzrZ/SxBnClhstyjmTPPnluqPMAxGchnqVmNLcB4AxCIp9BjT5t
 K7mCJ6TvFh76lrNC49O1SpFQCL4HAarKo6h1H3TKAqzFbZ2CiFX5sMstZNhU3S2TSJ+N
 k21AfzbEwmgsNyCqlFe6TAlDKMWLTGCzjZnok0Ov8WGLsdDZgCH1UZNRsN2JdLVISMUY
 hiZw==
X-Gm-Message-State: AOJu0YyYE4IR8R2iPGshcA79YPwn1JBCya1xdozjI+/w2cMWnYGQkoei
 1g67iyIH91bhkwnlDU8gjMbCfxlBDhFHOh94aLsL2pyh83um5KsWbET8+WrovXcIkMUYEpj76WM
 wrU5L0jHHc+H00uA+27KkWuZW9bw=
X-Gm-Gg: ASbGncv6WwUeh6YOSDhj2ehw+19PisuxxV11wvOWMtCCajQ6GfzeaREoCE1/FkrNaJT
 BzVeAymhqX7iOz77AZmFQ6nM4jWXHLcYBQslzYyyK
X-Google-Smtp-Source: AGHT+IEcWzf+iibMAVqAM4s8NkBLTkKwevkdMk45yMzchnUywTu5MQhmYKLOoUh7iiLKleEiM6EcI/j1m//GxMK+UZo=
X-Received: by 2002:a05:6402:3510:b0:5d0:e2c8:dc8d with SMTP id
 4fb4d7f45d1cf-5d81ddfe37cmr41471168a12.20.1735803099883; Wed, 01 Jan 2025
 23:31:39 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 2 Jan 2025 01:31:39 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <86bjwplmc1.fsf@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 2 Jan 2025 01:31:39 -0600
Message-ID: <CADwFkmmf8sC99qZHHiP9Gm+8GRAu-mLRmQghU0gUuVnj_e80qQ@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
To: Eli Zaretskii <eliz@HIDDEN>, Alan Third <alan@HIDDEN>, 
 =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Michael Albinus <michael.albinus@HIDDEN>
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> The above works as expected on MS-Windows and on GNU/Linux: after
> about 1 sec the new thread exits, and Emacs works normally.
> list-threads shows a single main thread running at that time.

Thanks for verifying that this is macOS specific.

>>   thread #7, name = 'bug'
>>     frame #0: 0x000000018de3a2b0
>> dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
>> const**, unsigned long long*) const + 488
>>     frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
>> dl_info*) + 236
>>     frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
>>     frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
>> descriptionWithLocale:indent:] + 144
>>     frame #4: 0x000000018f3e8c10 Foundation`_NS_os_log_callback + 276
>>     frame #5: 0x000000018debee60
>> libsystem_trace.dylib`_os_log_fmt_flatten_NSCF + 64
>>     frame #6: 0x000000018dec5830
>> libsystem_trace.dylib`_os_log_fmt_flatten_object_impl + 372
>>     frame #7: 0x000000018debc9c8
>> libsystem_trace.dylib`_os_log_impl_flatten_and_send + 2144
>>     frame #8: 0x000000018debc150 libsystem_trace.dylib`_os_log + 168
>>     frame #9: 0x000000018debc0a0 libsystem_trace.dylib`_os_log_impl + 28
>>     frame #10: 0x000000019209151c AppKit`-[NSApplication reportException:] + 624
>>     frame #11: 0x0000000191db0118 AppKit`-[NSApplication run] + 664
>>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
>> run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
>>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
>> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
>> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
>> sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
>>     frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
>> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
>> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
>> sigmask=0x0000000000000000) at nsterm.m:5006:10
>>     frame #15: 0x000000010036930c
>> emacs`wait_reading_process_output(time_limit=1, nsecs=0, read_kbd=0,
>> do_display=false, wait_for_cell=(i = 0x0000000000000000),
>> wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5753:18
>>     frame #16: 0x000000010000b400 emacs`Fsleep_for(seconds=(i =
>> 0x0000000000000006), milliseconds=(i = 0x0000000000000000)) at
>> dispnew.c:6248:2
>
> This is the new Lisp thread started by make-thread, but it is
> somewhere in the bowels of macOS.  Is this what you see each time you
> kill Emacs after it hangs?

Yes, the backtrace seems to be the same every time.  For example, I
tried again just now and got this over three attempts:

1. thread #18, name = 'bug'
    frame #0: 0x000000018de3a268
dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
const**, unsigned long long*) const + 416
    frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
dl_info*) + 236
    frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
    frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
descriptionWithLocale:indent:] + 144

2. thread #7, name = 'bug'
    frame #0: 0x000000018de3a2b0
dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
const**, unsigned long long*) const + 488
    frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
dl_info*) + 236
    frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
    frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
descriptionWithLocale:indent:] + 144

3. thread #9, name = 'bug'
    frame #0: 0x000000018de3a268
dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
const**, unsigned long long*) const + 416
    frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
dl_info*) + 236
    frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
    frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
descriptionWithLocale:indent:] + 144

> Can someone describe how sleep-for works on macOS, i.e. what is
> supposed to happen after ns_select_1 calls -[EmacsApp run], whatever
> that is?  It sounds like something in that machinery conflicts with
> how Lisp threads are implemented.

Note that this is a minimized reproducer.  I first noticed the issue
after I upgraded the GNU ELPA package debbugs, which recently got
support for threads using `make-thread'.

In that package, the function `debbugs-gnu-show-reports' in
debbugs-gnu.el is called in a thread, and the backtrace is the same.
See debbugs-gnu.el:897.

I don't see `sleep-for' called directly there, but I didn't yet
investigate it very closely.  Maybe Michael (in Cc) knows more.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:30:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:30:33 2025
Received: from localhost ([127.0.0.1]:42563 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTFf7-0001SC-0Z
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:30:33 -0500
Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:48567)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTFf2-0001Ru-RO
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:30:31 -0500
Received: by mail-ej1-x62e.google.com with SMTP id
 a640c23a62f3a-aaf3c3c104fso689610866b.1
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 23:30:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735803027; x=1736407827; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=tYMCd2GRUbFfmH/GKapA5SHdAoUIlsBlqeABjTd2FYk=;
 b=QghJJg1bdFE2gvf5FvTSit7vHTrgC7gP0dkjxoFK4kKWEEvC/yBg9jjVNlJW3bXH37
 U5DEKpTBfvAtB9/b//+mxwdRhcKwnMoyvqteCIdr0xXUJRecsLTBGGeuvciQfnNWnGX2
 gNvR05VK0IsEDf3AKFx8PUXIpjHjcf5qaesdlOlXfBCLHLEs7dpPycfYDTChjzNEN/AF
 fhRHX00ewQ6gUaR9tVK5urvhgq4hCnjfFuE2ZRh0rHCUi4HsPTaSvi9BaQUmg0nnL4hb
 fopRPIRmvin4FCbMCc86QQ6yyVs4hgzYnB9G0SmdwUTIXKjca7QksqEZNZkBgtX7WopX
 +saQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735803027; x=1736407827;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=tYMCd2GRUbFfmH/GKapA5SHdAoUIlsBlqeABjTd2FYk=;
 b=ptCz+v/FIa+RsAzKSwoYJibEeKPGyXZYcj29/95ADIEUFAxeuzuDD1dK+BUEwLK/Wd
 4hOELiVDKNGOifEEWfiQqIDzxMaqOtbWVKi1Am+FQnSuN4+0I85JGhDmcjWqy0Jcwceh
 ZSKqhAAGeFczlMmsC7JxoAtsMQFrbqNiIJKQp/tQf4KiD/1Skn3fyK3nCFg6X8gAqkXP
 Qh5GCK8ESpL8IlQrvmsn+KntI2pubjHzw7SVmHThvwBBJQU83CjV19MEByOi1bsimnfu
 89SxqHTSrXDbgTmwpKYv2m3YpN9FP4maQmDUVBGLzG8Yv9jyl9Ip+OLHHm2rFF6yhPPf
 Hx7g==
X-Forwarded-Encrypted: i=1;
 AJvYcCXoyv1DI6T/4m1Yd1/Px/RIJXmZVnZfe5X1xPUKSd3GHH0R0Q6gxhLYaEn6iOV3XrUZ9GkEVg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwTVujnjwPQqNgU3eyPd1cLdbYmbY3SjkW0m5tRSvC4Agfl0+ar
 7sO0LaqLYocU1RbscdVBvcqfsgD40JR2jUJHdykh6FT1H0YrRzOYuWl0jA==
X-Gm-Gg: ASbGncsxW5upT3NVIV5CNA9a7vR4S8xNdHZezjdF+X4RG+OuJuJYcoz+deUyjoRWFrM
 TyKj6DXdKgpwyMzPbf3i3wVwLVltpOBUOUHuEw3pRjLEnZtrvqOKrce1ImKwJQ9TjvJ0Rk9iXkl
 K/c3NDAk3lQWTAwbxn5NGxJsaIpMl+kmqi33fP63o8pBelvnFO44/BYK4B+rQF/h/Z1bf5IV+5w
 70e8y5rwjf3aNZY/kFmKWJnpoGYhRL598LffVJXBINYWHKqlQVgB95EqF5jgTC4i8AL7YDT1pxP
 v3ffU2fEeSrnro0VdCI6Rk8LcTjNf1NY+DpcQbJKU2svORLde8cAIRJIOlWhInvw
X-Google-Smtp-Source: AGHT+IFLQfkOP4qgMGtlVr1Wto0LObygm8GZY3CifsYWMeiI+oKE4g6kJXHY0K6P1kTcSBGK1bkP4Q==
X-Received: by 2002:a17:907:a4d:b0:aaf:4008:5e2d with SMTP id
 a640c23a62f3a-aaf40085f9dmr1356201966b.0.1735803027167; 
 Wed, 01 Jan 2025 23:30:27 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aac0e895502sm1772503466b.63.2025.01.01.23.30.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 01 Jan 2025 23:30:26 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <86bjwplmc1.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 02 Jan
 2025 09:13:50 +0200")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <86bjwplmc1.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 08:30:25 +0100
Message-ID: <m234i1k6zy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> From the backtrace of the new Lisp thread, it looks like it finished
> sleeping for 1 sec and then it proceeds to calling [NSApp run]

I think that's the problem, see my other reply to Stefan.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:14:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:14:01 2025
Received: from localhost ([127.0.0.1]:42539 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTFP7-0000dV-2x
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:14:01 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:50964)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tTFP5-0000dG-4x
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:14:00 -0500
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 1tTFOy-0002J4-E6; Thu, 02 Jan 2025 02:13:52 -0500
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=eyoZC/SV3cbjQAnNSniKPBQt8e6d4MB2KvXKbKrnbzk=; b=SJBAJcXnpP7F1+pAfge5
 FUCg0NfZRgV+LZifOgP9P5pFdR7kCvMC7x8h2jK90qCuG2GIHVJrdH4Akw1CEv4/qsRq8Jgs1x3eK
 M1Q7B4NxQNeQt4Rv6nZYDUHSpyKFfMKYlFYVdx/geFqN3KTQK8dJ56bfBEQebJau/D9Nhg34TnNEM
 Ln/pdjbpdb6XUll2hCt7n1+8n/FRvaoPbiq67gA9ZoIGSArc7yj0jEmj9cf2PGOIRXSX/v7V8N23R
 BGSfKTpv6CiK6ITYnwbIQopTqweR/bvi9q2DkKay5Xd/vyc7XFeqaJ2U7tdY5bEBZnBydbu2xrtFR
 xxdnLFSebnmKzA==;
Date: Thu, 02 Jan 2025 09:13:50 +0200
Message-Id: <86bjwplmc1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>, Alan Third <alan@HIDDEN>,
 =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 (message from Stefan Kangas on Wed, 1 Jan 2025 22:57:38 -0600)
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@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: 75275
Cc: 75275 <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: Stefan Kangas <stefankangas@HIDDEN>
> Date: Wed, 1 Jan 2025 22:57:38 -0600
> 
> I have run into a bug with make-thread on macOS 15.2, running on an M2.
> 
> I can reproduce the issue consistently both on emacs-30 and master by
> evaluating this in emacs -Q:
> 
>     (make-thread (lambda () (sleep-for 1)) "bug")
> 
> This leads to Emacs freezing up completely within a fraction of a
> second.  I have time to move point once or maybe twice before it gets
> non-responsive, let's say within a few tenths of a second.

The above works as expected on MS-Windows and on GNU/Linux: after
about 1 sec the new thread exits, and Emacs works normally.
list-threads shows a single main thread running at that time.

> When I kill the process in the lldb window with Ctrl+C, I can get the
> following (this is on emacs-30):
> 
> [...]
> 2025-01-02 05:47:20.778199+0100 emacs[78593:1366649] [General]
> nextEventMatchingMask should only be called from the Main Thread!
> Process 78593 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>     frame #0: 0x000000018e12dbbc libsystem_kernel.dylib`__psynch_mutexwait + 8
> libsystem_kernel.dylib`:
> ->  0x18e12dbbc <+8>:  b.lo   0x18e12dbdc               ; <+40>
>     0x18e12dbc0 <+12>: pacibsp
>     0x18e12dbc4 <+16>: stp    x29, x30, [sp, #-0x10]!
>     0x18e12dbc8 <+20>: mov    x29, sp
> Target 0: (emacs) stopped.
> (lldb) bt all
> * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   * frame #0: 0x000000018e12dbbc libsystem_kernel.dylib`__psynch_mutexwait + 8
>     frame #1: 0x000000018e1693f8
> libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 84
>     frame #2: 0x000000018e166dbc
> libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 220
>     frame #3: 0x00000001003bfb94
> emacs`sys_mutex_lock(mutex=0x0000000100b7bd30) at systhread.c:140:15
>     frame #4: 0x00000001003bcef8
> emacs`acquire_global_lock(self=0x0000000100b074d0) at thread.c:160:3
>     frame #5: 0x00000001003bdce0

This is the main thread waiting for the global lock, which is
expected.

>   thread #7, name = 'bug'
>     frame #0: 0x000000018de3a2b0
> dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
> const**, unsigned long long*) const + 488
>     frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
> dl_info*) + 236
>     frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
>     frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
> descriptionWithLocale:indent:] + 144
>     frame #4: 0x000000018f3e8c10 Foundation`_NS_os_log_callback + 276
>     frame #5: 0x000000018debee60
> libsystem_trace.dylib`_os_log_fmt_flatten_NSCF + 64
>     frame #6: 0x000000018dec5830
> libsystem_trace.dylib`_os_log_fmt_flatten_object_impl + 372
>     frame #7: 0x000000018debc9c8
> libsystem_trace.dylib`_os_log_impl_flatten_and_send + 2144
>     frame #8: 0x000000018debc150 libsystem_trace.dylib`_os_log + 168
>     frame #9: 0x000000018debc0a0 libsystem_trace.dylib`_os_log_impl + 28
>     frame #10: 0x000000019209151c AppKit`-[NSApplication reportException:] + 624
>     frame #11: 0x0000000191db0118 AppKit`-[NSApplication run] + 664
>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
> run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
>     frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> sigmask=0x0000000000000000) at nsterm.m:5006:10
>     frame #15: 0x000000010036930c
> emacs`wait_reading_process_output(time_limit=1, nsecs=0, read_kbd=0,
> do_display=false, wait_for_cell=(i = 0x0000000000000000),
> wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5753:18
>     frame #16: 0x000000010000b400 emacs`Fsleep_for(seconds=(i =
> 0x0000000000000006), milliseconds=(i = 0x0000000000000000)) at
> dispnew.c:6248:2

This is the new Lisp thread started by make-thread, but it is
somewhere in the bowels of macOS.  Is this what you see each time you
kill Emacs after it hangs?

Can someone describe how sleep-for works on macOS, i.e. what is
supposed to happen after ns_select_1 calls -[EmacsApp run], whatever
that is?  It sounds like something in that machinery conflicts with
how Lisp threads are implemented.

From the backtrace of the new Lisp thread, it looks like it finished
sleeping for 1 sec and then it proceeds to calling [NSApp run] -- is
this correct behavior for a non-main thread?  E.g., does that try to
run the main thread (which is parked inside sys_mutex_lock, waiting
for the global lock to become free)?




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 07:12:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 02:12:13 2025
Received: from localhost ([127.0.0.1]:42534 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTFNN-0000aQ-DT
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:12:13 -0500
Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:47526)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTFNK-0000aA-Uv
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 02:12:11 -0500
Received: by mail-ej1-x632.google.com with SMTP id
 a640c23a62f3a-aaf900cc7fbso109661766b.3
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 23:12:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735801924; x=1736406724; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=JozOe9RZmV3Ooq/WG9XauZgnnHIXLialahH00HCUhvw=;
 b=VcCMd4vVSSf+0bFshWvX4Zgftf5Xo3NldDP8h0Lp6PUliA6DcDwXAUNLOOsfsHJT/l
 Qh7/MmHkZ6JmWzaZXy6YlavxRkc531Y0ilDwfHKBFegrOQhc7tTW8C3X3HfXXbYkyP5O
 Am3IZ+KTOoqut97zVfdpAKCQHu16yzt52gvaaC7NbNsUOO++v5CssK39j8kAtdoFz8u4
 6pWTErLIxVIV1baNq3LdvYgnu8LhKQdrsxGQQCYkDRXr4+06SnEOBc468NdF31qIgkZc
 Lx2r4SqmI4ExeCPRFYRFT7kDjfLbCg25EiDY2knBkD1j/EKjnlhY9Zq2E1MGmFqwWCiC
 WhFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735801924; x=1736406724;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=JozOe9RZmV3Ooq/WG9XauZgnnHIXLialahH00HCUhvw=;
 b=Fv2QhEkMm3pGKr3f2+u5p4rDMOiK38zYkf6FlIK6pzgqnMJ6awuarXia98j/uDo5x8
 OvfpElE9v3xE2MTgpIGr3s5knZEqFyuSeffmCaR61gfEFPVClORT1h1tPdOiTjSHdKLb
 jttIEXVd2jmz4vaiMUiv9/fezq5kWbtv37ynlLhIvNiaU9ts9QFHuCvcL5XRFU8LKbXg
 qJHzFpkUcONkqZf2KrUBMmuMl8IcxmsSi2oNxss/dYqQ9ustjMoZWseoB7FWrMrcJgYj
 Brj/GjFtOl1XrP82ZNWhxkJMpZ5KIYm9FhKGw6yNs3Mb3luJo62xXVuVzV/+ZjDKbvQE
 lfcg==
X-Gm-Message-State: AOJu0YxP84YKNCNX1Ek8eApbm3B6Tl88DkJZUd9ne9BQ4k9JkFVTlNZb
 Ke9iIwv0+m77jcygdMdK8XjFOvqqkTZQXv7LZbMK5yxmORiRoNFh
X-Gm-Gg: ASbGncvBBmhJ5UmwDY7gjHbyFwLoZFM8Y/Iwg4wz5JqMKy8iRAVNdQcqphaFFthciIQ
 MJbWY1ie0PHReURHrodeQidhxajp67B3ghMop00tbs/oqLB88VvE9uYNRjOml0KYJ+yc81QyRBu
 N7Ca+v0a4sy9TIQY6ZWwBCDYBZexas+/2A4uJzYX3jTtGnmTp/MizH7ub0AX5yU42Ef17LElE1e
 luFeu1ROO3t7oj2cOIVNax5nvOphcLbSp3MP+C6/K+3V+SZPkUGJ088XIiyg9D4nDBY6WHWld78
 lJ5vF//OZ3thCoTvXB/5n2q/gpTwxcLJ65Og9arBOMe4A1PCfcl8qBLAZZVeQQdr
X-Google-Smtp-Source: AGHT+IHd9GkhGw+8OpHP5n86vEEPgbE/IhPYdMHGeWKJM2C2AAioPn9Vkknop7Q33trrT0613oK8pA==
X-Received: by 2002:a17:907:d9e:b0:aa6:8676:3b3b with SMTP id
 a640c23a62f3a-aac2cc722f0mr4224442066b.30.1735801924030; 
 Wed, 01 Jan 2025 23:12:04 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aaef76c461asm1168744466b.125.2025.01.01.23.12.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 01 Jan 2025 23:12:02 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
 (Stefan Kangas's message of "Thu, 2 Jan 2025 00:47:06 -0600")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
 <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
Date: Thu, 02 Jan 2025 08:12:01 +0100
Message-ID: <m2a5c9k7um.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <at> debbugs.gnu.org, Alan Third <alan@HIDDEN>
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: -1.0 (-)

Stefan Kangas <stefankangas@HIDDEN> writes:

>> Curious question: Do you see a beach ball?
>
> Yes, I do see a beach ball.  It takes a second or so to show up, which I
> guess is expected.

Then it's the other category of freezes I see with NS, and not
bug#72496. Which doesn't mean the cause might not be the same, in some
way.

>
>>> When I kill the process in the lldb window with Ctrl+C, I can get the
>>> following (this is on emacs-30):
>>>
>>>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
>>> run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
>>>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
>>> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
>>> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
>>> sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
>>>     frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
>>> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
>>> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
>>> sigmask=0x0000000000000000) at nsterm.m:5006:10
>>
>> I'm asking because of bug#72496. The part of the backtrace above reminds
>> me a bit of what I trued to describe in that bug: EmacsApp.run never
>> returning to ns_select_1. Can you see if it ever returns?
>
> After recompiling with NSTRACE_ENABLED, and based on reading at the
> terminal output, it seems like it does not return to ns_select_1 after
> the first line that reads
>
>     nextEventMatchingMask should only be called from the Main Thread!
>
> Is there a better way to see if it returns to that function?

I think it doesn't matter for this bug. The curious thing about 72496 is
that EmacsApp.run apparently handles events so that no beach ball
appears, but Emacs doesn't get a chance to handle its events. It's as if
the Cocoa event handling decouples itself from Emacs. And that's because
it doesn't return to ns_select_1. Anyway, different construction site
apparently.

I have something in my notes which might or might not help:

  * Breakpoint for errors displayed by macOS on stderr

  Set a breakpoint on CGPostError to find sources of errors.

  #+begin_src sh
  To find out from where macOS prints stuff to stderr, like
  023-07-20 13:41:17.073449+0200 emacs[53072:1205906] [default]
      CGSWindowShmemCreateWithPort failed on port 0
  b _os_log_error_impl
  b _os_log_impl
  b _os_log_debug_impl
  b _os_log_fault_impl
  #+end_src

If on of these breakpoints is hit when the error is displayed, we could
perhaps see why ns_select_1 calls EmacsApp.run. In my understanding, it
shouldn't because Cocoa event handling should only be done in the main
thread.

If the breakpoints are not hit, we could instrument ns_select_1 to call
an empty function do_break on which we could set a breakpoint.

  if (![NSThread isMainThread])
    do_break ();
  [NSApp run];

Or something like that. The question would be what in the code above the
[NSApp run] is wrong so that we land here. Probably some if condition.

CC to Alan Third.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 06:47:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 01:47:10 2025
Received: from localhost ([127.0.0.1]:42482 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTEz8-0007rW-FF
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 01:47:10 -0500
Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:45187)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTEz6-0007rM-CI
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 01:47:09 -0500
Received: by mail-ed1-x52e.google.com with SMTP id
 4fb4d7f45d1cf-5d122cf8dd1so18998706a12.2
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 22:47:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735800427; x=1736405227; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=BsUTKt2R1cgpTFxehdnc4zis+7kbfL9R3ISBd0aSPQ0=;
 b=QJvaImW65KEfbZIM9c2JCs1bEPeU8M/RjoQHKrVp3uBtv6kPhT3RSJAQZy+b8Do+2L
 4+bBi5WES5Iyw80CC1YCfM1o9Tu5KUQZMR5gCOXGDzDpypPcbAHHRZqVpvON5pM6Edl0
 HNyqRdhrNQeiDFzmTL3MKArVh5iCpXjLAZeVGd5RVffgO1P+MDKPxp6GLI/aelswm9sE
 FiHGcrywsMxdz7MfXfYLUBXw30iogCRbvEG9U7kvAJ8gA+miao7pTINyXZmsuwjeiLWA
 GLLwvSDPRPWnb1Ts2XGXm05L4+Os+Yi562DxoD215MDSp4cdj03pRLczfBsImL8fw4x6
 cmWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735800427; x=1736405227;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=BsUTKt2R1cgpTFxehdnc4zis+7kbfL9R3ISBd0aSPQ0=;
 b=o0oJLe3IybFJmEHoC7tKe9W4tSf4v8RNwRgmLFMdoqM9aGstoXD6RmmWgh8hYIszRM
 b+os82CrZZPypI3pKtcd/QzMBNleDA/C8govQphRpKCiH52q/4l7S/3mC13FB6713xtO
 NOK9vBDqCmMDj2api7zmizfqPRtUhOiUQpH5aoruN2H26Ir0FCFyTqdYuvI5JmoLRCag
 16A2FnQJSUg4sfBsigXsTD974srkBep2hwz7p/d31qeYKc0YcXrXpRpHOVQ16HduB3Mf
 /LWjF6bn4PLQnQhIJNk2I+zGNImV8K/JqI+JzEwwpjfpRlhPcfFD6d+tie4KwcYHLPPy
 zrwg==
X-Gm-Message-State: AOJu0YxFMcbexbW4INoiLdis8eOIaYAPbuWbpr/o5SYCNUUYjglkKxDB
 nS+WDdbm2LkDb5WMBEurltbVfyTI8TIvK4FUOLSdReB0HyqKWecQaMpL26bDaFue6aQdh92CHzA
 ri9uRUdJl1EkrYGy1O+T4o3S15S8=
X-Gm-Gg: ASbGncs5D5AQNVnHZZIF7663AjuX89XE+WwPnV0QRobDxvopOdz/Ne8s9BjnPpOFsjp
 jc/3Oz2jEVOcbPLCeEq4sy8K8UY2+Oq+qMtRIfqXS
X-Google-Smtp-Source: AGHT+IEC39VKdKmJh5ZwKVllbg5TsvQ0+flpTlJYb5GYDeOG4JR2sY6xjRMTmT/bekz+aBiztPwDEMdO7UaXLRo8A/o=
X-Received: by 2002:a05:6402:2809:b0:5d1:2677:b047 with SMTP id
 4fb4d7f45d1cf-5d81de2dc3emr46645311a12.28.1735800426943; Wed, 01 Jan 2025
 22:47:06 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 2 Jan 2025 00:47:06 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <m2h66hkbtg.fsf@HIDDEN>
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 2 Jan 2025 00:47:06 -0600
Message-ID: <CADwFkmmngL341puTY7EpLVKf0e2Avcri0QWqVwAS5oHuFBhShQ@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
To: =?UTF-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <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: -1.0 (-)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Stefan Kangas <stefankangas@HIDDEN> writes:
>
>> I have run into a bug with make-thread on macOS 15.2, running on an M2.
>>
>> I can reproduce the issue consistently both on emacs-30 and master by
>> evaluating this in emacs -Q:
>>
>>     (make-thread (lambda () (sleep-for 1)) "bug")
>>
>> This leads to Emacs freezing up completely within a fraction of a
>> second.  I have time to move point once or maybe twice before it gets
>> non-responsive, let's say within a few tenths of a second.
>
> Curious question: Do you see a beach ball?

Yes, I do see a beach ball.  It takes a second or so to show up, which I
guess is expected.

>> When I kill the process in the lldb window with Ctrl+C, I can get the
>> following (this is on emacs-30):
>>
>>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
>> run](self=3D0x0000000156610fe0, _cmd=3D"run") at nsterm.m:5938:7
>>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=3D0,
>> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> sigmask=3D0x0000000000000000, run_loop_only=3DNO) at nsterm.m:4954:3
>>     frame #14: 0x000000010040202c emacs`ns_select(nfds=3D0,
>> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> sigmask=3D0x0000000000000000) at nsterm.m:5006:10
>
> I'm asking because of bug#72496. The part of the backtrace above reminds
> me a bit of what I trued to describe in that bug: EmacsApp.run never
> returning to ns_select_1. Can you see if it ever returns?

After recompiling with NSTRACE_ENABLED, and based on reading at the
terminal output, it seems like it does not return to ns_select_1 after
the first line that reads

    nextEventMatchingMask should only be called from the Main Thread!

Is there a better way to see if it returns to that function?




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 05:56:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 00:56:02 2025
Received: from localhost ([127.0.0.1]:42354 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTEBe-0005J9-4X
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 00:56:02 -0500
Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:51630)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTEBc-0005Io-AA
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 00:56:00 -0500
Received: by mail-ej1-x633.google.com with SMTP id
 a640c23a62f3a-aaf8f0ea963so115221066b.3
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 21:56:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735797353; x=1736402153; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2vsTVzeLx3SACGXQYLGSKdqP2/XsRJ6qlmyc2oBd2DU=;
 b=YtZwegONPOWqbow+4KfD9Rcwxd9jpNPMG+vNi6pLhCNFXcT58zizXwrWxOmndjWfGn
 tycMHR+cj5Xsr3OYykvGkaauoh9vUIuJsx0OMADerC9RdEDXMx/ANwCtwolQou4XdBeV
 ESvNf0RldtoIYSvYhYZ7yv+cbKYTY/n3gkRHjsZrVX0IF0ftFpeeMlAajNpUYAUbTwW+
 BJQEGVBWUyVIb40maCPLoAO2Gy4UyaaF/eQDaPOeDhnVvnp7kUKOX3JEgzMNTbzCkjOL
 AkhSD4LRTNRzcM0lP2z0p8AdQWSdHtl8B7NFQmW0xJaDUvVLkT5XgNWStoJoYepzy85n
 HBVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735797353; x=1736402153;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=2vsTVzeLx3SACGXQYLGSKdqP2/XsRJ6qlmyc2oBd2DU=;
 b=kgbPVcPhgeeuZH2I9XrBGpqmZ/3E+XyeZAjnHTNy8rxp3beFXHIHAdFcmInEo/HpBZ
 Hf0RtmP5nNu3fJgv2NqrgxsQDPOu84s5uDylp4ivUJnCbeJjKnBV8GPBIkxxXqE9YXGE
 u3OmlR/+gr600XWYuX/RgsJ503sTSErJMiiHsEJMwEvUwqptT5mRoNF5QZnbVZWf3ENJ
 dO0j/TX549Krbzz9r0K59G28QrKEhP/Ww+zORp90/UbYEebt7x3HiuD+t9pQGpXvh26I
 La/+SLaYxJ0biPfQDUN7szTI6Pq6GwRa0TrpgcFSSUMU0pk+ZalNv3it5vsF4GksZE6+
 hQ0A==
X-Gm-Message-State: AOJu0YwKAkpVtPZLw8i8yh21moleQ6UYgVIqM8pqKhaf02hwvgvBusrm
 igA2QzK3ppb5fys9EuIO1KoX6jVSQVCuALZ2/13JNfwYPym5oSz937Ailg==
X-Gm-Gg: ASbGncsmi54daJKDKv44uXLh2sfVh0jTfpBAr70mTUAVkd6QeRIiwuD7Awr4XpvAB+z
 Hn2q2+hobGS6Ehc+8jNOq/+A0vzBnbA1b5+2SNR2XNISNWs/UIJ0S/I9isSnSG3OYozXHZpqWOH
 4B6ly2lEaAAgnoP5RaG5OHynFsL8DlpQHxagLehIf+lhylFMQmpuhuyT55S4VL51WmT54NWzVFp
 YvDN8jA8UpvxoZ9xe9iaxn3nbiQ3Isjq5lUeOM1+IFcymktFbxAHP7D9d/oX0VxMKlxKErvA3CR
 l6a06swJ3QBDAcw5okzl7hoigN9pPmSdpq/ccaLDk27pHvGOMHdwroqufh+YVtwf
X-Google-Smtp-Source: AGHT+IEG2yGioQK29Ui8gyfzvGav5fhw/zaAM7OCJEAkLYuyHaX0bfyJ/KxV4F8uGdxVVNU3YM0U2A==
X-Received: by 2002:a17:907:1c2a:b0:aa6:92de:ddae with SMTP id
 a640c23a62f3a-aac2ad80068mr3888411366b.16.1735797353311; 
 Wed, 01 Jan 2025 21:55:53 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aac0f029072sm1727028766b.170.2025.01.01.21.55.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 01 Jan 2025 21:55:52 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <m2h66hkbtg.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
 =?utf-8?Q?s?= message of "Thu, 02 Jan 2025 06:46:19 +0100")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 <m2h66hkbtg.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 06:55:51 +0100
Message-ID: <m2ed1lkbdk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <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: -1.0 (-)

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Stefan Kangas <stefankangas@HIDDEN> writes:
>
>> I have run into a bug with make-thread on macOS 15.2, running on an M2.
>>
>> I can reproduce the issue consistently both on emacs-30 and master by
>> evaluating this in emacs -Q:
>>
>>     (make-thread (lambda () (sleep-for 1)) "bug")
>>
>> This leads to Emacs freezing up completely within a fraction of a
>> second.  I have time to move point once or maybe twice before it gets
>> non-responsive, let's say within a few tenths of a second.
>
> Curious question: Do you see a beach ball?
>
>> When I kill the process in the lldb window with Ctrl+C, I can get the
>> following (this is on emacs-30):
>>
>>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
>> run](self=3D0x0000000156610fe0, _cmd=3D"run") at nsterm.m:5938:7
>>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=3D0,
>> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> sigmask=3D0x0000000000000000, run_loop_only=3DNO) at nsterm.m:4954:3
>>     frame #14: 0x000000010040202c emacs`ns_select(nfds=3D0,
>> readfds=3D0x00000001708c26bc, writefds=3D0x00000001708c263c,
>> exceptfds=3D0x0000000000000000, timeout=3D0x00000001708c2610,
>> sigmask=3D0x0000000000000000) at nsterm.m:5006:10
>
> I'm asking because of bug#72496. The part of the backtrace above reminds
> me a bit of what I trued to describe in that bug: EmacsApp.run never
> returning to ns_select_1. Can you see if it ever returns?

This is what Apple says about Cocoa thread-safety

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/=
Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#:~:text=3DGuide=
lines%20for%20using%20Cocoa%20from,are%20generally%20not%20thread%2Dsafe.




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

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


Received: (at 75275) by debbugs.gnu.org; 2 Jan 2025 05:46:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 00:46:32 2025
Received: from localhost ([127.0.0.1]:42308 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTE2S-0004qb-FL
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 00:46:32 -0500
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:58749)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1tTE2P-0004q8-P9
 for 75275 <at> debbugs.gnu.org; Thu, 02 Jan 2025 00:46:31 -0500
Received: by mail-ed1-x529.google.com with SMTP id
 4fb4d7f45d1cf-5cecbddb574so19141244a12.1
 for <75275 <at> debbugs.gnu.org>; Wed, 01 Jan 2025 21:46:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735796783; x=1736401583; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=vtqKTDkyNs1Nx1S9ZYFETK+NkJes0d/I2KIVQLLKhlM=;
 b=SFikE4S3quNRjlhxS1dats3wg0tlzmBE7AI1Sa8kMcV9KyYOn6A8smcHw9w0vs5Dr7
 pZ0kISVgbF5SJzBiVUVlOoyszH8UimEIarv4486raRxdwq3n8FPcCRaUci8ZF5kDn52l
 deJEeNydD4ygYJj6Dw5CaF+Ee1Lm/52t2idsQkgv+g4MfQAcf6Hgp/TnbmI2vMsifsVb
 YNZuSeP0pctHMFXroN3LLDefZTww1vnZdZmV4nEu8Yz4I3fRtTyOgiMTU80edVgcxOJh
 L/yiAgeSNTlMOwM+4xo1LHsfoIiYIFGwHiyOKszv67RivnhFZ6ontPM5o31OyZdFlTkE
 EvWA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735796783; x=1736401583;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=vtqKTDkyNs1Nx1S9ZYFETK+NkJes0d/I2KIVQLLKhlM=;
 b=PEp0DjfSBcqrYvnuzthBEDFcy9vDrpfcKBEl/4GzLoY4Oyz3eGkTrQnIqWlB7yc9EV
 yBBLlcqa+EFQjhxhG3b1XrlsknZKtrh2ZGiDS5VlTcuGHdRhetiXDFzhjiBs0oXvk571
 0mJ1mcuBlnJlD/BGmiZlO+C6FIxM0hzduyJ7ZjymnO0+K589D3fCAHsCd7B3DSU6SWX/
 WD1611+KtP6rOzv7PrHsTGa7pjfTxxyJBeld43lKKlJAE2RCdqLp7/qr2nm/ioDEDkWN
 n96FKvQcminTB1GkOxBhGelwN0jLabiwEI9IVQTmamrX0tcv91v5YOJrdcZoysDPsMvF
 9mPQ==
X-Gm-Message-State: AOJu0YzyZ5wwjU97PUqYjYLD0mx6S94PIvLD6wYMwyA1MATMAzVnPPAO
 my3XWdsByYOyiFGhqkpit+EBDVGA2LlUDehrfyuQFMaelPjxAuj3bLd5Tg==
X-Gm-Gg: ASbGnct9+TNtgLSyJ8sEDd142j+XzIz0RqInQYXmjJnG3rP++ORHbJ0tnMG1tuCpJkV
 igcECeP5CXKkLMFpr7ghXHT45i+vTHQSbccCKG6eCk2njHTW0RWTJPH/CsQenwcZf5haJ19vGLo
 25knZueqQrGXGnk11vxoRIlDNhZe0tamSJHIxyJE/2k3xgL9+zxc/u5ceOUZ2/fOhQHEvbk5AE6
 MVkYRdKkwsoOKWwNziQ1q9CCn/IBpXAlK515mYhA9y3qEV/7QLVXR0m7aPsV3LSL31KnTPWfj3r
 zwIeF8OmqOBxbtJWGthCZ9LYoqGrRVEjDwGW5N3ClaLFvgAHyTaSKDEII8p+T5ZE
X-Google-Smtp-Source: AGHT+IHZLhcLAnf/mfrPSsn6H6v88/VqACa7PjdpzmZZXURg8b04fsYhVzTftF1HOb5S1YkEe4rutA==
X-Received: by 2002:a05:6402:350b:b0:5d3:bb6f:2675 with SMTP id
 4fb4d7f45d1cf-5d81de5e2e8mr42923515a12.34.1735796782598; 
 Wed, 01 Jan 2025 21:46:22 -0800 (PST)
Received: from pro2 (p200300e0b7290d009d701914d6a76d9d.dip0.t-ipconnect.de.
 [2003:e0:b729:d00:9d70:1914:d6a7:6d9d])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5d806fedbbasm18478883a12.71.2025.01.01.21.46.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 01 Jan 2025 21:46:21 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#75275: 30.0.92; `make-thread` bug on macOS 15.2
In-Reply-To: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
 (Stefan Kangas's message of "Wed, 1 Jan 2025 22:57:38 -0600")
References: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
Date: Thu, 02 Jan 2025 06:46:19 +0100
Message-ID: <m2h66hkbtg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75275
Cc: 75275 <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: -1.0 (-)

Stefan Kangas <stefankangas@HIDDEN> writes:

> I have run into a bug with make-thread on macOS 15.2, running on an M2.
>
> I can reproduce the issue consistently both on emacs-30 and master by
> evaluating this in emacs -Q:
>
>     (make-thread (lambda () (sleep-for 1)) "bug")
>
> This leads to Emacs freezing up completely within a fraction of a
> second.  I have time to move point once or maybe twice before it gets
> non-responsive, let's say within a few tenths of a second.

Curious question: Do you see a beach ball?

> When I kill the process in the lldb window with Ctrl+C, I can get the
> following (this is on emacs-30):
>
>     frame #12: 0x0000000100403fec emacs`-[EmacsApp
> run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
>     frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
>     frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
> readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
> exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
> sigmask=0x0000000000000000) at nsterm.m:5006:10

I'm asking because of bug#72496. The part of the backtrace above reminds
me a bit of what I trued to describe in that bug: EmacsApp.run never
returning to ns_select_1. Can you see if it ever returns?




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

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


Received: (at submit) by debbugs.gnu.org; 2 Jan 2025 04:57:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 01 23:57:57 2025
Received: from localhost ([127.0.0.1]:42214 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTDHQ-0002ZJ-7o
	for submit <at> debbugs.gnu.org; Wed, 01 Jan 2025 23:57:57 -0500
Received: from lists.gnu.org ([2001:470:142::17]:54558)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tTDHN-0002Z5-Lv
 for submit <at> debbugs.gnu.org; Wed, 01 Jan 2025 23:57:54 -0500
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 <stefankangas@HIDDEN>)
 id 1tTDHH-0001lG-J8
 for bug-gnu-emacs@HIDDEN; Wed, 01 Jan 2025 23:57:47 -0500
Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <stefankangas@HIDDEN>)
 id 1tTDHE-0003CL-Nv
 for bug-gnu-emacs@HIDDEN; Wed, 01 Jan 2025 23:57:47 -0500
Received: by mail-ed1-x52c.google.com with SMTP id
 4fb4d7f45d1cf-5d647d5df90so3670041a12.2
 for <bug-gnu-emacs@HIDDEN>; Wed, 01 Jan 2025 20:57:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735793859; x=1736398659; darn=gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=7vcqjmDhPr0Ov2c+cMWW8TKEfpuyYIvkOqoKivSrOqU=;
 b=PWMZzoLZN+jvwkybZ+O6ykq69mwuyQQKE/xmQAdf4RwgQ76QvYEbtcaqBvIzlkuoBk
 zXqvPopvUTkVHxHI23U45nakwETEIMPCvHlTdXYRoxFZ7u9EX4Ijn7caA0Bv+TNs6KJu
 x4/XoC1yL8pjGdCqH8CM1e4+K41ZuitA378ekgYQY0Y9C9u0g8bAf6d/77RQKsGgWSWU
 qLQoJXt/bsoq2XV8PejzCOsqWPjuVpUJGFzC6Os3fN3/VIh9UPlCxHuiUC2EQjIqMccd
 gDxTBiPQNlGqh4TzNau+kvB4/c1SG7X+TNKwO+sc4fR4O2f2X+IhWjaU+PANRu4rqaTx
 HK8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735793859; x=1736398659;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=7vcqjmDhPr0Ov2c+cMWW8TKEfpuyYIvkOqoKivSrOqU=;
 b=o7FlH4yK9XNotoPv+PFNjTZ9shW4nhlEf0q538N2Ltn6kyIPzibrN8p9QuzPZnF0+K
 gLcI8d+mALtsoCJ5Ft/5O0ZQygZBGp5YZRrgeZroZaatjnLoalepsbHPsi1GCJZucIdr
 vsWPmCYBXHcc+pyJbgsXxLxmIxwVmVJj7GAQgrWfKinR7EJ/37+a7z684lEgCxK67Hlt
 G3d9zTQGWNGgy//2lDRO+fH/y1bc8Qb7OIBqphWK33lP85rAeJmz4j1SbybDh8EGRWSQ
 QSkP7/lIDwRvn3zjzCLonvTWAJJnEZCu56Qxv5WVuZ6i8bDWenvAdiAIrGFt1sbSJEpb
 hCaQ==
X-Gm-Message-State: AOJu0YwXpU/wa0h+1eTkdw+QiZNAUblkFYLNpsRbFnNggn32EqGRa7pc
 otlJ0UGyY79AkeuKQAsOLtTADANNA2xNcVwad7D6LlCWA8AqSqZ4kCVCSWl3F6mEH+kyfffRTgj
 zfJ2PTKBHigTKN7BLQIIFpwDfIgwF3H76uns=
X-Gm-Gg: ASbGncuCVvby26ey8hyFwMxXYjxz+mWi30cbW0IYdyHwFJY/3KfJaobwPGhUOqXuGfS
 FzwjolLusw6HvK5Tx9CYfIKkJNvWCMF0Hm/Wxma94
X-Google-Smtp-Source: AGHT+IEghhzIhyzaeF2kwl1bwcUBSs9dKnYitScvlAix/PiWUpf44oH/9pOvAsIafxZFIH3NTXn3bvDju26aOgxBczA=
X-Received: by 2002:a05:6402:430f:b0:5d1:2631:b88a with SMTP id
 4fb4d7f45d1cf-5d81ddacf87mr31107478a12.17.1735793858739; Wed, 01 Jan 2025
 20:57:38 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 1 Jan 2025 22:57:38 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Wed, 1 Jan 2025 22:57:38 -0600
Message-ID: <CADwFkm=QcK4UYVv0MYMfJBgABjTTpPYC5Frf=9UuMXmsxptEUw@HIDDEN>
Subject: 30.0.92; `make-thread` bug on macOS 15.2
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::52c;
 envelope-from=stefankangas@HIDDEN; helo=mail-ed1-x52c.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
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 (/)

I have run into a bug with make-thread on macOS 15.2, running on an M2.

I can reproduce the issue consistently both on emacs-30 and master by
evaluating this in emacs -Q:

    (make-thread (lambda () (sleep-for 1)) "bug")

This leads to Emacs freezing up completely within a fraction of a
second.  I have time to move point once or maybe twice before it gets
non-responsive, let's say within a few tenths of a second.

Running under lldb, I see the following lines get printed over and over:

2025-01-02 05:47:20.776364+0100 emacs[78593:1366649] [General]
nextEventMatchingMask should only be called from the Main Thread!
2025-01-02 05:47:20.777212+0100 emacs[78593:1366649] [General] (
	0   CoreFoundation                      0x000000018e2c6e80
__exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018ddaecd8
objc_exception_throw + 88
	2   AppKit                              0x0000000192721c24
-[NSApplication(NSEventRouting)
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3072
	3   AppKit                              0x0000000191db0060
-[NSApplication run] + 480
	4   emacs                               0x0000000100403fec -[EmacsApp run] + 88
	5   emacs                               0x00000001004024b0 ns_select_1 + 1144
	6   emacs                               0x000000010040202c ns_select + 72
	7   emacs                               0x000000010036930c
wait_reading_process_output + 5264
	8   emacs                               0x000000010000b400 Fsleep_for + 372
	9   emacs                               0x00000001002bd5d8 eval_sub + 2164
	10  emacs                               0x00000001002bdd2c Fprogn + 100
	11  emacs                               0x00000001002c79dc
funcall_lambda + 1964
	12  emacs                               0x00000001002c6af4
funcall_general + 276
	13  emacs                               0x00000001002bedf8 Ffuncall + 464
	14  emacs                               0x00000001003bf944
invoke_thread_function + 48
	15  emacs                               0x00000001002c2a9c
internal_condition_case + 148
	16  emacs                               0x00000001003be36c run_thread + 340
	17  libsystem_pthread.dylib             0x000000018e16c2e4 _pthread_start + 136
	18  libsystem_pthread.dylib             0x000000018e1670fc thread_start + 8
)
2025-01-02 05:47:20.777270+0100 emacs[78593:1366649] [General]
nextEventMatchingMask should only be called from the Main Thread!
2025-01-02 05:47:20.778126+0100 emacs[78593:1366649] [General] (

When I kill the process in the lldb window with Ctrl+C, I can get the
following (this is on emacs-30):

[...]
2025-01-02 05:47:20.778199+0100 emacs[78593:1366649] [General]
nextEventMatchingMask should only be called from the Main Thread!
Process 78593 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x000000018e12dbbc libsystem_kernel.dylib`__psynch_mutexwait + 8
libsystem_kernel.dylib`:
->  0x18e12dbbc <+8>:  b.lo   0x18e12dbdc               ; <+40>
    0x18e12dbc0 <+12>: pacibsp
    0x18e12dbc4 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x18e12dbc8 <+20>: mov    x29, sp
Target 0: (emacs) stopped.
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000018e12dbbc libsystem_kernel.dylib`__psynch_mutexwait + 8
    frame #1: 0x000000018e1693f8
libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 84
    frame #2: 0x000000018e166dbc
libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 220
    frame #3: 0x00000001003bfb94
emacs`sys_mutex_lock(mutex=0x0000000100b7bd30) at systhread.c:140:15
    frame #4: 0x00000001003bcef8
emacs`acquire_global_lock(self=0x0000000100b074d0) at thread.c:160:3
    frame #5: 0x00000001003bdce0
emacs`really_call_select(arg=0x000000016fdfc5d8) at thread.c:636:7
    frame #6: 0x000000010026ee70
emacs`flush_stack_call_func1(func=(emacs`really_call_select at
thread.c:614), arg=0x000000016fdfc5d8) at alloc.c:5534:3
    frame #7: 0x00000001003bd35c
emacs`flush_stack_call_func(func=(emacs`really_call_select at
thread.c:614), arg=0x000000016fdfc5d8) at lisp.h:4509:3
    frame #8: 0x00000001003bdc14
emacs`thread_select(func=(libsystem_kernel.dylib`pselect$DARWIN_EXTSN),
max_fds=0, rfds=0x0000000000000000, wfds=0x0000000000000000,
efds=0x0000000000000000, timeout=0x000000016fdfc690,
sigmask=0x0000000000000000) at thread.c:656:3
    frame #9: 0x00000001004022e4 emacs`ns_select_1(nfds=0,
readfds=0x000000016fdfcf2c, writefds=0x000000016fdfceac,
exceptfds=0x0000000000000000, timeout=0x000000016fdfce80,
sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4883:7
    frame #10: 0x000000010040202c emacs`ns_select(nfds=0,
readfds=0x000000016fdfcf2c, writefds=0x000000016fdfceac,
exceptfds=0x0000000000000000, timeout=0x000000016fdfce80,
sigmask=0x0000000000000000) at nsterm.m:5006:10
    frame #11: 0x000000010036930c
emacs`wait_reading_process_output(time_limit=30, nsecs=0, read_kbd=-1,
do_display=true, wait_for_cell=(i = 0x0000000000000000),
wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5753:18
    frame #12: 0x000000010000b7b8 emacs`sit_for(timeout=(i =
0x000000000000007a), reading=true, display_option=1) at
dispnew.c:6335:7
    frame #13: 0x00000001001a5964 emacs`read_char(commandflag=1,
map=(i = 0x0000000138061a63), prev_event=(i = 0x0000000000000000),
used_mouse_menu=0x000000016fdfe367, end_time=0x0000000000000000) at
keyboard.c:2923:11
    frame #14: 0x00000001001a0ed0
emacs`read_key_sequence(keybuf=0x000000016fdfea38, prompt=(i =
0x0000000000000000), dont_downcase_last=false,
can_return_switch_frame=true, fix_current_buffer=true,
prevent_redisplay=false, disable_text_conversion_p=false) at
keyboard.c:10743:12
    frame #15: 0x000000010019ebac emacs`command_loop_1 at keyboard.c:1429:15
    frame #16: 0x00000001002c2a9c
emacs`internal_condition_case(bfun=(emacs`command_loop_1 at
keyboard.c:1324), handlers=(i = 0x0000000000000090),
hfun=(emacs`cmd_error at keyboard.c:970)) at eval.c:1613:25
    frame #17: 0x000000010019e560 emacs`command_loop_2(handlers=(i =
0x0000000000000090)) at keyboard.c:1168:11
    frame #18: 0x00000001002c1b64 emacs`internal_catch(tag=(i =
0x0000000000011220), func=(emacs`command_loop_2 at keyboard.c:1164),
arg=(i = 0x0000000000000090)) at eval.c:1292:25
    frame #19: 0x000000010019d4f8 emacs`command_loop at keyboard.c:1146:2
    frame #20: 0x000000010019d2a0 emacs`recursive_edit_1 at keyboard.c:754:9
    frame #21: 0x000000010019d884 emacs`Frecursive_edit at keyboard.c:837:3
    frame #22: 0x0000000100199c50 emacs`main(argc=2,
argv=0x000000016fdff4c8) at emacs.c:2635:3
    frame #23: 0x000000018ddec274 dyld`start + 2840
  thread #4
    frame #0: 0x000000018e1311a8 libsystem_kernel.dylib`__pselect + 8
    frame #1: 0x000000018e131080
libsystem_kernel.dylib`pselect$DARWIN_EXTSN + 64
    frame #2: 0x0000000100405c18 emacs`-[EmacsApp
fd_handler:](self=0x0000000156610fe0, _cmd="fd_handler:",
unused=0x0000000000000000) at nsterm.m:6440:20
    frame #3: 0x000000018f41cc24 Foundation`__NSThread__start__ + 724
    frame #4: 0x000000018e16c2e4 libsystem_pthread.dylib`_pthread_start + 136
  thread #5, name = 'com.apple.NSEventThread'
    frame #0: 0x000000018e12af54 libsystem_kernel.dylib`mach_msg2_trap + 8
    frame #1: 0x000000018e13d604 libsystem_kernel.dylib`mach_msg2_internal + 80
    frame #2: 0x000000018e133af8 libsystem_kernel.dylib`mach_msg_overwrite + 480
    frame #3: 0x000000018e12b29c libsystem_kernel.dylib`mach_msg + 24
    frame #4: 0x000000018e254a3c CoreFoundation`__CFRunLoopServiceMachPort + 160
    frame #5: 0x000000018e25329c CoreFoundation`__CFRunLoopRun + 1212
    frame #6: 0x000000018e252724 CoreFoundation`CFRunLoopRunSpecific + 588
    frame #7: 0x0000000191ee1a20 AppKit`_NSEventThread + 148
    frame #8: 0x000000018e16c2e4 libsystem_pthread.dylib`_pthread_start + 136
  thread #6
    frame #0: 0x000000018e1670e8 libsystem_pthread.dylib`start_wqthread
  thread #7, name = 'bug'
    frame #0: 0x000000018de3a2b0
dyld`dyld3::MachOLoaded::findClosestSymbol(unsigned long long, char
const**, unsigned long long*) const + 488
    frame #1: 0x000000018de1b13c dyld`dyld4::APIs::dladdr(void const*,
dl_info*) + 236
    frame #2: 0x000000018e012f00 libsystem_c.dylib`backtrace_symbols + 144
    frame #3: 0x000000018f4998c0 Foundation`-[_NSCallStackArray
descriptionWithLocale:indent:] + 144
    frame #4: 0x000000018f3e8c10 Foundation`_NS_os_log_callback + 276
    frame #5: 0x000000018debee60
libsystem_trace.dylib`_os_log_fmt_flatten_NSCF + 64
    frame #6: 0x000000018dec5830
libsystem_trace.dylib`_os_log_fmt_flatten_object_impl + 372
    frame #7: 0x000000018debc9c8
libsystem_trace.dylib`_os_log_impl_flatten_and_send + 2144
    frame #8: 0x000000018debc150 libsystem_trace.dylib`_os_log + 168
    frame #9: 0x000000018debc0a0 libsystem_trace.dylib`_os_log_impl + 28
    frame #10: 0x000000019209151c AppKit`-[NSApplication reportException:] + 624
    frame #11: 0x0000000191db0118 AppKit`-[NSApplication run] + 664
    frame #12: 0x0000000100403fec emacs`-[EmacsApp
run](self=0x0000000156610fe0, _cmd="run") at nsterm.m:5938:7
    frame #13: 0x00000001004024b0 emacs`ns_select_1(nfds=0,
readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4954:3
    frame #14: 0x000000010040202c emacs`ns_select(nfds=0,
readfds=0x00000001708c26bc, writefds=0x00000001708c263c,
exceptfds=0x0000000000000000, timeout=0x00000001708c2610,
sigmask=0x0000000000000000) at nsterm.m:5006:10
    frame #15: 0x000000010036930c
emacs`wait_reading_process_output(time_limit=1, nsecs=0, read_kbd=0,
do_display=false, wait_for_cell=(i = 0x0000000000000000),
wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5753:18
    frame #16: 0x000000010000b400 emacs`Fsleep_for(seconds=(i =
0x0000000000000006), milliseconds=(i = 0x0000000000000000)) at
dispnew.c:6248:2
    frame #17: 0x00000001002bd5d8 emacs`eval_sub(form=(i =
0x0000000138061f43)) at eval.c:2601:15
    frame #18: 0x00000001002bdd2c emacs`Fprogn(body=(i =
0x0000000000000000)) at eval.c:439:13
    frame #19: 0x00000001002c79dc emacs`funcall_lambda(fun=(i =
0x000000015809908d), nargs=0, arg_vector=0x000000015693e868) at
eval.c:3350:15
    frame #20: 0x00000001002c6af4 emacs`funcall_general(fun=(i =
0x000000015809908d), numargs=0, args=0x000000015693e868) at
eval.c:3044:12
    frame #21: 0x00000001002bedf8 emacs`Ffuncall(nargs=1,
args=0x000000015693e860) at eval.c:3093:21
    frame #22: 0x00000001003bf944 emacs`invoke_thread_function at
thread.c:744:28
    frame #23: 0x00000001002c2a9c
emacs`internal_condition_case(bfun=(emacs`invoke_thread_function at
thread.c:741), handlers=(i = 0x0000000000000030),
hfun=(emacs`record_thread_error at thread.c:752)) at eval.c:1613:25
    frame #24: 0x00000001003be36c
emacs`run_thread(state=0x000000015693e840) at thread.c:815:3
    frame #25: 0x000000018e16c2e4 libsystem_pthread.dylib`_pthread_start + 136
  thread #8, name = 'HIE: __ 6f45e584fd961eaa 2025-01-02 05:47:10.265'
    frame #0: 0x000000018e12af54 libsystem_kernel.dylib`mach_msg2_trap + 8
    frame #1: 0x000000018e13d604 libsystem_kernel.dylib`mach_msg2_internal + 80
    frame #2: 0x000000018e15a458 libsystem_kernel.dylib`thread_suspend + 108
    frame #3: 0x0000000194bce174
HIServices`SOME_OTHER_THREAD_SWALLOWED_AT_LEAST_ONE_EXCEPTION + 20
    frame #4: 0x000000018f41cc24 Foundation`__NSThread__start__ + 724
    frame #5: 0x000000018e16c2e4 libsystem_pthread.dylib`_pthread_start + 136
  thread #9
    frame #0: 0x000000018e12cba4 libsystem_kernel.dylib`__workq_kernreturn + 8
(lldb)

In GNU Emacs 30.0.93 (build 1, aarch64-apple-darwin24.2.0, NS
 appkit-2575.30 Version 15.2 (Build 24C101)) of 2025-01-02 built on
 foo.local
Repository revision: 43a8f0de5ecbe8430917968af703f4a630567461
Repository branch: emacs-30
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.2

Configured using:
 'configure --without-dbus --with-native-compilation
 --enable-checking=yes --enable-check-lisp-object-type
 'CFLAGS=-I/opt/homebrew/opt/libmps/include -O0 -g3'
 LDFLAGS=-L/opt/homebrew/opt/libmps/lib'

Configured features:
ACL GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER
PNG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP ZLIB

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

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: 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:
None found.

Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run
bytecomp byte-compile comp-common rx emacsbug message mailcap yank-media
puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived
epg rfc6068 epg-config gnus-util text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util 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 kqueue cocoa ns lcms2
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 55821 9594) (symbols 48 6633 0) (strings 32 15516 4510)
 (string-bytes 1 404656) (vectors 16 11284)
 (vector-slots 8 125438 8014) (floats 8 21 14) (intervals 56 243 1)
 (buffers 992 11))




Acknowledgement sent to Stefan Kangas <stefankangas@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#75275; 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: Sun, 12 Jan 2025 05:45:02 UTC

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