Subject: Re: bug#34762: Acknowledgement (26.1.92; objc[27300]: Invalid or prematurely-freed autorelease pool 0x1040021e0.)

From: Fan Yang <[email-masked]>
Date: Mon, 16 Dec 2019 15:37:40 +0800

I met this bug too.  I triggered this bug when I was clicking an YASnippet menu while editing a remove (TRAMP) file via scp.

Information:

- Emacs: at commit 9ee5af315098245d9f58eb5562dca6997cab4426 Dec 14, 2019.  Built by “./configure CPPFLAGS="-I/usr/local/opt/libxml2/include/libxml2/" LDFLAGS="-L/usr/local/opt/libxml2/lib" --with-ns && make && make install”
- macOS Catalina 10.15.2

Backtrace:

(lldb) target create "/Applications/Emacs.app/Contents/MacOS/Emacs"
Current executable set to '/Applications/Emacs.app/Contents/MacOS/Emacs' (x86_64).
(lldb) r
Process 3309 launched: '/Applications/Emacs.app/Contents/MacOS/Emacs' (x86_64)
2019-12-16 15:16:31.392937+0800 Emacs[3309:113095] Failed to initialize color list unarchiver: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver}
2019-12-16 15:16:31.405997+0800 Emacs[3309:113095] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=3309
2019-12-16 15:16:31.406126+0800 Emacs[3309:113095] SecTaskCopyDebugDescription: Emacs[3309]/0#-1 LF=0
objc[3309]: Invalid or prematurely-freed autorelease pool 0x1020031e0.
Process 3309 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff67bb0bea libsystem_kernel.dylib`__abort_with_payload + 10
libsystem_kernel.dylib`__abort_with_payload:
->  0x7fff67bb0bea <+10>: jae    0x7fff67bb0bf4            ; <+20>
    0x7fff67bb0bec <+12>: movq   %rax, %rdi
    0x7fff67bb0bef <+15>: jmp    0x7fff67b91a89            ; cerror_nocancel
    0x7fff67bb0bf4 <+20>: retq   
Target 0: (Emacs) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff67bb0bea libsystem_kernel.dylib`__abort_with_payload + 10
    frame #1: 0x00007fff67bb24f3 libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 80
    frame #2: 0x00007fff67bb24a3 libsystem_kernel.dylib`abort_with_reason + 19
    frame #3: 0x00007fff666f2c1b libobjc.A.dylib`_objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 114
    frame #4: 0x00007fff666f2ba9 libobjc.A.dylib`_objc_fatal(char const*, ...) + 135
    frame #5: 0x00007fff666f3741 libobjc.A.dylib`AutoreleasePoolPage::badPop(void*) + 139
    frame #6: 0x00007fff303b2eb5 CoreFoundation`_CFAutoreleasePoolPop + 22
    frame #7: 0x00007fff32a54e95 Foundation`-[NSAutoreleasePool release] + 129
    frame #8: 0x00000001001e984e Emacs`ns_update_menubar(f=0x0000000102834030, deep_p=<unavailable>, submenu=0x0000000000000000) at nsmenu.m:0 [opt]
    frame #9: 0x00000001001e988e Emacs`ns_activate_menubar(f=<unavailable>) at nsmenu.m:476:3 [opt]
    frame #10: 0x00000001000c7c3e Emacs`read_char at keyboard.c:3910:6 [opt]
    frame #11: 0x00000001000c7500 Emacs`read_char [inlined] read_event_from_main_queue(end_time=0x0000000000000000, local_getcjmp=0x0000000103a154a0, used_mouse_menu=0x00007ffeefbff47b) at keyboard.c:2151 [opt]
    frame #12: 0x00000001000c73de Emacs`read_char at keyboard.c:2215 [opt]
    frame #13: 0x00000001000c73de Emacs`read_char(commandflag=1, map=0x0000000102aa65a3, prev_event=0x0000000000000000, used_mouse_menu=0x00007ffeefbff47b, end_time=0x0000000000000000) at keyboard.c:2825 [opt]
    frame #14: 0x00000001000c3e1a Emacs`read_key_sequence(keybuf=<unavailable>, prompt=0x0000000000000000, dont_downcase_last=<unavailable>, can_return_switch_frame=<unavailable>, fix_current_buffer=<unavailable>, prevent_redisplay=<unavailable>) at keyboard.c:9536:12 [opt]
    frame #15: 0x00000001000c261c Emacs`command_loop_1 at keyboard.c:1345:15 [opt]
    frame #16: 0x00000001001493b7 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:1355:25 [opt]
    frame #17: 0x00000001000d26d0 Emacs`command_loop_2(ignore=<unavailable>) at keyboard.c:1091:11 [opt]
    frame #18: 0x0000000100148bcb Emacs`internal_catch(tag=0x000000000000c4b0, func=(Emacs`command_loop_2 at keyboard.c:1087), arg=0x0000000000000000) at eval.c:1116:25 [opt]
    frame #19: 0x00000001002071d5 Emacs`command_loop.cold.1 + 69
    frame #20: 0x00000001000c1703 Emacs`command_loop at keyboard.c:1069:2 [opt]
    frame #21: 0x00000001000c1633 Emacs`recursive_edit_1 at keyboard.c:714:9 [opt]
    frame #22: 0x00000001000c188b Emacs`Frecursive_edit at keyboard.c:786:3 [opt]
    frame #23: 0x00000001000c046c Emacs`main(argc=<unavailable>, argv=0x00007ffeefbff918) at emacs.c:2054:3 [opt]
    frame #24: 0x00007fff67a507fd libdyld.dylib`start + 1
    frame #25: 0x00007fff67a507fd libdyld.dylib`start + 1