From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Clemente Newsgroups: gmane.emacs.bugs Subject: bug#71223: 30.0.50; stack overflow after very fast opening and closing of frames Date: Thu, 30 May 2024 11:22:00 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27396"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier To: 71223@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 30 13:24:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sCdtM-0006xX-CH for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 May 2024 13:24:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdsw-0006B7-RY; Thu, 30 May 2024 07:23:54 -0400 Original-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 ) id 1sCdsv-000640-AI for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:23:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCdsv-0002lF-1R for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:23:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sCdt4-0006p4-2L for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Clemente Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 May 2024 11:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71223 X-GNU-PR-Package: emacs Original-Received: via spool by 71223-submit@debbugs.gnu.org id=B71223.171706822826195 (code B ref 71223); Thu, 30 May 2024 11:24:02 +0000 Original-Received: (at 71223) by debbugs.gnu.org; 30 May 2024 11:23:48 +0000 Original-Received: from localhost ([127.0.0.1]:58678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCdsq-0006oP-5T for submit@debbugs.gnu.org; Thu, 30 May 2024 07:23:48 -0400 Original-Received: from mail-ua1-f46.google.com ([209.85.222.46]:59700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCdsn-0006o8-Vo for 71223@debbugs.gnu.org; Thu, 30 May 2024 07:23:46 -0400 Original-Received: by mail-ua1-f46.google.com with SMTP id a1e0cc1a2514c-80ac43b7b4bso240961241.3 for <71223@debbugs.gnu.org>; Thu, 30 May 2024 04:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717068150; x=1717672950; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jJ1Y5MZrC0zLzUpN0EHxO9NX07qzyJfiM7uERRRnoJE=; b=nYMG4LW4Cd0u5n23QxZGRHWOxZBiH5kq3tTCtjQQlC3KWdL9Ke1Rbk613/H7R8GJJD CCFf5NDo5ZeYdnapyn/PRpoCj7NvaqEFvQmOCwDC9oAnF+R+QecNepUrHpC1FwHfq9gM z2f15Dk7Als8z8cZZHL/RZwxpb+LTqx+Cagr54M76/PjAYnZrOR93G7IKZ5tzFfLCt3v ZL/6sM87R499nkJ+MX0bprL38s8kjNdJ9TMaEpRW6TMbsTJ8A6E0Qh1DZFjB5xmzJpqQ FrPqBPJgalHXv4dA7DwAtm6xDGK6usQCUViiyi5n8Id6Iw1H9pAcPCDAmKut1G9U4Vfc NPGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717068150; x=1717672950; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jJ1Y5MZrC0zLzUpN0EHxO9NX07qzyJfiM7uERRRnoJE=; b=co651vEE3ty4P7hywOTvsrKS7wdn4VknEohSvh+gvZ5J9zjQQhUIUEmRu/JWyEer2x kJqlLVvo40pehPQTHCAYzn4EIYh+JaM9oLBs/xcWU6SIAwzh9kGznJsCRdLEarVDFqW6 x9faCWSTU3WTRXjTX7ugAWftkbL/InDgrTJwdirENbQkYtDQBkgJp9k66fdxfPaezX4u u2bm/XJ8RfsZloUxpNhMndv5KHQsx4lfnByPzxGscDQXcq1Ft+lZFmZ7M4vuqNu3HPWW 4Va78gLzQDJFnCiLj5TZGCAbgwOK+zI4xKjcJ/PBXt33DkD6fFFiBP77ckW+Mjtbb+/M FNeA== X-Gm-Message-State: AOJu0YwGqyNowpHYsTajE42Mc6kaXsGcNbWWFLVDHWJlHyWSCV8r+CBf Y7/BOVGxzPQU/3h6ABbYaH3NFjDurUmIAL6sEkatvFRH4xDy7W9vuAH/qb1EYqkUMuGrj7Uisr9 IMgnTaDdbQOtv29kSAne+nzaA+JYbZhFd X-Google-Smtp-Source: AGHT+IGt2uFTgyPHvM+o8Ga2Ybp9wQrCII+T4HsgdKG7tfbC9zLBDIb7g6ZN1qv4BtHb6VVCHUAWbYybiTJ1FJK1Mik= X-Received: by 2002:a05:6102:19da:b0:48a:3061:3e52 with SMTP id ada2fe7eead31-48baea1583amr2292623137.15.1717068149639; Thu, 30 May 2024 04:22:29 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286214 Archived-At: > Here's a new version of the patch which fixes various shortcomings > I noticed while trying it out. Also it shortens the wait times after Running with d9512da4951 (same as last time, though I enable glyph debug), and only with this patch. It seems faster. Messages appear instantly, new frames don't get stuck. Everything works. Most importantly, it doesn't overflow the Lisp stack. Immediately after having opened+closed thousands of frames, I stopped the process and the stack is small. Opening and closing new frames still works instantly they work. Even if I adjust the stress test timings to open+close frame faster (e.g. sleep 0.5 instead of sleep 1), Emacs does it (slowly, because of my -O0 build) and they work. My window manager crashed in the process! (too many windows), but Emacs didn't. The stack is later ok. I did another experiment which I couldn't do before: 20 minutes opening+closing frames: for j in `seq 1200`; do for i in `seq 10`; do urxvt -e emacsclient '-nw' '-e' '(dired "~")' &; done; sleep 1 && killall emacsclient; done It didn't hang or crash and I can use emacs normally after that. Thanks. This simplifies testing and debugging other bugs which only appear when stressing Emacs (e.g. bug#71176 was like that). Log of a run, below. The error messages, as Stefan mentioned, are because of killing emacsclient, and are not a bug. Though some discussion points remain, about making sure the emacsclient user sees the errors and the terminal is cleaned. By the way, see the 1 instance of: Could not open file: /dev/pts/12 Starting program: /opt/dc/emacs/bin/emacs-30.0.50 --fg-daemon -Q [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Starting Emacs daemon. [Detaching after vfork from child process 4829] [Detaching after vfork from child process 4830] [Detaching after vfork from child process 4831] process server <2> no longer connected to pipe; closed it Process server <3> not running: connection broken by remote peer Process server <4> not running: connection broken by remote peer Process server <5> not running: connection broken by remote peer Process server <6> not running: connection broken by remote peer [=E2=80=A6] Process server <38> not running: connection broken by remote peer Process server <39> not running: connection broken by remote peer Process server <40> not running: connection broken by remote peer process server <41> no longer connected to pipe; closed it process server <42> no longer connected to pipe; closed it process server <43> no longer connected to pipe; closed it process server <44> no longer connected to pipe; closed it process server <45> no longer connected to pipe; closed it process server <46> no longer connected to pipe; closed it process server <47> no longer connected to pipe; closed it Process server <48> not running: connection broken by remote peer Process server <49> not running: connection broken by remote peer [=E2=80=A6] Process server <135> not running: connection broken by remote peer Process server <136> not running: connection broken by remote peer Process server <137> not running: connection broken by remote peer Could not open file: /dev/pts/12 process server <139> no longer connected to pipe; closed it process server <140> no longer connected to pipe; closed it process server <141> no longer connected to pipe; closed it process server <142> no longer connected to pipe; closed it process server <143> no longer connected to pipe; closed it process server <144> no longer connected to pipe; closed it process server <145> no longer connected to pipe; closed it process server <146> no longer connected to pipe; closed it process server <147> no longer connected to pipe; closed it Process server <148> not running: connection broken by remote peer Process server <149> not running: connection broken by remote peer [=E2=80=A6] Process server <2292> not running: connection broken by remote peer Process server <2294> not running: connection broken by remote peer Process server <2293> not running: connection broken by remote peer Process server <2295> not running: connection broken by remote peer ^Z Program received signal SIGTSTP, Stopped (user). pselect64_syscall (sigmask=3D0x0, timeout=3D, exceptfds=3D0x= 0, writefds=3D0x7fffffffd030, readfds=3D0x7fffffffd0b0, nfds=3D11) at ../sysdeps/unix/sysv/linux/pselect.c:34 34 ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory. (gdb) bt #0 pselect64_syscall (sigmask=3D0x0, timeout=3D, exceptfds= =3D0x0, writefds=3D0x7fffffffd030, readfds=3D0x7fffffffd0b0, nfds=3D11) at ../sysdeps/unix/sysv/linux/pselect.c:34 #1 __pselect (nfds=3D11, readfds=3D0x7fffffffd0b0, writefds=3D0x7fffffffd0= 30, exceptfds=3D0x0, timeout=3D, sigmask=3D0x0) at ../sysdeps/unix/sysv/linux/pselect.c:56 #2 0x000055555582c5e8 in really_call_select (arg=3D0x7fffffffcdf0) at thread.c:624 #3 0x000055555572ffb2 in flush_stack_call_func1 ( func=3D0x55555582c54e , arg=3D0x7fffffffcdf0) at alloc.c:5534 #4 0x000055555582b85a in flush_stack_call_func ( func=3D0x55555582c54e , arg=3D0x7fffffffcdf0) at /w/emacs/src/lisp.h:4507 #5 0x000055555582c6a3 in thread_select (func=3D0x7ffff551d980 <__pselect>, max_fds=3D11, rfds=3D0x7fffffffd0b0, wfds=3D0x7fffffffd030, efds=3D0x0, timeout=3D0x7fffffffd010, sigmask=3D0x0) at thread.c:656 #6 0x00005555557ee3e1 in wait_reading_process_output (time_limit=3D30, nse= cs=3D0, read_kbd=3D-1, do_display=3Dtrue, wait_for_cell=3DXIL(0), wait_proc=3D0= x0, just_wait_proc=3D0) at process.c:5752 #7 0x0000555555594eb9 in sit_for (timeout=3Dmake_fixnum(30), reading=3Dtru= e, display_option=3D1) at dispnew.c:6318 #8 0x0000555555695250 in read_char (commandflag=3D1, map=3DXIL(0x7ffff027e= 153), prev_event=3DXIL(0), used_mouse_menu=3D0x7fffffffd6af, end_time=3D0x0) at keyboard.c:2923 #9 0x00005555556a67ff in read_key_sequence (keybuf=3D0x7fffffffd8c0, prompt=3DXIL(0), dont_downcase_last=3Dfalse, can_return_switch_frame=3D= true, fix_current_buffer=3Dtrue, prevent_redisplay=3Dfalse, disable_text_conversion_p=3Dfalse) at keyboard.c:10728 #10 0x0000555555690ee7 in command_loop_1 () at keyboard.c:1429 #11 0x000055555576c6cf in internal_condition_case ( bfun=3D0x555555690ab8 , handlers=3DXIL(0x90), hfun=3D0x55555568ff63 ) at eval.c:1613 #12 0x0000555555690696 in command_loop_2 (handlers=3DXIL(0x90)) at keyboard= .c:1168 #13 0x000055555576bafc in internal_catch (tag=3DXIL(0xfc60), func=3D0x55555569066c , arg=3DXIL(0x90)) at eval.c:1292 #14 0x0000555555690628 in command_loop () at keyboard.c:1146 #15 0x000055555568fa05 in recursive_edit_1 () at keyboard.c:754 #16 0x000055555568fc31 in Frecursive_edit () at keyboard.c:837 #17 0x000055555568b698 in main (argc=3D3, argv=3D0x7fffffffdee8) at emacs.c= :2621 (gdb)