GNU bug report logs - #72496
31.0.50; macOS: freezes without beach ball

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: Gerd Möllmann <gerd.moellmann@HIDDEN>; merged with #74369; dated Tue, 6 Aug 2024 13:41:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 72496 74369. Request was from Gerd Möllmann <gerd.moellmann@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 72496) by debbugs.gnu.org; 10 Aug 2024 09:19:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 10 05:19:57 2024
Received: from localhost ([127.0.0.1]:39065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sciGT-0008Bj-3D
	for submit <at> debbugs.gnu.org; Sat, 10 Aug 2024 05:19:57 -0400
Received: from mail-ed1-f49.google.com ([209.85.208.49]:56754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1sciGP-0008BS-0n
 for 72496 <at> debbugs.gnu.org; Sat, 10 Aug 2024 05:19:56 -0400
Received: by mail-ed1-f49.google.com with SMTP id
 4fb4d7f45d1cf-5af51684d52so3133305a12.1
 for <72496 <at> debbugs.gnu.org>; Sat, 10 Aug 2024 02:19:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1723281497; x=1723886297; 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=2DpSXqZBPmJuIQ0SmhAJR3awarKKoUt52YYe5R9uuCw=;
 b=MnhuG1ckUI1vxUW3oIQBvyZMJ8eMuLoLMx0XA0XAHNRGVCWNS0TD8qHYYSAQib8p32
 +kZgR5t3/UvwWM+f1YlyfpY/rXn0BMoKTNxSDW5SdSn3DlfCp1/tQay35nidvbrwmcJk
 p3Ou3Ucxt1kfBqLScq4UgluYU6AzMJ79aRz44xnLCt7N3XcPl9nrAnJidx15/I8iCwJ7
 o9DCIrUEeLWq5OPiClJhv09nl7pnJVtgaSGaRy03lXWTEZxTWcNjDCiVpgB8eMV2hOgS
 LX0BXXHOPfTucOF4NkBeksq3w5bgbA6NWsC/hjPxi/3e1ux7Fn3clQ0Q0F9zYhcJpkgb
 8YBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1723281497; x=1723886297;
 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=2DpSXqZBPmJuIQ0SmhAJR3awarKKoUt52YYe5R9uuCw=;
 b=pgf138buwfBswJOb3dHE6nImOIpzCaMFocdixPYw/EdcniEMVCJxmb+fYD2xIHbZKQ
 wah8w9+r1CFjng4xPPmBJuOblK+TvRwgxEX9z4AuTqOMEz7vmdEHZ8X+POKxNTu/eXoq
 giuUkrf3nRM3GbPFcSOAi4DibjZii9LHlbiPvdq2pnLLrcRElVTyOjtau6NPwgeA8bPF
 YZYqeh9XSBW24UF5+7FdAfrPjua0eCX3rV0fd+h9Iv+QHMoJjTEyCbjXIASh9QoqMLl1
 mzXDE0IXKT4GY5HdjfVzwVwjr3hIdGH55DHlMu0iZf5KfjqbCb2bzsFw5pTL3sztcOfT
 u3Iw==
X-Gm-Message-State: AOJu0Yyn7rrp1BhiyP5nBnd+pCaLusgigN0Qcd5bLDOfRA3AZUePgGPX
 d8jEDGMePjWJgU5dQWLlT0KDgYGVJGcku1qDGa19pxChWWYg7dxlet5tBw==
X-Google-Smtp-Source: AGHT+IErxom1Me4CWjZrLI5cpPl7ET1+W5pKnW+98tR4aSZsrMEprtZLAr9Gk/WexAdeAsPiwq3trg==
X-Received: by 2002:a17:907:f716:b0:a7a:9d1e:3b26 with SMTP id
 a640c23a62f3a-a80aa5e56b0mr282195766b.37.1723281497083; 
 Sat, 10 Aug 2024 02:18:17 -0700 (PDT)
Received: from pro2.fritz.box (p4fe3a01c.dip0.t-ipconnect.de. [79.227.160.28])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a80bb1cd2a8sm53054966b.117.2024.08.10.02.18.16
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 10 Aug 2024 02:18:16 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <m234nfd1sm.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llman?=
 =?utf-8?Q?n=22's?= message of "Thu, 08 Aug 2024 07:24:57 +0200")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
 <m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN>
 <m21q318pl7.fsf@HIDDEN> <m234nfd1sm.fsf@HIDDEN>
Date: Sat, 10 Aug 2024 11:18:15 +0200
Message-ID: <m24j7spwh4.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: 72496
Cc: 72496 <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:

> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>
>>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>>> Cc: 72496 <at> debbugs.gnu.org
>>>> Date: Tue, 06 Aug 2024 18:36:39 +0200
>>>>=20
>>>> I've tried this
>>>>=20
>>>>   (when (fboundp 'ns-app-stop)
>>>>     (defun sigusr1-handler ()
>>>>       (interactive)
>>>>       (message "SIGUSR1 - stop event loop")
>>>>       (ns-app-stop))
>>>>     (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
>>>>=20
>>>> where ns-app-stop does such a ns_send_appdefined, but that didn't work
>>>> for a reason unknown to me.
>>>
>>> Maybe the way SIGUSR1 is handled involves the same event queue that is
>>> botched in this scenario?
>>
>> Yes, that's quite likely. I had a little hope that a signal would maybe
>> handled in some special way, but apparently not.
>
> I'm now running locally with the attached change. This removes the
> global variable that can prevent sending app-defined events when set
> wrong. Instead, I'm using [NSApplication nextEventMatchingMask] to check
> if an app-defined event has already been posted. This is infinelty less
> dangerous.
>
> Let's see if that is the problem.

I don't even know if this is related to my change to ns_send_appdefined, but
I got a freeze today while using child frames (vertico + posframe) that
I haven't seen before. Event the mouse behaved strangely on the whole
macOS until I killed the process. That was without beach ball.

So, whatever that was, my patch at least didn't help, if it wasn't
causing it.

I give up. I'll switch to using tty Emacs.




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

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


Received: (at 72496) by debbugs.gnu.org; 8 Aug 2024 05:26:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 08 01:26:34 2024
Received: from localhost ([127.0.0.1]:35333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbvfW-00071F-4R
	for submit <at> debbugs.gnu.org; Thu, 08 Aug 2024 01:26:34 -0400
Received: from mail-ej1-f49.google.com ([209.85.218.49]:47488)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1sbvfU-000711-8z
 for 72496 <at> debbugs.gnu.org; Thu, 08 Aug 2024 01:26:32 -0400
Received: by mail-ej1-f49.google.com with SMTP id
 a640c23a62f3a-a7d2a9a23d9so62361566b.3
 for <72496 <at> debbugs.gnu.org>; Wed, 07 Aug 2024 22:26:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1723094700; x=1723699500; 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=AZaygRDVDWgT1DJoBxfVJM8urYw2ew99cd2EgkLsQuo=;
 b=D02riPIfuOuNqlXvDKcFEgnbUggJnXt4MMm5Tj7N1/BNBA0HIOrywzhVtYHcTBWlcq
 tVdGrYcegqiYo2dlOxEzy6hY+leRyiLULjP+y72ed26Ei7b34BXX3X1KzEvBaggLcg1u
 S70PKmLXkT0+6xk4ry2Wfx99c3ZZbyRMTmjVOMAFzMsB1WYYOE2M0ENTShousB2Jim2O
 p0siuMjopsl4u79AsRyRMlKHf6864kFpjPI1Fmshach3IXsdDHzfYJ1Wqywh/yzZzxwB
 dHL7VYS+J42mn7CV1ymWnXJ1cyBYDIicfI3xDVZzurTb3lysqLnqTXml22+iUkgLi13G
 wkWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1723094700; x=1723699500;
 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=AZaygRDVDWgT1DJoBxfVJM8urYw2ew99cd2EgkLsQuo=;
 b=VwM1ZKoEkkEqh6Ma0t0m2W3Lj6N3I7nqF9gZFjGwMmiBWUNr9FLVjpKQqBbRJUT9j1
 1YK738xhJHHamWLGiHB0alFz4SiFdS7VD322nHryYz3nbIMT1qE7Gnt41Fp+0kGgurBl
 GRqSj5fOgfPwhJoWeL8/iLmb1C0hh5ZE6woPJpcEPGqCwQ6eb7pEz/6F4I6btfFMl/Gx
 UjUl3QcCG3w1fF++PLVZB/tWPdhU/yWBUtNcbB2r2AVwrMQPDB8xZTBvuf9m/8vhQQaG
 Fyjy23DG6Lx3asryvdVETTe+ZrkGe3MVNTeiNJm7EAbWObr/9ZO55TZbRl1Y0UxJSGlW
 UdCw==
X-Gm-Message-State: AOJu0Ywg/ERX2DY3KQKKGsCNa7jwSEllfYqhuxzRW1zwPsl0cSMrMlCq
 WCq/L+dTnFLzZCjFw3Ek1taCjndYxzeknKV5iaDPsWndVteQAfP6tBoJEQ==
X-Google-Smtp-Source: AGHT+IE1S5lU0U9sN3nS6GhrTwybiTnd4r8rn9zc5CqU3av5ZjBCOI5eEmpGfVZGFI6W26r+Vtk6HQ==
X-Received: by 2002:a17:907:d581:b0:a77:bfca:da57 with SMTP id
 a640c23a62f3a-a8090e62284mr42513966b.44.1723094699699; 
 Wed, 07 Aug 2024 22:24:59 -0700 (PDT)
Received: from pro2.fritz.box (p4fe3a254.dip0.t-ipconnect.de. [79.227.162.84])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a7dc9bc3d77sm695741066b.43.2024.08.07.22.24.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 07 Aug 2024 22:24:59 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <m21q318pl7.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llman?=
 =?utf-8?Q?n=22's?= message of "Tue, 06 Aug 2024 20:37:40 +0200")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
 <m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN>
 <m21q318pl7.fsf@HIDDEN>
Date: Thu, 08 Aug 2024 07:24:57 +0200
Message-ID: <m234nfd1sm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>> Cc: 72496 <at> debbugs.gnu.org
>>> Date: Tue, 06 Aug 2024 18:36:39 +0200
>>>=20
>>> I've tried this
>>>=20
>>>   (when (fboundp 'ns-app-stop)
>>>     (defun sigusr1-handler ()
>>>       (interactive)
>>>       (message "SIGUSR1 - stop event loop")
>>>       (ns-app-stop))
>>>     (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
>>>=20
>>> where ns-app-stop does such a ns_send_appdefined, but that didn't work
>>> for a reason unknown to me.
>>
>> Maybe the way SIGUSR1 is handled involves the same event queue that is
>> botched in this scenario?
>
> Yes, that's quite likely. I had a little hope that a signal would maybe
> handled in some special way, but apparently not.

I'm now running locally with the attached change. This removes the
global variable that can prevent sending app-defined events when set
wrong. Instead, I'm using [NSApplication nextEventMatchingMask] to check
if an app-defined event has already been posted. This is infinelty less
dangerous.

Let's see if that is the problem.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-NS-Send-application-defined-event-differently-bug-72.patch
Content-Description: nsterm.m patch

From f48aafd73c7d2694bf2c9e980e9624bde9ab3b3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd@HIDDEN>
Date: Thu, 8 Aug 2024 06:57:21 +0200
Subject: [PATCH] NS: Send application-defined event differently (bug#72496)

* src/nsterm.m (send_appdefined): Global variable removed, all uses
removed.
(ns_send_appdefined): Check if an application-defined event is already
queued with [NSApplicaton nextEventMatching]. Post an event if not.
---
 src/nsterm.m | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 5588425686b..594f7ba974b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -309,7 +309,6 @@ - (unsigned long)unsignedLong
 #endif
 
 /* event loop */
-static BOOL send_appdefined = YES;
 #define NO_APPDEFINED_DATA (-8)
 static int last_appdefined_event_data = NO_APPDEFINED_DATA;
 static NSTimer *timed_entry = 0;
@@ -507,7 +506,6 @@ - (unsigned long)unsignedLong
   hold_event_q.q[hold_event_q.nr++] = *event;
   /* Make sure ns_read_socket is called, i.e. we have input.  */
   raise (SIGIO);
-  send_appdefined = YES;
 }
 
 static Lisp_Object
@@ -4689,13 +4687,17 @@ Function modeled after x_draw_glyph_string_box ().
   /* Only post this event if we haven't already posted one.  This will end
      the [NXApp run] main loop after having processed all events queued at
      this moment.  */
-  if (send_appdefined || value == -42)
+
+  NSEvent *app_defined_event =
+    [NSApp nextEventMatchingMask: NSEventMaskApplicationDefined
+		       untilDate: nil
+			  inMode: NSDefaultRunLoopMode
+			 dequeue: NO];
+
+  if (app_defined_event == nil)
     {
       NSEvent *nxev;
 
-      /* We only need one NX_APPDEFINED event to stop NXApp from running.  */
-      send_appdefined = NO;
-
       /* Don't need wakeup timer any more.  */
       if (timed_entry)
         {
@@ -4812,7 +4814,6 @@ Function modeled after x_draw_glyph_string_box ().
         {
           /* Run and wait for events.  We must always send one NX_APPDEFINED event
              to ourself, otherwise [NXApp run] will never exit.  */
-          send_appdefined = YES;
           ns_send_appdefined (-1);
 
           [NSApp run];
@@ -4907,7 +4908,6 @@ Function modeled after x_draw_glyph_string_box ().
   // outerpool = [[NSAutoreleasePool alloc] init];
 
 
-  send_appdefined = YES;
   if (nr > 0)
     {
       pthread_mutex_lock (&select_mutex);
@@ -4951,7 +4951,6 @@ Function modeled after x_draw_glyph_string_box ().
   else /* No timeout and no file descriptors, can this happen?  */
     {
       /* Send appdefined so we exit from the loop.  */
-      ns_send_appdefined (-1);
     }
 
   block_input ();
@@ -6051,10 +6050,6 @@ - (void)sendEvent: (NSEvent *)theEvent
           last_appdefined_event_data = [theEvent data1];
           [self stop: self];
         }
-      else
-        {
-          send_appdefined = YES;
-        }
     }
 
 
@@ -7727,7 +7722,7 @@ - (void)mouseMoved: (NSEvent *)e
                       help_echo_object, help_echo_pos);
     }
 
-  if ((*emacsframe)->mouse_moved && send_appdefined)
+  if ((*emacsframe)->mouse_moved)
     ns_send_appdefined (-1);
 }
 
@@ -8336,8 +8331,7 @@ - (void)windowDidExpose: sender
   SET_FRAME_VISIBLE (*emacsframe, 1);
   SET_FRAME_GARBAGED (*emacsframe);
 
-  if (send_appdefined)
-    ns_send_appdefined (-1);
+  ns_send_appdefined (-1);
 }
 
 
-- 
2.46.0


--=-=-=--




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

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


Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 18:39:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 14:39:17 2024
Received: from localhost ([127.0.0.1]:33044 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbP5Z-0006Jk-3L
	for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:39:17 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:50324)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1sbP5U-0006JR-Q8
 for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:39:15 -0400
Received: by mail-ed1-f53.google.com with SMTP id
 4fb4d7f45d1cf-5b3fff87e6bso1216753a12.0
 for <72496 <at> debbugs.gnu.org>; Tue, 06 Aug 2024 11:38:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1722969462; x=1723574262; 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=xINGUaLMcQ8TqD+ytEO6FVNj7OZTv+xhP/CYU54Hxf8=;
 b=YrRVDP1ZsQb9oC8Simg2NJEIMSeCwJn9M0n5n5Az6+f96QE4VID3/9THP9QRtdvABI
 zKNfCbhzaz/Xeg8KckzmCkcFYjkrjeX+bG3E+7a7B5FWrpkA79vPMh6Ed9ma6ndx1doB
 z1UQWcyuV42K1zeh3DTR7mLstC7089Ht4Afd6YIk6narpcYp+m0kyzgJ8loEgJRGnEjn
 Wa7Glg2l9QDiClM5Y9lCVd6vRgmqAo7ynS8FydJUwKXiAmbBshGKQlBArAzseF47M9DK
 FZBV4wKvidik4r+p9uHsOPBkyOHawQD5eEQpSQWY3WshqK7FEnZV6KQ02JWWV05DEnkt
 axUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1722969462; x=1723574262;
 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=xINGUaLMcQ8TqD+ytEO6FVNj7OZTv+xhP/CYU54Hxf8=;
 b=YTpa7vd8GA6o4n+qRe31GLx6sQ/+iG6E9oHgviWcNV/Fuk8s920BNWSk6P14c/RBXO
 UQ6oGsZR0Fls6XTuDl1QQQEFR0NbxJy6Jn2yzRN2LWE7T+DjcG1SRTEaVtlq80x+/CQg
 LYHfX2v86hUqq0CwDGFc0PX8h+ExIG9/lq+WQRINT2SmqLtW69f0Wn96osK/yLf09PE1
 XvtdMpbAPfaZro/Hh3NqOtNvJk9gowI3IiCtFyMtK+RXP+i9IQCiGDIzKcIgYYtQ/K3r
 gv8vblrrYG6yBaucsyU0+ePZ2vBY/omCWfOaoXZZQtO7WgRVA0DwGrPU7r+S+r9LGkbA
 oBnw==
X-Gm-Message-State: AOJu0YzjVfB63KGqdWLKEvyJ2Gbl/79qmrwAXQQWxJOZWsfwwldm+ocq
 e3ry94P4w8so5s9fmHHYgAKabDvEoET3fclKuocWLqMPW0XkZTx8XGv04A==
X-Google-Smtp-Source: AGHT+IG3/UH7vUu6ESYbPVDvJFpuCPuOLRztSgLFhKtY+/Sj7xlp4J3bcrAx+WB2f7aiKqAwvr5XJQ==
X-Received: by 2002:a05:6402:a42:b0:5a2:cc1c:4cf0 with SMTP id
 4fb4d7f45d1cf-5b7f36f59ffmr11135474a12.7.1722969462070; 
 Tue, 06 Aug 2024 11:37:42 -0700 (PDT)
Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de.
 [217.227.111.193]) by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5b83a03b403sm6306992a12.42.2024.08.06.11.37.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 06 Aug 2024 11:37:41 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <86wmkto7dh.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 06 Aug
 2024 21:04:26 +0300")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
 <m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN>
Date: Tue, 06 Aug 2024 20:37:40 +0200
Message-ID: <m21q318pl7.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: 72496
Cc: 72496 <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:

>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> Cc: 72496 <at> debbugs.gnu.org
>> Date: Tue, 06 Aug 2024 18:36:39 +0200
>>=20
>> I've tried this
>>=20
>>   (when (fboundp 'ns-app-stop)
>>     (defun sigusr1-handler ()
>>       (interactive)
>>       (message "SIGUSR1 - stop event loop")
>>       (ns-app-stop))
>>     (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
>>=20
>> where ns-app-stop does such a ns_send_appdefined, but that didn't work
>> for a reason unknown to me.
>
> Maybe the way SIGUSR1 is handled involves the same event queue that is
> botched in this scenario?

Yes, that's quite likely. I had a little hope that a signal would maybe
handled in some special way, but apparently not.




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

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


Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 18:04:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 14:04:59 2024
Received: from localhost ([127.0.0.1]:33005 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbOYN-0005R8-J4
	for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:04:59 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34282)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sbOYL-0005Qt-RZ
 for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:04:58 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sbOXs-00021F-Ax; Tue, 06 Aug 2024 14:04:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=sFfsOb1zLcaZBQPB2p/On2+Ih/rlwgJpFB0Psusg074=; b=AMMS8HYtsWn+/q2Mporj
 oO0gRwpw4CzlgKjiTywA4tehSstNBuEHng+xNXrogyz6HMwH/5EESy/fTpe74ADo2NVudTfeuDL9F
 M2mvzdXN9p2dgIRJ2boOg8V50fVvj4K3EfaEx8C/JMzb6m+szGpFJ/7IXRWe1NlTpf4UtgE6Zbqvn
 CrTg8vLhpJD3bA21g1+x5vFTGT8SuXEO2vvqEK+xtEguHC8wtnKHzm5PVlbvtgeeBxcWGKivINq8A
 g4SY9lagUzWxmoJK4dGsNLtQFCjFEIDJtnfnAXY+ROCnDHdNgkO1ESjGQCn4dXhJUBD7IU1QIDwuo
 owohNXa3HfXxog==;
Date: Tue, 06 Aug 2024 21:04:26 +0300
Message-Id: <86wmkto7dh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <m25xsd8v6w.fsf@HIDDEN> (message from Gerd
 =?utf-8?Q?M=C3=B6llmann?= on Tue, 06 Aug 2024 18:36:39 +0200)
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
 <m25xsd8v6w.fsf@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: 72496
Cc: 72496 <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: Gerd Möllmann <gerd.moellmann@HIDDEN>
> Cc: 72496 <at> debbugs.gnu.org
> Date: Tue, 06 Aug 2024 18:36:39 +0200
> 
> I've tried this
> 
>   (when (fboundp 'ns-app-stop)
>     (defun sigusr1-handler ()
>       (interactive)
>       (message "SIGUSR1 - stop event loop")
>       (ns-app-stop))
>     (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
> 
> where ns-app-stop does such a ns_send_appdefined, but that didn't work
> for a reason unknown to me.

Maybe the way SIGUSR1 is handled involves the same event queue that is
botched in this scenario?




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

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


Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 16:38:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 12:38:13 2024
Received: from localhost ([127.0.0.1]:32960 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbNCP-0003Ew-Ju
	for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 12:38:13 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:50220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1sbNCN-0003Ef-Gu
 for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 12:38:12 -0400
Received: by mail-ed1-f53.google.com with SMTP id
 4fb4d7f45d1cf-5b3fff87e6bso1073436a12.0
 for <72496 <at> debbugs.gnu.org>; Tue, 06 Aug 2024 09:37:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1722962201; x=1723567001; 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=8p7C8fry4RtiXoa8uOO6Jaa6Z9VFPnx2BMNPYPWvZjY=;
 b=YczBWpYar76OJ9OH4/AbIRNL3BesRTF6m4Lq8OCnej7NOY/O6Bv2csEmp2PfiTcML2
 LkXPPe1mkAJFWbR6955e1f6buskYpv4fQtfxOWiGoeTjzoOlVzg/J6MxyyzX/B8NCpDN
 I1OFFeepdcCMZgNV452wG7GLUeyI8cj4NXu/Pu4nnEymma4n5wSiDQR6KkQdTTwPiP/G
 1QaGZN+sDAqlAFto/PdacYsScWB55t4W8SS4XnU1ucRM86PbeQN1M9N1JSsSAgq1r5T7
 fExVRlovtl4rwnXEuVtO47tcm98MQgVub/NCrJsr2L+/GZmuNVeb40snCkxNM5Id4pix
 ucsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1722962201; x=1723567001;
 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=8p7C8fry4RtiXoa8uOO6Jaa6Z9VFPnx2BMNPYPWvZjY=;
 b=R0XVyO8W6VB4TxC2CG5iwq+LlWd06bU8qO746/iq/pmybzg1Tb/ZnQJXTNOUoG+FPi
 VBamnWaeL7H/eARZIhMNsKLm9VnTE91Ep7JKvXw24rx3XXJHISsNZaPGidrFpU7y0GlE
 ImsatZ1Xx39ZGnZojezqb9SAC4Akr3IRJhQApyEFyZUH4rBT0/sShc9hQ68dzhIhDLyz
 avf3F9GOkPmDHkEjbUcKmWpAhrSaq6KtyvuYTxxM7VsOfPwXDN9C8CtGMJmzN4E1Jk2u
 7JrBHQNRkgSB7Q1VoPkFW7St6NoThXGM6e7hUyb+qiqlQLpj3F/MfKzc5VOYd8Qt6lrA
 Gaew==
X-Gm-Message-State: AOJu0YzxzUOzHVFIUiC1j1iYUxl6Pa50sTBe8NGH/4YHeiTt71sreD+4
 ocixFNDQACrJVjkV4pxIGuC0P83WCYMV+NJQn60EvxbnJ2WvX/XXHd83Sg==
X-Google-Smtp-Source: AGHT+IHjimZRJ6gFNDVsVNTmxBsTOYZWT3XBtrcad2HIVXfyK3U+eQG64j615PYZmo5WFuvem75Rpw==
X-Received: by 2002:a05:6402:60f:b0:5a3:a9f8:cf20 with SMTP id
 4fb4d7f45d1cf-5b7f58eb70dmr10883623a12.34.1722962200850; 
 Tue, 06 Aug 2024 09:36:40 -0700 (PDT)
Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de.
 [217.227.111.193]) by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5b839708c56sm6129786a12.2.2024.08.06.09.36.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 06 Aug 2024 09:36:40 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <865xsdpusi.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 06 Aug
 2024 17:53:17 +0300")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
Date: Tue, 06 Aug 2024 18:36:39 +0200
Message-ID: <m25xsd8v6w.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: 72496
Cc: 72496 <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:

>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> Date: Tue, 06 Aug 2024 15:39:43 +0200
>>=20
>> We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
>> there, we post special application-defined events to the application
>> which [NSApplication run] processes and dispatches via sendEvent which
>> calls stop and makes [NSApplication run] return to its caller.
>
> Is there any way to initiate posting that "special application-defined
> event" when Emacs is stuck thusly?  For example, from some system
> signal-like event, or from a debugger?  Then you at least would have a
> fire escape.

Running under LLDB I can do something, with a little code change in
ns_send_appdefined.

  (lldb) expr ns_send_appdefined(-42)

where I let -42 force posting an event, ignoring the global variable I
mentioned, send_appdefined, that prevents the posting. Sometimes I have
to do that twice before Emacs receives key strokes again. And it seems
something is also broken afterwards, for example the cursor stops
blinking, tooltips don't work and such things. But at least one can save
buffers and exit.

I've tried this

  (when (fboundp 'ns-app-stop)
    (defun sigusr1-handler ()
      (interactive)
      (message "SIGUSR1 - stop event loop")
      (ns-app-stop))
    (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))

where ns-app-stop does such a ns_send_appdefined, but that didn't work
for a reason unknown to me. I also tried to do that in the signal
handler directly, but couldn't make it work either.

BTW, there are also freezes with beach ball, where the situation seems
to be reversed, i.e. for some reason [NSApplication run] seems to no
longer processing events, hence the beach ball. I haven't event a theory
what that could oossibly be caused by.




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

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


Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 14:53:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 10:53:52 2024
Received: from localhost ([127.0.0.1]:32859 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbLZP-0008GT-Qg
	for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 10:53:52 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45806)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sbLZN-0008GB-NL
 for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 10:53:50 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sbLYu-0001KA-01; Tue, 06 Aug 2024 10:53:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=BfdCdrGQgFJc3iNgM6NKNM9ZdyRDaSHeihHBfAgXqPk=; b=ddt7/lHprKaJYjE8R9os
 Gfm6roR8+N0ipL5wujnBeWmXDe6DzOYvQ01Xb/aDRArjS57IABflg5FpH49YQteXCwRWAzL6cgBWQ
 4AWzLgN4cWR6dkbjEO1pvhtqSxmmI5OzpZ+k2lWDliCsE9jpkBKD7P2W992W43CjgeYiQFx1oswdv
 QoyWeaptclPyxbF8vMl4NFDpNeUkxrpUr6tlNBV6+zImlR3T6bkQUq7qoJernCtiZIu8FcoPby0Ga
 cFun5ZM7Z5AD/vB9jtX5/G35kd5FcDFTTq12e8cpmgAxHVlNv0piDJ6r0gj+BGttU07v75rrwMKJM
 CtKZp8CFTLYHig==;
Date: Tue, 06 Aug 2024 17:53:17 +0300
Message-Id: <865xsdpusi.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
In-Reply-To: <m2ikwd6a8w.fsf@HIDDEN> (message from Gerd
 =?utf-8?Q?M=C3=B6llmann?= on Tue, 06 Aug 2024 15:39:43 +0200)
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
References: <m2ikwd6a8w.fsf@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: 72496
Cc: 72496 <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: Gerd Möllmann <gerd.moellmann@HIDDEN>
> Date: Tue, 06 Aug 2024 15:39:43 +0200
> 
> We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
> there, we post special application-defined events to the application
> which [NSApplication run] processes and dispatches via sendEvent which
> calls stop and makes [NSApplication run] return to its caller.

Is there any way to initiate posting that "special application-defined
event" when Emacs is stuck thusly?  For example, from some system
signal-like event, or from a debugger?  Then you at least would have a
fire escape.




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

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


Received: (at submit) by debbugs.gnu.org; 6 Aug 2024 13:40:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 09:40:17 2024
Received: from localhost ([127.0.0.1]:60464 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sbKQC-0005pI-JA
	for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 09:40:16 -0400
Received: from lists.gnu.org ([209.51.188.17]:55782)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1sbKQA-0005p3-2G
 for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 09:40:14 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1sbKPl-0000RX-PZ
 for bug-gnu-emacs@HIDDEN; Tue, 06 Aug 2024 09:39:49 -0400
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <gerd.moellmann@HIDDEN>)
 id 1sbKPk-00076y-0J
 for bug-gnu-emacs@HIDDEN; Tue, 06 Aug 2024 09:39:49 -0400
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-5af326eddb2so10782544a12.1
 for <bug-gnu-emacs@HIDDEN>; Tue, 06 Aug 2024 06:39:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1722951586; x=1723556386; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=yT8IysYloHTeukmTnWln9jS23IlXFQO4Vcw4j26/ZfE=;
 b=GtevZgLW4ODXrrq9FYL+GGXY7sv/ap37l2uz+eUPaTQAXthc3uIqzgEamx3UxqSxe3
 0bVcKjZDuBSqhL0wNgxWrxRD1GFKpgpsTirzo6sNKln30fWwkzBibRZXMPXWx+BDHRNf
 jY8Ypmet5X02i8iSNnoCx7U1yLUgkX3+KEbqYNVabROG9xFgimDHRtr1ghwqVcdBJTLQ
 YjLouvL0cplbvqwPVg4664KPNSzXQ4Sf20JANJaLUydt7zvQpgzRyJrX964VvfleN3O8
 ft2JjW/FQ166PLZ7mTkHvJsjzGMgWONbqB4rXDTI0R0kSCnDP4Y4dkrHfrAf+6X+WVrk
 Vf2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1722951586; x=1723556386;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=yT8IysYloHTeukmTnWln9jS23IlXFQO4Vcw4j26/ZfE=;
 b=izqlmY7+6IR+jZjcsZTO0rbHZy10pdGKCn1Ao40WCCJlJKfY49ifsw4x5TI2OAv+2c
 z8ylMw5tYGd3wvIAsqorA2/gVraHlKCupkKYpdEaSO5r9ovbTw32rH5PwA3fygZm0ow6
 hJiIgj7yuFM36cruyEkV5s5TM4AEnUf19JvtC3VvbrYvWnzFuoXUGeWIwFCoePDb5CJy
 hp0zdbVTQIns6Njq11fkLDdXpMVGthp0KOgQwci/EBVaiWste9eQSoDpSCL3OFBLgjxw
 JajgJQ934pSNR7s7QjFgwmUQ6WBIfppzl3ga82/eLxURB4ABVEbYyaAv7POotJoTowln
 KIYA==
X-Gm-Message-State: AOJu0YzQoTseE/6n/2s3y3IFXU9ElTwBzqqr3i3j3RlWYaLzTrVniNJL
 hN18BZUM6O7mNUVmOOLj+yi0iglxD6qdIG1rd85P4FlHYeUoy8n+Qf80ew==
X-Google-Smtp-Source: AGHT+IGGXTFrXX3bN9CwYAv7M+rnV60KgMlS1iFa5i1jxy5EI9FRCQRnobepui2+mm4EECfkuTRhvw==
X-Received: by 2002:a05:6402:354c:b0:582:7394:a83d with SMTP id
 4fb4d7f45d1cf-5b77da8e2f9mr14543490a12.12.1722951585220; 
 Tue, 06 Aug 2024 06:39:45 -0700 (PDT)
Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de.
 [217.227.111.193]) by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-5bb87ea2a79sm2761972a12.35.2024.08.06.06.39.44
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 06 Aug 2024 06:39:44 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; macOS: freezes without beach ball
X-Debbugs-Cc: 
Date: Tue, 06 Aug 2024 15:39:43 +0200
Message-ID: <m2ikwd6a8w.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::535;
 envelope-from=gerd.moellmann@HIDDEN; helo=mail-ed1-x535.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.3 (-)
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: -2.3 (--)

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.6.0, NS
 appkit-2487.70 Version 14.6 (Build 23G80)) of 2024-08-05 built on
 pro2.fritz.box
Repository revision: c7d9cd722e5a7042a52c92f8497f903bfe9870b8

This is one of the problems on macOS that I'm experiencing quite
often. I have no idea what is causing this, and I haven't found a way
to make it reproducible. I guess I should file a bug report anyway.

Let me first try to describe briefly how NS GUI event handling works
in Emacs.

The whole story starts with get_input_pending which calls gobble_input
which calls a terminal's read_socket_hook, which is ns_read_socket in
macOS. ns_read_socket calls [NSApplication run] to process macOS GUI
events.

The problem starts with [NSApplication run] being an endless loop that
gets the next event, and dispatches it by calling the application's
sendEvent method. The only way to make the run loop terminate is by
calling [NSApplication stop]. This sets a flag that [NSApplicatoin
run] is supposed to check and then return, so that we eventually
return to ns_read_socket.

We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
there, we post special application-defined events to the application
which [NSApplication run] processes and dispatches via sendEvent which
calls stop and makes [NSApplication run] return to its caller. Note
that stop only sets a flag, so we need to process another event to
make run terminate. That's at least my understanding.

We are posting these events all over the place, not only before
ns_read_socket calls [NSApplication run]. And, to complicate matters,
whether or not ns_send_appdefined actually posts an event depends on a
global boolean variable. IOW, it's impenetrable.

(I'm also leaving out the generation of input_events for Emacs here,
which is another can of worms.)

Problem is that this not always works. More specifically, this code in
ns_read_socket_1

          /* Run and wait for events.  We must always send one NX_APPDEFINED event
             to ourself, otherwise [NXApp run] will never exit.  */
          send_appdefined = YES;
          ns_send_appdefined (-1);

          [NSApp run];

gets stuck in the GUI event loop, and the last line never returns. The
effect being that Emacs freezes without a beach ball of death. It
processes Cocoa events but Emacs never sees any input_events.




Acknowledgement sent to Gerd Möllmann <gerd.moellmann@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#72496; 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.