Piotr Isajew <p...@ex.com.pl> writes:

> Dnia 15.10.2017 Jeremie Courreges-Anglas <j...@wxcvbn.org> napisał/a:
>>
>> Here's a diff for the first pretest in the emacs-26 release cycle.
>> Among other things, emacs now uses system malloc(3) at runtime (gmalloc
>> is still used at build/unexec time).
>>
>> As usual build & test reports are welcome, especially if you use an arch
>> different from amd64 / arm, or if you use one of the graphical flavors.
>
> I've been testing this on 6.2. I notice one problem which exists
> also for emacs-25 and I can reproduce it for all the graphical
> flavors.
>
> The scenario I can reproduce is related to using org-capture. On
> any other platform, or even on OpenBSD without X, after selecting
> capture template a dedicated buffer appears in which I can edit
> the template. On OpenBSD however, under X this buffer does only
> appear after generating additional input event, like moving a
> mouse. There's no such problem if I select capture template using
> soft-keyboard - XVkbd.
>
> Also it is very likely that after selecting the capture template
> *emacs will hang in kind of an infinite loop* maxing out CPU
> usage.

Hello,

I think I have encountered the same issue. The problem occurs when emacs
tries to read the secondary clipbard with the encoding iso-8859-1.
You can try to reproduce the bug with :
> (setf x-selection-timeout 500)
> (org-get-x-clipboard 'SECONDARY)

If this is the same bug, the call to `org-get-x-clipboard' will froze
emacs for 500ms then return nil.

After I track this down I found a quick-fix :
> (setf x-selection-timeout 10)
This set the timeout to 10ms instead of 0 (i.e. wait indefinitely)

At the time, I ran out of patience and didn't bother to find out if the
bug was specific to OpenBSD or some weird interactions between emacs and
my window manager and/or X. But if you confirm the same bug it may be
time to report it.

Best,

PS: You can usually recover from a frozen emacs by sending the SIGUSR2
signal to the emacs' process (pkill -USR2 emacs). When it receives
SIGUSR2, emacs will drop into its debugger and toggle debug-on-quit
(SIGUSR2 is like C-g but emacs should react to it even if the input loop
is frozen).

> The command I used to build the port:
>
> cd /usr/ports/editors/emacs
> doas sh -c 'export FLAVOR=athena; export DEBUG="-g -O0 -DTRACE_SELECTION";
>      make clean repackage reinstall'
>
> The stacktrace from the moment it hangs:
>
> info thre
>   4 thread 424274  _thread_sys_poll () at -:3
>   3 thread 437321  _thread_sys_poll () at -:3
> * 2 thread 476142  _thread_sys_poll () at -:3
>   1 thread 131181  wait_reading_process_output (time_limit=5, nsecs=0, 
>     read_kbd=0, do_display=false, wait_for_cell=16374659, wait_proc=0x0, 
>     just_wait_proc=0) at process.c:5296
> (gdb) thr 4
> [Switching to thread 4 (thread 424274)]#0  _thread_sys_poll () at -:3
> 3       in -
> (gdb) inf sta
> #0  _thread_sys_poll () at -:3
> #1  0x00000002c6d1f45f in _libc_poll_cancel (fds=Variable "fds" is not 
> available.
> )
>     at /usr/src/lib/libc/sys/w_poll.c:27
> #2  0x000000022d883497 in g_main_context_iterate () at gmain.c:4271
> #3  0x000000022d883594 in g_main_context_iteration (context=0x20ddb0500, 
>     may_block=The value of variable 'may_block' is distributed across several
> locations, and GDB cannot access its value.
>
> ) at gmain.c:4033
> #4  0x00000002c7f2bb7d in g_io_module_query ()
>    from /usr/local/lib/gio/modules/libdconfsettings.so
> #5  0x000000022d8ac3fa in g_thread_proxy (data=0x259d50190) at gthread.c:784
> #6  0x0000000275642cae in _rthread_start (v=Variable "v" is not available.
> )
>     at /usr/src/lib/librthread/rthread.c:96
> #7  0x00000002c6d1b96b in __tfork_thread ()
>     at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:75
> #8  0x0000000000000000 in ?? ()
>
> (gdb) thr 3
> [Switching to thread 3 (thread 437321)]#0  _thread_sys_poll () at -:3
> 3       in -
> (gdb) inf sta
> #0  _thread_sys_poll () at -:3
> #1  0x00000002c6d1f45f in _libc_poll_cancel (fds=Variable "fds" is not 
> available.
> )
>     at /usr/src/lib/libc/sys/w_poll.c:27
> #2  0x000000022d883497 in g_main_context_iterate () at gmain.c:4271
> #3  0x000000022d883594 in g_main_context_iteration (context=0x243a3ce00, 
>     may_block=The value of variable 'may_block' is distributed across several
> locations, and GDB cannot access its value.
>
> ) at gmain.c:4033
> #4  0x000000022d885296 in glib_worker_main (data=Variable "data" is not 
> available.
> ) at gmain.c:5824
> #5  0x000000022d8ac3fa in g_thread_proxy (data=0x259d50000) at gthread.c:784
> #6  0x0000000275642cae in _rthread_start (v=Variable "v" is not available.
> )
>     at /usr/src/lib/librthread/rthread.c:96
> #7  0x00000002c6d1b96b in __tfork_thread ()
>     at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:75
>
> (gdb) thr 2
> [Switching to thread 2 (thread 476142)]#0  _thread_sys_poll () at -:3
> 3       in -
> (gdb) inf sta
> #0  _thread_sys_poll () at -:3
> #1  0x00000002c6d1f45f in _libc_poll_cancel (fds=Variable "fds" is not 
> available.
> )
>     at /usr/src/lib/libc/sys/w_poll.c:27
> #2  0x000000022d883497 in g_main_context_iterate () at gmain.c:4271
> #3  0x000000022d88382f in g_main_loop_run (loop=0x249a70a80) at gmain.c:4168
> #4  0x00000002a5dac8cb in gdbus_shared_thread_func (user_data=0x2039baa80)
>     at gdbusprivate.c:252
> #5  0x000000022d8ac3fa in g_thread_proxy (data=0x27f39fed0) at gthread.c:784
> #6  0x0000000275642cae in _rthread_start (v=Variable "v" is not available.
> )
>     at /usr/src/lib/librthread/rthread.c:96
> #7  0x00000002c6d1b96b in __tfork_thread ()
>     at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:75
> #8  0x0000000000000000 in ?? ()
>
> (gdb) thr 1
> [Switching to thread 1 (thread 131181)]#0  wait_reading_process_output (
>     time_limit=5, nsecs=0, read_kbd=0, do_display=false, 
>     wait_for_cell=16374659, wait_proc=0x0, just_wait_proc=0) at process.c:5296
> 5296              FD_ZERO (&Available);
> Current language:  auto; currently minimal
> (gdb) inf sta
> #0  wait_reading_process_output (time_limit=5, nsecs=0, read_kbd=0, 
>     do_display=false, wait_for_cell=16374659, wait_proc=0x0, just_wait_proc=0)
>     at process.c:5296
> #1  0x00000000005b297d in x_get_foreign_selection (selection_symbol=9120, 
>     target_type=240, time_stamp=0, frame=22101045) at xselect.c:1201
> #2  0x00000000005b1f4c in Fx_get_selection_internal (selection_symbol=9120, 
>     target_type=240, time_stamp=0, terminal=0) at xselect.c:2010
> #3  0x00000000006fabf7 in funcall_subr (subr=0xbc8318, numargs=4, 
>     args=0x7f7ffffdacd0) at eval.c:2849
> #4  0x00000000006f983a in Ffuncall (nargs=5, args=0x7f7ffffdacc8)
>     at eval.c:2766
> #5  0x0000000000782f3d in exec_byte_code (bytestr=26624420, vector=20306061, 
>     maxdepth=38, args_template=4106, nargs=2, args=0x7f7ffffdb798)
>     at bytecode.c:629
> #6  0x00000000006fafc5 in funcall_lambda (fun=23387365, nargs=2, 
>     arg_vector=0x7f7ffffdb788) at eval.c:2967
> #7  0x00000000006f9882 in Ffuncall (nargs=3, args=0x7f7ffffdb780)
>     at eval.c:2768
> #8  0x00000000006f961a in Fapply (nargs=2, args=0x7f7ffffdc0f0) at eval.c:2386
> #9  0x00000000006faa86 in funcall_subr (subr=0xed78d8, numargs=2, 
>     args=0x7f7ffffdc0f0) at eval.c:2821
> #10 0x00000000006f983a in Ffuncall (nargs=3, args=0x7f7ffffdc0e8)
>     at eval.c:2766
> #11 0x0000000000782f3d in exec_byte_code (bytestr=22680196, vector=21880661, 
>     maxdepth=62, args_template=514, nargs=2, args=0x7f7ffffdcc20)
>     at bytecode.c:629
> #12 0x00000000006fafc5 in funcall_lambda (fun=21811109, nargs=2, 
>     arg_vector=0x7f7ffffdcc20) at eval.c:2967
> #13 0x00000000006f9882 in Ffuncall (nargs=3, args=0x7f7ffffdcc18)
>     at eval.c:2768
> #14 0x0000000000782f3d in exec_byte_code (bytestr=13593108, vector=13593141, 
>     maxdepth=38, args_template=2050, nargs=2, args=0x7f7ffffdd758)
>     at bytecode.c:629
> #15 0x00000000006fafc5 in funcall_lambda (fun=13593061, nargs=2, 
>     arg_vector=0x7f7ffffdd748) at eval.c:2967
> #16 0x00000000006f9882 in Ffuncall (nargs=3, args=0x7f7ffffdd740)
>     at eval.c:2768
> #17 0x0000000000782f3d in exec_byte_code (bytestr=11746807908, 
>     vector=24821037, maxdepth=34, args_template=1030, nargs=1, 
>     args=0x7f7ffffde348) at bytecode.c:629
> #18 0x00000000006fafc5 in funcall_lambda (fun=24821173, nargs=1, 
>     arg_vector=0x7f7ffffde340) at eval.c:2967
> #19 0x00000000006f9882 in Ffuncall (nargs=2, args=0x7f7ffffde338)
>     at eval.c:2768
> #20 0x0000000000782f3d in exec_byte_code (bytestr=11743124740, 
>     vector=11965495141, maxdepth=178, args_template=3074, nargs=0, 
>     args=0x7f7ffffdf3e0) at bytecode.c:629
> #21 0x00000000006fafc5 in funcall_lambda (fun=11965496357, nargs=0, 
>     arg_vector=0x7f7ffffdf3e0) at eval.c:2967
> #22 0x00000000006f9882 in Ffuncall (nargs=1, args=0x7f7ffffdf3d8)
>     at eval.c:2768
> #23 0x0000000000782f3d in exec_byte_code (bytestr=11904366884, 
>     vector=9575961797, maxdepth=86, args_template=2050, nargs=1, 
>     args=0x7f7ffffe01f8) at bytecode.c:629
> #24 0x00000000006fafc5 in funcall_lambda (fun=9575962493, nargs=1, 
>     arg_vector=0x7f7ffffe01f0) at eval.c:2967
> #25 0x00000000006f9882 in Ffuncall (nargs=2, args=0x7f7ffffe01e8)
>     at eval.c:2768
> #26 0x00000000006daa3a in Ffuncall_interactively (nargs=2, 
> args=0x7f7ffffe01e8)
>     at callint.c:252
> #27 0x00000000006faa86 in funcall_subr (subr=0xed7308, numargs=2, 
>     args=0x7f7ffffe01e8) at eval.c:2821
> #28 0x00000000006f983a in Ffuncall (nargs=3, args=0x7f7ffffe01e0)
>     at eval.c:2766
> #29 0x00000000006dd2bb in Fcall_interactively (function=7336368, 
>     record_flag=0, keys=10242735877) at callint.c:841
> #30 0x00000000006fabb9 in funcall_subr (subr=0xed72d8, numargs=3, 
>     args=0x7f7ffffe0a20) at eval.c:2846
> #31 0x00000000006f983a in Ffuncall (nargs=4, args=0x7f7ffffe0a18)
>     at eval.c:2766
> #32 0x0000000000782f3d in exec_byte_code (bytestr=13161172, vector=13161205, 
>     maxdepth=54, args_template=4102, nargs=1, args=0x7f7ffffe15a8)
>     at bytecode.c:629
> #33 0x00000000006fafc5 in funcall_lambda (fun=13161125, nargs=1, 
>     arg_vector=0x7f7ffffe15a0) at eval.c:2967
> #34 0x00000000006f9882 in Ffuncall (nargs=2, args=0x7f7ffffe1598)
>     at eval.c:2768
> #35 0x00000000006fa3b2 in call1 (fn=15840, arg1=7336368) at eval.c:2617
> #36 0x00000000005d67d7 in command_loop_1 () at keyboard.c:1482
> #37 0x00000000006eaa57 in internal_condition_case (
>     bfun=0x5d5e50 <command_loop_1>, handlers=20688, hfun=0x5ec220 <cmd_error>)
>     at eval.c:1332
> #38 0x00000000005ec122 in command_loop_2 (ignore=0) at keyboard.c:1110
> #39 0x00000000006ea218 in internal_catch (tag=50256, 
>     func=0x5ec0f0 <command_loop_2>, arg=0) at eval.c:1097
> #40 0x00000000005d5414 in command_loop () at keyboard.c:1089
> #41 0x00000000005d527c in recursive_edit_1 () at keyboard.c:695
> #42 0x00000000005d559e in Frecursive_edit () at keyboard.c:766
> #43 0x00000000005d301f in main (argc=1, argv=0x7f7ffffe1d78) at emacs.c:1713
>
> The most recent output before it hangs:
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection UTF8_STRING, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection COMPOUND_TEXT, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection STRING, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection TEXT, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: x_handle_selection_event
> 7764: x_handle_selection_clear
> 7764: Get selection UTF8_STRING, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection COMPOUND_TEXT, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection STRING, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify
> 7764: Received SelectionNotify
> 7764:   Got event = 1
> 7764: Get selection UTF8_STRING, type _EMACS_TMP_
> 7764:   Start waiting 5 secs for SelectionNotify

Reply via email to