bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36609: 27.0.50; Possible race-condition in threading implementation


From: Pip Cet
Subject: bug#36609: 27.0.50; Possible race-condition in threading implementation
Date: Fri, 12 Jul 2019 13:40:15 +0000

On Fri, Jul 12, 2019 at 12:55 PM Eli Zaretskii <address@hidden> wrote:
> > From: Pip Cet <address@hidden>
> > Date: Fri, 12 Jul 2019 12:44:35 +0000
> > Cc: address@hidden
> >
> > 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=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        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 = <optimized out>
#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=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        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 = <optimized out>
#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=<optimized out>)
    at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        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 = <optimized out>
#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=<optimized out>, 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 <main_thread>
        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 <really_call_select>, arg=0x7fffffffd060) at alloc.c:4969
        end = 0x7fffffffd020
        self = 0xa745c0 <main_thread>
        sentry = {
          o = {
            __max_align_ll = 0,
            __max_align_ld = <invalid float value>
          }
        }
#4  0x0000000000699389 in thread_select
    (func=0x419320 <pselect@plt>, max_fds=6, rfds=0x7fffffffd590,
wfds=0x7fffffffd510, efds=0x0, timeout=0x7fffffffd840, sigmask=0x0) at
thread.c:616
        sa = {
          func = 0x419320 <pselect@plt>,
          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 <repeats 15 times>}
        }
        all_wfds = {
          fds_bits = {0 <repeats 16 times>}
        }
        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
          } <repeats 11 times>, {
            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 <repeats 15 times>}
        }
        Writeok = {
          fds_bits = {0 <repeats 16 times>}
        }
        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 <repeats 16 times>}
            }
          }}
        kb = 0x55c9f7 <XSETCDR+28>
        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 <repeats 30 times>}
        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 <command_loop_1>, handlers=XIL(0x90), hfun=0x565b7d
<cmd_error>) 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 <command_loop_2>, 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=<optimized out>, 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]