From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#36609: 27.0.50; Possible race-condition in threading implementation Date: Fri, 12 Jul 2019 13:40:15 +0000 Message-ID: References: <87muhks3b5.fsf@hochschule-trier.de> <83k1cn2z0l.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="106896"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36609@debbugs.gnu.org, politza@hochschule-trier.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 12 15:56:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hlw1w-000RBU-AS for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 15:56:08 +0200 Original-Received: from localhost ([::1]:49563 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvoP-0003AU-48 for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 09:42:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58254) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvoL-0003AO-BN for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:42:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvoI-000829-Qn for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:42:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlvoI-00081q-LW for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hlvoI-0006QK-F8 for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jul 2019 13:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36609 X-GNU-PR-Package: emacs Original-Received: via spool by 36609-submit@debbugs.gnu.org id=B36609.156293886224621 (code B ref 36609); Fri, 12 Jul 2019 13:42:02 +0000 Original-Received: (at 36609) by debbugs.gnu.org; 12 Jul 2019 13:41:02 +0000 Original-Received: from localhost ([127.0.0.1]:39397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlvnJ-0006Od-5I for submit@debbugs.gnu.org; Fri, 12 Jul 2019 09:41:02 -0400 Original-Received: from mail-oi1-f196.google.com ([209.85.167.196]:34097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlvnG-0006ON-HK for 36609@debbugs.gnu.org; Fri, 12 Jul 2019 09:40:59 -0400 Original-Received: by mail-oi1-f196.google.com with SMTP id l12so7321587oil.1 for <36609@debbugs.gnu.org>; Fri, 12 Jul 2019 06:40:58 -0700 (PDT) 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 :cc; bh=1DEIH5Jv/CWabnOp3GZ/IY4thuBSAYjd8Ue6uf+1xX0=; b=HioYuA5HnZHQYRQ5PWlK/E9sl1eWf1gelBUXgKOgkMMXErsr2HmVkLlzBvyKRPpWDB +82b0sbbXJ2QxNVerWoJS7hy6YntoJ9ClNQjjLEN+SsDlaK/J2TbmjoOtmVtlay5uc/M 8k03keUNc3z0VwvGsz1mYOHRR0Z52gy2WHIuSyrBM6Vmrrh3EQT06ufCd5V0tCIkXP6N Wuw4uhB1iiZVfAK89elqqxRViDOqPB/4szdYINBAHDQisNdn9M5lMvKG+NsIt27Coj8T zzZw9Pw9EuxhjWj0EozfxtgON1zWS8ekvkPHRDtWxVfyR3ZeiLc4MsuLCaD+5liduyn5 If4Q== 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:cc; bh=1DEIH5Jv/CWabnOp3GZ/IY4thuBSAYjd8Ue6uf+1xX0=; b=PHivDJa5slJr3dvK+coiq1EdhjGWHKqvFBl6LLL7FWxKnpRmu+PDRQCt64axMOyD/j 1WJlMYHUaUe6RJs5j0aQuZhDJfiPKiEOVCSEGgNutcvhZtegkklGdB6Jnz5R+ldZFRbj G1N7r3+im1bDG+DX1z3qZRBW58+OBAGde/zdet8CSJNMFMxfMdbjTMJsBUW/KrfpOtmm UsUqvFsZlzEXkgbXqohlex2MDz0eqDFlqAUg1OPXgwtE49SrZ7A5Oszcga16WSVBwrKK HeBxjJCDUuXbVHaPW27vwRZwhqwdGYwvo6Ol1aNJ64pf4sOKpgjrTAmMFF7NIpTner1g U9wQ== X-Gm-Message-State: APjAAAXHuw4o6NWVplRk0qLNK03PA4ieFu4PgiBhz1jt1zCel/IHoPiW JdebWfvDvH2OhwhuWoVCJMr2f2NQpd7vsKUTPdc= X-Google-Smtp-Source: APXvYqyb0/lDjpUkSoniKmD+L25oQr2S1dOFs8fovkHPQuJ8p7daxYJEo327MfqWt6Duubv4AT2BTXdwWMobyXMRt4o= X-Received: by 2002:aca:be88:: with SMTP id o130mr5879868oif.122.1562938852221; Fri, 12 Jul 2019 06:40:52 -0700 (PDT) In-Reply-To: <83k1cn2z0l.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:162767 Archived-At: On Fri, Jul 12, 2019 at 12:55 PM Eli Zaretskii wrote: > > From: Pip Cet > > Date: Fri, 12 Jul 2019 12:44:35 +0000 > > Cc: 36609@debbugs.gnu.org > > > > Okay, I'm still not sure this is really the problem Andreas was > > seeing, but this code fails to work with xg_select: > > > > (let ((thread (make-thread (lambda () > > (sleep-for 3))))) > > (thread-yield) > > (thread-signal thread 'error nil)) > > What do you mean by "fails"? What do you see when you eval this? With `emacs -Q', a blinking cursor and an unresponsive emacs (no response to key presses, not even triple C-g). Sometimes, at least. Here's a full backtrace of a session where the hang did happen: Thread 4 (Thread 0x7fffeeb8a700 (LWP 26117)): #0 0x00007ffff4967819 in __GI___poll (fds=0xd93070, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 resultvar = 18446744073709551100 sc_cancel_oldtype = 0 #1 0x00007ffff698e136 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff698e25c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007fffeebd7ffd in () at /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so #4 0x00007ffff69b6415 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #5 0x00007ffff4b38fa3 in start_thread (arg=) at pthread_create.c:486 ret = pd = now = unwind_buf = { cancel_jmp_buf = {{ jmp_buf = {140737198466816, -2332898995959237690, 140737488337566, 140737488337567, 140737198466816, 13933232, 2332932536188793798, 2332875456844002246}, mask_was_saved = 0 }}, priv = { pad = {0x0, 0x0, 0x0, 0x0}, data = { prev = 0x0, cleanup = 0x0, canceltype = 0 } } } not_first_call = #6 0x00007ffff49724cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 3 (Thread 0x7fffef59e700 (LWP 26116)): #0 0x00007ffff4967819 in __GI___poll (fds=0xcb7a20, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 resultvar = 18446744073709551100 sc_cancel_oldtype = 0 #1 0x00007ffff698e136 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff698e4c2 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007ffff6bba0d6 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0 #4 0x00007ffff69b6415 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #5 0x00007ffff4b38fa3 in start_thread (arg=) at pthread_create.c:486 ret = pd = now = unwind_buf = { cancel_jmp_buf = {{ jmp_buf = {140737209034496, -2332898995959237690, 140737488336926, 140737488336927, 140737209034496, 13323152, 2332932821804118982, 2332875456844002246}, mask_was_saved = 0 }}, priv = { pad = {0x0, 0x0, 0x0, 0x0}, data = { prev = 0x0, cleanup = 0x0, canceltype = 0 } } } not_first_call = #6 0x00007ffff49724cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 2 (Thread 0x7ffff017d700 (LWP 26115)): #0 0x00007ffff4967819 in __GI___poll (fds=0xb400d0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 resultvar = 18446744073709551100 sc_cancel_oldtype = 0 #1 0x00007ffff698e136 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff698e25c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007ffff698e2a1 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #4 0x00007ffff69b6415 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #5 0x00007ffff4b38fa3 in start_thread (arg=) at pthread_create.c:486 ret = pd = now = unwind_buf = { cancel_jmp_buf = {{ jmp_buf = {140737221482240, -2332898995959237690, 140737488347710, 140737488347711, 140737221482240, 0, 2332865253915489222, 2332875456844002246}, mask_was_saved = 0 }}, priv = { pad = {0x0, 0x0, 0x0, 0x0}, data = { prev = 0x0, cleanup = 0x0, canceltype = 0 } } } not_first_call = #6 0x00007ffff49724cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 1 (Thread 0x7ffff0e30e00 (LWP 26108)): #0 0x00007ffff4b404c6 in pthread_sigmask (how=2, newmask=, oldmask=0x0) at ../sysdeps/unix/sysv/linux/pthread_sigmask.c:48 local_newmask = { __val = {7, 17697270867008781056, 11498208, 5790296, 0, 140737488342800, 2, 0, 0, 0, 0, 0, 0, 0, 0, 6922490} } result = 0 #1 0x0000000000585a7d in restore_signal_mask (oldset=0x7fffffffcf10) at sysdep.c:876 #2 0x0000000000699292 in really_call_select (arg=0x7fffffffd060) at thread.c:584 sa = 0x7fffffffd060 self = 0xa745c0 oldset = { __val = {0, 5710159, 8192, 126116988112, 140737488344608, 140737298839344, 7, 0, 11381952, 0, 8192, 1562936528, 140737488342720, 5968906924941129, 0, 16538645} } #3 0x00000000005e5ee0 in flush_stack_call_func (func=0x699239 , arg=0x7fffffffd060) at alloc.c:4969 end = 0x7fffffffd020 self = 0xa745c0 sentry = { o = { __max_align_ll = 0, __max_align_ld = } } #4 0x0000000000699389 in thread_select (func=0x419320 , max_fds=6, rfds=0x7fffffffd590, wfds=0x7fffffffd510, efds=0x0, timeout=0x7fffffffd840, sigmask=0x0) at thread.c:616 sa = { func = 0x419320 , max_fds = 6, rfds = 0x7fffffffd590, wfds = 0x7fffffffd510, efds = 0x0, timeout = 0x7fffffffd840, sigmask = 0x0, result = -157757095 } #5 0x00000000006bfeac in xg_select (fds_lim=6, rfds=0x7fffffffd8e0, wfds=0x7fffffffd860, efds=0x0, timeout=0x7fffffffd840, sigmask=0x0) at xgselect.c:117 all_rfds = { fds_bits = {32, 0 } } all_wfds = { fds_bits = {0 } } tmo = { tv_sec = 5621546, tv_nsec = 15785445 } tmop = 0x7fffffffd840 context = 0xc1c200 have_wfds = true gfds_buf = {{ fd = 895, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 8096, events = 65535, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 16, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 } , { fd = -2057698731, events = 39706, revents = 28662 }, { fd = 3, events = 0, revents = 0 }, { fd = -2057698731, events = 39706, revents = 28662 }, { fd = -161788823, events = 32767, revents = 0 }, { fd = -2057698731, events = 39642, revents = 28662 }, { fd = -190624704, events = 32767, revents = 0 }, { fd = 16, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = -664, events = 65535, revents = 65535 }, { fd = -504530176, events = 22038, revents = 62873 }, { fd = 12553216, events = 0, revents = 0 }, { fd = -1252392363, events = 44399, revents = 28662 }, { fd = 32, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 12553216, events = 0, revents = 0 }, { fd = -191458327, events = 32767, revents = 0 }, { fd = -190624704, events = 32767, revents = 0 }, { fd = 139264, events = 0, revents = 0 }, { fd = 17472, events = 0, revents = 0 }, { fd = -191893943, events = 32767, revents = 0 }, { fd = 128, events = 0, revents = 0 }, { fd = -191909562, events = 32767, revents = 0 }, { fd = 48, events = 0, revents = 0 }, { fd = 1, events = 0, revents = 0 }, { fd = 7, events = 0, revents = 0 }, { fd = 64, events = 0, revents = 0 }, { fd = 4, events = 32767, revents = 0 }, { fd = 11649056, events = 0, revents = 0 }, { fd = 47, events = 0, revents = 0 }, { fd = 96, events = 0, revents = 0 }, { fd = -664, events = 65535, revents = 65535 }, { fd = 1, events = 0, revents = 0 }, { fd = 4, events = 49, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 91, events = 110, revents = 0 }, { fd = 124, events = 119, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 17456, events = 0, revents = 0 }, { fd = -190624704, events = 32767, revents = 0 }, { fd = 48, events = 0, revents = 0 }, { fd = 2, events = 0, revents = 0 }, { fd = -664, events = 65535, revents = 65535 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = -191900310, events = 32767, revents = 0 }, { fd = -664, events = 65535, revents = 65535 }, { fd = 0, events = 0, revents = 0 }, { fd = 48, events = 0, revents = 0 }, { fd = 187264016, events = 0, revents = 0 }, { fd = 11498208, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = -11392, events = 32767, revents = 0 }, { fd = 5621546, events = 0, revents = 0 }, { fd = 187264016, events = 0, revents = 0 }, { fd = -11360, events = 32767, revents = 0 }, { fd = 187280083, events = 0, revents = 0 }, { fd = -11344, events = 32767, revents = 0 }, { fd = 5622263, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 187280083, events = 0, revents = 0 }, { fd = -11280, events = 32767, revents = 0 }, { fd = 6170867, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 5627325, events = 0, revents = 0 }, { fd = 6, events = 0, revents = 0 }, { fd = 1, events = 0, revents = 0 }, { fd = 0, events = 1, revents = 0 }, { fd = 11498208, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = -11232, events = 32767, revents = 0 }, { fd = 5621546, events = 0, revents = 0 }, { fd = -134398935, events = 0, revents = 0 }, { fd = -11200, events = 32767, revents = 0 }, { fd = 187280099, events = 0, revents = 0 }, { fd = -11184, events = 32767, revents = 0 }, { fd = 5622263, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 187280099, events = 0, revents = 0 }, { fd = -11120, events = 32767, revents = 0 }, { fd = 6170867, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 5627325, events = 0, revents = 0 }, { fd = 6, events = 0, revents = 0 }, { fd = 1, events = 0, revents = 0 }, { fd = 0, events = 1, revents = 0 }, { fd = 11498208, events = 0, revents = 0 }, { fd = 187280099, events = 0, revents = 0 }, { fd = -11072, events = 32767, revents = 0 }, { fd = 5622263, events = 0, revents = 0 }, { fd = -11024, events = 32767, revents = 0 }, { fd = -134398935, events = 32767, revents = 0 }, { fd = -10944, events = 32767, revents = 0 }, { fd = 15785445, events = 0, revents = 0 }, { fd = -11016, events = 32767, revents = 0 }, { fd = 5623097, events = 0, revents = 0 }, { fd = 11498208, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = 0, events = 0, revents = 0 }, { fd = -10992, events = 32767, revents = 0 }} gfds = 0x7fffffffd100 gfds_size = 128 n_gfds = -1 retval = 0 our_fds = 0 max_fds = 5 context_acquired = false i = 0 nfds = 0 tmo_in_millisec = 0 must_free = 0 need_to_dispatch = false #6 0x000000000066b757 in wait_reading_process_output (time_limit=0, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0) at process.c:5423 process_skipped = false channel = 6 nfds = 1 Available = { fds_bits = {32, 0 } } Writeok = { fds_bits = {0 } } check_write = true check_delay = 0 no_avail = false xerrno = 11 proc = XIL(0xcf7c00) timeout = { tv_sec = 100000, tv_nsec = 0 } end_time = { tv_sec = 0, tv_nsec = 140737488345168 } timer_delay = { tv_sec = 0, tv_nsec = -1 } got_output_end_time = { tv_sec = 0, tv_nsec = -1 } wait = FOREVER got_some_output = -1 prev_wait_proc_nbytes_read = 0 retry_for_async = false count = 4 now = { tv_sec = 0, tv_nsec = -1 } #7 0x000000000056c31e in kbd_buffer_get_event (kbp=0x7fffffffdbd8, used_mouse_menu=0x7fffffffe1bf, end_time=0x0) at keyboard.c:3836 do_display = true obj = XIL(0x14bfd3fb) #8 0x0000000000568706 in read_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fffffffdf80, used_mouse_menu=0x7fffffffe1bf) at keyboard.c:2138 c = XIL(0) save_jump = {{ __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0}, __mask_was_saved = 0, __saved_mask = { __val = {0 } } }} kb = 0x55c9f7 count = 3 #9 0x0000000000568970 in read_decoded_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fffffffdf80, prev_event=XIL(0), used_mouse_menu=0x7fffffffe1bf) at keyboard.c:2202 nextevt = XIL(0x7fffffffde30) frame = 0x0 terminal = 0x0 events = {XIL(0x7fffffffddb0), make_fixnum(1422534), XIL(0xaf72e0), XIL(0), XIL(0), XIL(0x7fffffffddb0), make_fixnum(1405386), XIL(0x135b623), XIL(0x7fffffffddf0), make_fixnum(1420782), XIL(0xaf72e0), XIL(0x100000000), XIL(0), XIL(0x7fffffffddf0), make_fixnum(1405386), XIL(0)} n = 0 #10 0x000000000056a002 in read_char (commandflag=1, map=XIL(0xfbaa33), prev_event=XIL(0), used_mouse_menu=0x7fffffffe1bf, end_time=0x0) at keyboard.c:2810 c = XIL(0) jmpcount = 3 local_getcjmp = {{ __jmpbuf = {0, 2332898996579464134, 16538645, 48, 0, 0, 2332898994838827974, -2332899704998988858}, __mask_was_saved = 0, __saved_mask = { __val = {140737214405912, 0, 140737225904168, 11498208, 0, 0, 140737488347152, 5621546, 4032516088, 11498208, 0, 0, 140737488347200, 5621546, 12363987, 140737488347296} } }} save_jump = {{ __jmpbuf = {0, 0, 140737224472304, 0, 0, 11529984, 5621546, 0}, __mask_was_saved = -8336, __saved_mask = { __val = {6254137, 140737231486936, 12884893472, 0, 31776, 140737224472304, 140737231486936, 5623453, 51539607552, 140737224472309, 140737224472304, 5632971, 11529984, 11529984, 0, 11498208} } }} tem = XIL(0x7fffefa759f0) save = XIL(0) previous_echo_area_message = XIL(0) also_record = XIL(0) reread = false recorded = false polling_stopped_here = true orig_kboard = 0xc863c0 #11 0x0000000000576842 in read_key_sequence (keybuf=0x7fffffffe3a0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9124 interrupted_kboard = 0xc863c0 interrupted_frame = 0xf976a0 key = XIL(0xf97ac0) used_mouse_menu = false echo_local_start = 0 last_real_key_start = 0 keys_local_start = 0 new_binding = XIL(0xf97ac0) count = 3 t = 0 echo_start = 0 keys_start = 0 current_binding = XIL(0xfbaa33) first_unbound = 31 mock_input = 0 used_mouse_menu_history = {false } fkey = { parent = XIL(0xbe3cd3), map = XIL(0xbe3cd3), start = 0, end = 0 } keytran = { parent = XIL(0x7ffff0ae0eeb), map = XIL(0x7ffff0ae0eeb), start = 0, end = 0 } indec = { parent = XIL(0xbe3cc3), map = XIL(0xbe3cc3), start = 0, end = 0 } shift_translated = false delayed_switch_frame = XIL(0) original_uppercase = XIL(0) original_uppercase_position = -1 dummyflag = false starting_buffer = 0x7ffff04576f0 fake_prefixed_keys = XIL(0) first_event = XIL(0) second_event = XIL(0) #12 0x00000000005667ae in command_loop_1 () at keyboard.c:1348 cmd = XIL(0x7fffffffe4f0) keybuf = {XIL(0x7fffffffe420), XIL(0x7ffff0b08008), XIL(0x100000007), XIL(0), XIL(0), XIL(0x80a0), XIL(0x11f), XIL(0xaff380), XIL(0xaff380), XIL(0), XIL(0x7fffffffe440), XIL(0x617021), make_fixnum(1073741824), XIL(0x7fffffffe460), XIL(0xaf72e0), XIL(0), XIL(0), XIL(0x7fffffffe440), make_fixnum(1405386), XIL(0xf04576f5), XIL(0x7fffffffe4a0), XIL(0x61729f), XIL(0xaf72e0), XIL(0), XIL(0), XIL(0x7fffffffe480), make_fixnum(1405386), XIL(0xf04576f5), XIL(0x7fffffffe4c0), make_fixnum(1591385)} i = 0 prev_modiff = 0 prev_buffer = 0x0 already_adjusted = false #13 0x0000000000611d61 in internal_condition_case (bfun=0x566384 , handlers=XIL(0x90), hfun=0x565b7d ) at eval.c:1351 val = make_fixnum(1405386) c = 0xb99e70 #14 0x000000000056607a in command_loop_2 (ignore=XIL(0)) at keyboard.c:1091 val = XIL(0) #15 0x000000000061161a in internal_catch (tag=XIL(0xd140), func=0x566051 , arg=XIL(0)) at eval.c:1112 val = XIL(0x7fffffffe5c0) c = 0xb94fd0 #16 0x000000000056601c in command_loop () at keyboard.c:1070 #17 0x0000000000565752 in recursive_edit_1 () at keyboard.c:714 count = 1 val = XIL(0x7fffffffe620) #18 0x00000000005658d4 in Frecursive_edit () at keyboard.c:786 count = 0 buffer = XIL(0) #19 0x0000000000563961 in main (argc=4, argv=0x7fffffffe878) at emacs.c:2086 stack_bottom_variable = 0x5e00 do_initial_setlocale = true no_loadup = false junk = 0x0 dname_arg = 0x0 ch_to_dir = 0x0 original_pwd = 0x0 dump_mode = 0x0 skip_args = 0 temacs = 0x0 attempt_load_pdump = true rlim = { rlim_cur = 10022912, rlim_max = 18446744073709551615 } sockfd = -1 i thr Id Target Id Frame * 1 Thread 0x7ffff0e30e00 (LWP 26108) "emacs" pthread_sigmask (how=0, newmask=, oldmask=0x7fffffffcf10) at ../sysdeps/unix/sysv/linux/pthread_sigmask.c:48 2 Thread 0x7ffff017d700 (LWP 26115) "gmain" 0x00007ffff4967819 in __GI___poll (fds=0xb400d0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 3 Thread 0x7fffef59e700 (LWP 26116) "gdbus" 0x00007ffff4967819 in __GI___poll (fds=0xcb7a20, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 4 Thread 0x7fffeeb8a700 (LWP 26117) "dconf worker" 0x00007ffff4967819 in __GI___poll (fds=0xd93070, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 > > Proposed patch attached. > > As I said earlier, I don't think it's right to use stack unwinding at > this level. (Did you try this in a -nw session?) Sorry, I didn't see that email until after I'd sent mine. I did try with an -nw session, now, but I really think thread_select should not return abnormally. > I'd appreciate a description of what you think happens here, and why. When a thread is signalled (by thread-signal, which sets another thread's error_symbol) while the signalled thread is inside a select(), thread_select() will return non-locally for that thread, and we fail to release an internal GLib lock through g_main_context_release(). That's the first bug. When xg_select() fails to acquire the internal GLib lock, it simply does a select() on the remaining file descriptors: context_acquired = g_main_context_acquire (context); /* FIXME: If we couldn't acquire the context, we just silently proceed because this function handles more than just glib file descriptors. Note that, as implemented, this failure is completely silent: there is no feedback to the caller. */ This seems like a second, albeit documented, bug to me. I think we're risking not waking up from the actual select because another (non-Emacs) thread happened to hold the main context at the time.