From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.bugs Subject: bug#45658: Infinite loop in run loop on macOS Date: Sat, 9 Jan 2021 23:33:26 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12160"; mail-complaints-to="usenet@ciao.gmane.io" To: Alan Third , Jimmy Yuen Ho Wong , 45658@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 10 00:37:07 2021 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 1kyNn8-00034c-QY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jan 2021 00:37:06 +0100 Original-Received: from localhost ([::1]:42488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyNn7-0005Mo-St for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 18:37:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyNl8-00042F-CK for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:35:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyNl8-00045B-4u for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyNl8-0003Zy-1W for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 18:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jimmy Yuen Ho Wong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jan 2021 23:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45658 X-GNU-PR-Package: emacs Original-Received: via spool by 45658-submit@debbugs.gnu.org id=B45658.161023525413701 (code B ref 45658); Sat, 09 Jan 2021 23:35:01 +0000 Original-Received: (at 45658) by debbugs.gnu.org; 9 Jan 2021 23:34:14 +0000 Original-Received: from localhost ([127.0.0.1]:52740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyNkM-0003Yt-BF for submit@debbugs.gnu.org; Sat, 09 Jan 2021 18:34:14 -0500 Original-Received: from mail-lf1-f45.google.com ([209.85.167.45]:35910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyNkH-0003Yc-8n for 45658@debbugs.gnu.org; Sat, 09 Jan 2021 18:34:12 -0500 Original-Received: by mail-lf1-f45.google.com with SMTP id o13so32107482lfr.3 for <45658@debbugs.gnu.org>; Sat, 09 Jan 2021 15:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=xisfQzdOwccQWzQvmCI1WL4mCXOISbZZM6z27O6wFxk=; b=ISC1z1lnZBWpswneoTZxC/W9X8lZ3l9kWd5J8/1D2tSFP/MBHzgzT+QSSeWwiTumhZ pNA2YBqE+xdeLqJUAHplsAM/3iUC8br4HgWS90ciqhLDFLrXcP3cBjye3WVnqBPAJfSk hPrRw1rdouOWI40gXa5ZSU9rwLGkQaldEtMGZvM2l5DmQGHYmIJmcrsxn4ilTGmM+XKj +/feZ0J/mQmnhJKoqvitrAJ9gORuXkTT0a/brgG+BycJvJg2QtKptWvluGbJlsxX4GDi z7EMZvL2XVoEC0STp5IC/g4VdbX2vhHQaK2eXDyMHxzJs9rHrKmibBy2SwwPnksSobkh GegQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=xisfQzdOwccQWzQvmCI1WL4mCXOISbZZM6z27O6wFxk=; b=TiiiyXEn5Te2pku/hOG5K+GkgdBFFPZtK4LzjSPFsJTl7uIxudHGhSAXOrfWJJAy1l Z5Pwh0XApOBEpbZDrBpAnw2iWHmzoOhJzUfpKAB8AEmI+TRQ466K0ck2xkVmkw0Ult5H z44cMuVksvsmoGUXwE3NVwl3wyo9g6gukFvaVMlV2u5x6HsCvp2ETWcQjUpGLpt2rgTV y+TEA/beFMHHdhLeo3pwnk0KWyJ7RFmw1aA66xXSaS/ksbwT7jYn2UFop/YkbM8oiotJ 06QebyUt3u9Ro9vBWxr6phBsglWnIZ5PTFTSemltOHZQX+BvmNM+sBs1R5xGAejU0jb3 Dd5g== X-Gm-Message-State: AOAM531FTqRFM9vtT0xGB3h8nW2R3gax6t2y8g6F1Y95V8prA4b2vI5E E2tdFTl/qEmkg8vmlZboA1J5oxMIK5vw3YHBN2Y= X-Google-Smtp-Source: ABdhPJwK5sku+NozI8imMayO3TUUZGZGZZiiIf3E/cp4RWp3NRpg4X8HpUJC7bAMa2mwdZWmduXkA6HevrJq4A/UK8Q= X-Received: by 2002:a05:6512:3e6:: with SMTP id n6mr4105616lfq.262.1610235243021; Sat, 09 Jan 2021 15:34:03 -0800 (PST) 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" Xref: news.gmane.io gmane.emacs.bugs:197576 Archived-At: Missed a variable in the last reply (fd_set) fds = { fds_bits = { [0] = 32 [1] = 0 [2] = 0 [3] = 0 [4] = 0 [5] = 0 [6] = 0 [7] = 0 [8] = 0 [9] = 0 [10] = 0 [11] = 0 [12] = 0 [13] = 0 [14] = 0 [15] = 0 [16] = 0 [17] = 0 [18] = 0 [19] = 0 [20] = 0 [21] = 0 [22] = 0 [23] = 0 [24] = 0 [25] = 0 [26] = 0 [27] = 0 [28] = 0 [29] = 0 [30] = 0 [31] = 0 } } Jimmy On Sat, Jan 9, 2021 at 11:21 PM Jimmy Yuen Ho Wong wrote: > > Ok I've just reproduced this again, this time simply by opening a file > in the terminal with emacsclient, in the hope Emacs.app will open it. > I've switched to the thread running fd_handler (nsterm.m:6100:20 > right?) This is the frame variables: > > (EmacsApp *) self = 0x0000000105425d00 > (SEL) _cmd = "fd_handler:" > (id) unused = nil > (int) result = 1 > (int) waiting = 0 > (int) nfds = 31 > (char) c = 'g' > (fd_set) readfds = { > fds_bits = { > [0] = 0 > [1] = 0 > [2] = 0 > [3] = 0 > [4] = 0 > [5] = 0 > [6] = 0 > [7] = 0 > [8] = 0 > [9] = 0 > [10] = 0 > [11] = 0 > [12] = 0 > [13] = 0 > [14] = 0 > [15] = 0 > [16] = 0 > [17] = 0 > [18] = 0 > [19] = 0 > [20] = 0 > [21] = 0 > [22] = 0 > [23] = 0 > [24] = 0 > [25] = 0 > [26] = 0 > [27] = 0 > [28] = 0 > [29] = 0 > [30] = 0 > [31] = 0 > } > } > (fd_set) writefds = { > fds_bits = { > [0] = 0 > [1] = 0 > [2] = 0 > [3] = 0 > [4] = 0 > [5] = 0 > [6] = 0 > [7] = 0 > [8] = 0 > [9] = 0 > [10] = 0 > [11] = 0 > [12] = 0 > [13] = 0 > [14] = 0 > [15] = 0 > [16] = 0 > [17] = 0 > [18] = 0 > [19] = 0 > [20] = 0 > [21] = 0 > [22] = 0 > [23] = 0 > [24] = 0 > [25] = 0 > [26] = 0 > [27] = 0 > [28] = 0 > [29] = 0 > [30] = 0 > [31] = 0 > } > } > (fd_set *) wfds = 0x000070000fbc0c18 > (timespec) timeout = (tv_sec = 4, tv_nsec = 994588000) > (timespec *) tmo = 0x000070000fbc0c00 > (NSAutoreleasePool *) pool = 0x00000001051db650 > > > Jimmy > > On Wed, Jan 6, 2021 at 6:53 PM Alan Third wrote: > > > > On Wed, Jan 06, 2021 at 07:04:37AM +0000, Jimmy Yuen Ho Wong wrote: > > > > Is this still mostly when you switch away from Emacs? > > > > > > Yes. I'm on Catalina and here's my configure flags if that helps: > > > > > > "--disable-silent-rules --prefix=/opt/local --with-ns --with-libgmp > > > --with-json --with-xml2 --with-modules --with-lcms2 --with-rsvg > > > --with-gnutls 'CFLAGS=-pipe -O0 -ggdb3 > > > -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk > > > -arch x86_64' 'CPPFLAGS=-I/opt/local/include > > > -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk' > > > 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie > > > -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk > > > -arch x86_64'" > > > > > > > Can you do "bt all" and send the whole output? > > > > Thanks. I've raised a bug report for this. Unfortunately I can't see > > what's causing this just now... My best guess is that there's a missed > > ns_send_appdefined somewhere. Can you switch to the thread that's > > running fd_handler and see what it's doing? There are only two > > branches, so it should be easy to work out which one is in use. > > > > > (lldb) bt all > > > > > > * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP > > > * frame #0: 0x00007fff6a0ccdfa libsystem_kernel.dylib`mach_msg_trap + 10 > > > frame #1: 0x00007fff6a0cd1fd libsystem_kernel.dylib`mach_msg + 201 > > > frame #2: 0x00007fff2fedbef5 CoreFoundation`__CFRunLoopServiceMachPort + 247 > > > frame #3: 0x00007fff2feda9c2 CoreFoundation`__CFRunLoopRun + 1319 > > > frame #4: 0x00007fff2fed9e3e CoreFoundation`CFRunLoopRunSpecific + 462 > > > frame #5: 0x00007fff2eb06abd HIToolbox`RunCurrentEventLoopInMode + 292 > > > frame #6: 0x00007fff2eb067d5 HIToolbox`ReceiveNextEventCommon + 584 > > > frame #7: 0x00007fff2eb06579 > > > HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64 > > > frame #8: 0x00007fff2d14c039 AppKit`_DPSNextEvent + 883 > > > frame #9: 0x00007fff2d14a880 AppKit`-[NSApplication(NSEvent) > > > _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352 > > > frame #10: 0x00007fff2d13c58e AppKit`-[NSApplication run] + 658 > > > frame #11: 0x000000010036c5fa Emacs`-[EmacsApp > > > run](self=0x000000010525e180, _cmd="run") at nsterm.m:5602:9 > > > frame #12: 0x000000010036a8eb Emacs`ns_select(nfds=30, > > > readfds=0x00007ffeefbfd1f0, writefds=0x00007ffeefbfd170, > > > exceptfds=0x0000000000000000, timeout=0x00007ffeefbfd148, > > > sigmask=0x0000000000000000) at nsterm.m:4690:3 > > > frame #13: 0x00000001002f567a > > > Emacs`wait_reading_process_output(time_limit=10, nsecs=0, read_kbd=-1, > > > do_display=true, wait_for_cell=0x0000000000000000, > > > wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5577:18 > > > frame #14: 0x0000000100010bfe > > > Emacs`sit_for(timeout=0x000000000000002a, reading=true, > > > display_option=1) at dispnew.c:6064:3 > > > frame #15: 0x0000000100173432 Emacs`read_char(commandflag=1, > > > map=0x00000001de6881f3, prev_event=0x0000000000000000, > > > used_mouse_menu=0x00007ffeefbfdddf, end_time=0x0000000000000000) at > > > keyboard.c:2738:11 > > > frame #16: 0x000000010016e569 > > > Emacs`read_key_sequence(keybuf=0x00007ffeefbfe0e0, > > > prompt=0x0000000000000000, dont_downcase_last=false, > > > can_return_switch_frame=true, fix_current_buffer=true, > > > prevent_redisplay=false) at keyboard.c:9554:12 > > > frame #17: 0x000000010016cf89 Emacs`command_loop_1 at keyboard.c:1350:15 > > > frame #18: 0x0000000100269a9f > > > Emacs`internal_condition_case(bfun=(Emacs`command_loop_1 at > > > keyboard.c:1236), handlers=0x0000000000000090, hfun=(Emacs`cmd_error > > > at keyboard.c:919)) at eval.c:1356:25 > > > frame #19: 0x0000000100184cdc > > > Emacs`command_loop_2(ignore=0x0000000000000000) at keyboard.c:1091:11 > > > frame #20: 0x000000010026940a > > > Emacs`internal_catch(tag=0x000000000000c840, > > > func=(Emacs`command_loop_2 at keyboard.c:1087), > > > arg=0x0000000000000000) at eval.c:1117:25 > > > frame #21: 0x000000010016bf1a Emacs`command_loop at keyboard.c:1070:2 > > > frame #22: 0x000000010016bda0 Emacs`recursive_edit_1 at keyboard.c:714:9 > > > frame #23: 0x000000010016c0e9 Emacs`Frecursive_edit at keyboard.c:786:3 > > > frame #24: 0x00000001001695b4 Emacs`main(argc=1, > > > argv=0x00007ffeefbfe690) at emacs.c:2066:3 > > > frame #25: 0x00007fff69f8bcc9 libdyld.dylib`start + 1 > > > thread #4, name = 'gmain' > > > frame #0: 0x00007fff6a0d50fe libsystem_kernel.dylib`__select + 10 > > > frame #1: 0x0000000102045174 libglib-2.0.0.dylib`g_poll + 546 > > > frame #2: 0x0000000102038f63 > > > libglib-2.0.0.dylib`g_main_context_iterate + 340 > > > frame #3: 0x0000000102039011 > > > libglib-2.0.0.dylib`g_main_context_iteration + 55 > > > frame #4: 0x000000010203a0c1 libglib-2.0.0.dylib`glib_worker_main + 30 > > > frame #5: 0x000000010205a844 libglib-2.0.0.dylib`g_thread_proxy + 90 > > > frame #6: 0x00007fff6a190109 libsystem_pthread.dylib`_pthread_start + 148 > > > frame #7: 0x00007fff6a18bb8b libsystem_pthread.dylib`thread_start + 15 > > > thread #7 > > > frame #0: 0x00007fff6a0d187e libsystem_kernel.dylib`__pselect + 10 > > > frame #1: 0x00007fff6a0d179b > > > libsystem_kernel.dylib`pselect$DARWIN_EXTSN + 42 > > > frame #2: 0x000000010036def3 Emacs`-[EmacsApp > > > fd_handler:](self=0x000000010525e180, _cmd="fd_handler:", > > > unused=0x0000000000000000) at nsterm.m:6100:20 > > > frame #3: 0x00007fff3256d7b2 Foundation`__NSThread__start__ + 1064 > > > frame #4: 0x00007fff6a190109 libsystem_pthread.dylib`_pthread_start + 148 > > > frame #5: 0x00007fff6a18bb8b libsystem_pthread.dylib`thread_start + 15 > > > thread #11, name = 'com.apple.NSEventThread' > > > frame #0: 0x00007fff6a0ccdfa libsystem_kernel.dylib`mach_msg_trap + 10 > > > frame #1: 0x00007fff6a0cd170 libsystem_kernel.dylib`mach_msg + 60 > > > frame #2: 0x00007fff2fedbef5 CoreFoundation`__CFRunLoopServiceMachPort + 247 > > > frame #3: 0x00007fff2feda9c2 CoreFoundation`__CFRunLoopRun + 1319 > > > frame #4: 0x00007fff2fed9e3e CoreFoundation`CFRunLoopRunSpecific + 462 > > > frame #5: 0x00007fff2d2ed954 AppKit`_NSEventThread + 132 > > > frame #6: 0x00007fff6a190109 libsystem_pthread.dylib`_pthread_start + 148 > > > frame #7: 0x00007fff6a18bb8b libsystem_pthread.dylib`thread_start + 15 > > > thread #127 > > > frame #0: 0x00007fff6a0ce4ce libsystem_kernel.dylib`__workq_kernreturn + 10 > > > frame #1: 0x00007fff6a18caa1 libsystem_pthread.dylib`_pthread_wqthread + 390 > > > frame #2: 0x00007fff6a18bb77 libsystem_pthread.dylib`start_wqthread + 15 > > > > -- > > Alan Third