unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jarek Czekalski <jarekczek@poczta.onet.pl>
To: 15801@debbugs.gnu.org
Subject: bug#15801: 24.3.50; bar scrolling freezes gtk emacs
Date: Wed, 04 Dec 2013 21:28:38 +0100	[thread overview]
Message-ID: <529F9076.5040309@poczta.onet.pl> (raw)
In-Reply-To: <5277EA95.4070001@poczta.onet.pl>

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

I have bad news. It's time to think about the call to 
g_main_context_query, because it seems to destroy the fragile workflow 
of gtk. There are timeout triggered events "pause-events" and 
"resume-events". Every mouse movement triggers one pause and one resume. 
In my case finally pause is called twice while resume - once. There goes 
the freeze.

I attach gdb backtraces for you to see what is the code flow to reach 
those pause and resume methods. Breakpoints were set in
_gdk_display_pause_events
_gdk_display_unpause_events

Source codes used are:
gtk 3.8.6
glib 2.36.4
emacs r115317

Now I know why the commit r112892 causes troubles. Because it enables 
the code path in which the code unbalancing gtk is run. Why this code 
may be run safely when events are pending? Maybe because in this case 
polling doesn't change anything, events are pending anyway. But this is 
a guess. What is sure is that you can't take just one gtk method and use 
it out of the context for which it was designed. It causes big troubles, 
for a guy who wants to debug the problem. You never know when it 
strikes. Let's make it safe.

The first thing I would do now is finding the real bugs that were being 
fixed by r112892. Maybe there is another way of fixing them, without 
calling g_main_context_query.

Jarek


[-- Attachment #2: backtrace.txt --]
[-- Type: text/plain, Size: 12092 bytes --]

Script started on Wed 04 Dec 2013 09:22:42 PM CET
jcdeb:/home# gdb --args emacs -Q
GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/bin/emacs-24.3.50...done.
(gdb) start
Temporary breakpoint 1 at 0x8058350: file emacs.c, line 688.
Starting program: /usr/local/bin/emacs -Q
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".

Temporary breakpoint 1, main (argc=2, argv=0xbffff544) at emacs.c:688
688	{
(gdb) break _gdk_display_pause_events
Breakpoint 2 at 0xb78f2f40: file gdkdisplay.c, line 2012.
(gdb) break _gdk_display_pause_events\b\b\b\b\b\b\b\b\b\b\b\b^[[1@u^[[1@n
Breakpoint 3 at 0xb78f2f50: file gdkdisplay.c, line 2018.
(gdb) cont
Continuing.
[New Thread 0xb5f07b40 (LWP 29235)]
[New Thread 0xb552fb40 (LWP 29237)]
[New Thread 0xb4bffb40 (LWP 29239)]

Breakpoint 2, _gdk_display_pause_events (display=display@entry=0x8858840)
    at gdkdisplay.c:2012
2012	{
(gdb) backtrace
#0  _gdk_display_pause_events (display=display@entry=0x8858840)
    at gdkdisplay.c:2012
#1  0xb78ffa2e in gdk_window_flush_events (clock=0x8861150, data=0x885f980)
    at gdkwindow.c:11611
#2  0xb7551339 in g_cclosure_marshal_VOID__VOIDv (closure=0x85c9570, 
    return_value=0x0, instance=0x8861150, args=0xbfffe978 "", 
    marshal_data=0x0, n_params=0, param_types=0x0)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gmarshal.c:115
#3  0xb754f8de in _g_closure_invoke_va (closure=closure@entry=0x85c9570, 
    return_value=return_value@entry=0x0, instance=instance@entry=0x8861150, 
    args=args@entry=0xbfffe978 "", n_params=0, param_types=0x0)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gclosure.c:840
#4  0xb7568237 in g_signal_emit_valist (instance=instance@entry=0x8861150, 
    signal_id=signal_id@entry=136, detail=detail@entry=0, 
    var_args=var_args@entry=0xbfffe978 "")
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gsignal.c:3234
#5  0xb7569291 in g_signal_emit_by_name (instance=instance@entry=0x8861150, 
    detailed_signal=detailed_signal@entry=0xb7938973 "flush-events")
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gsignal.c:3424
#6  0xb78f936d in gdk_frame_clock_flush_idle (data=0x8861150)
    at gdkframeclockidle.c:312
#7  0xb78eafc5 in gdk_threads_dispatch (data=data@entry=0x8a0dfb0) at gdk.c:788
#8  0xb74850b1 in g_timeout_dispatch (source=source@entry=0x89ee6a8, 
---Type <return> to continue, or q <return> to quit---
    callback=0xb78eaf90 <gdk_threads_dispatch>, user_data=0x8a0dfb0)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:4413
#9  0xb748442e in g_main_dispatch (context=0x884a1e8, context@entry=0x883a220)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3054
#10 g_main_context_dispatch (context=context@entry=0x884a1e8)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3630
#11 0xb74847d8 in g_main_context_iterate (context=context@entry=0x884a1e8, 
    block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3701
#12 0xb7484898 in g_main_context_iteration (context=0x884a1e8, 
    context@entry=0x0, may_block=may_block@entry=1)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3762
#13 0xb7af0bd8 in gtk_main_iteration () at gtkmain.c:1260
#14 0x080f0091 in XTread_socket (terminal=0x8737818, hold_quit=0xbfffeb0c)
    at xterm.c:7077
#15 0x08123519 in gobble_input () at keyboard.c:6841
#16 0x08122f95 in handle_async_input () at keyboard.c:7081
#17 process_pending_signals () at keyboard.c:7095
#18 0x08171939 in Fmake_list (length=length@entry=4, init=138857410)
    at alloc.c:2597
#19 0x08190188 in concat (nargs=nargs@entry=1, args=args@entry=0xbfffec30, 
    target_type=Lisp_Cons, last_special=last_special@entry=false) at fns.c:578
#20 0x0819070e in Fcopy_sequence (arg=141242022) at fns.c:446
---Type <return> to continue, or q <return> to quit---
#21 0x08121e06 in timer_check () at keyboard.c:4559
#22 0x0812233b in readable_events (flags=flags@entry=1) at keyboard.c:3439
#23 0x0812361f in get_input_pending (flags=flags@entry=1) at keyboard.c:6756
#24 0x08126692 in detect_input_pending_run_timers (
    do_display=do_display@entry=true) at keyboard.c:9879
#25 0x081c678f in wait_reading_process_output (time_limit=<optimized out>, 
    nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, 
    do_display=do_display@entry=true, wait_for_cell=138857410, 
    wait_proc=wait_proc@entry=0x0, just_wait_proc=just_wait_proc@entry=0)
    at process.c:4680
#26 0x08062431 in sit_for (timeout=120, reading=reading@entry=true, 
    display_option=display_option@entry=1) at dispnew.c:5800
#27 0x08127383 in read_char (commandflag=1, map=map@entry=141054470, 
    prev_event=138857410, used_mouse_menu=used_mouse_menu@entry=0xbffff25b, 
    end_time=end_time@entry=0x0) at keyboard.c:2805
#28 0x0812865e in read_key_sequence (keybuf=keybuf@entry=0xbffff2f8, 
    prompt=138857410, dont_downcase_last=dont_downcase_last@entry=false, 
    can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, 
    prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
    at keyboard.c:9074
#29 0x0812a016 in command_loop_1 () at keyboard.c:1445
#30 0x08189163 in internal_condition_case (
---Type <return> to continue, or q <return> to quit---
    bfun=bfun@entry=0x8129e60 <command_loop_1>, handlers=138890506, 
    hfun=hfun@entry=0x8121750 <cmd_error>) at eval.c:1344
#31 0x0811d235 in command_loop_2 (ignore=138857410) at keyboard.c:1170
#32 0x08189093 in internal_catch (tag=138888554, 
    func=func@entry=0x811d210 <command_loop_2>, arg=138857410) at eval.c:1108
#33 0x081213a2 in command_loop () at keyboard.c:1149
#34 recursive_edit_1 () at keyboard.c:777
#35 0x08121663 in Frecursive_edit () at keyboard.c:841
#36 0x08058e88 in main (argc=<optimized out>, argv=0xbffff544) at emacs.c:1598
(gdb) cont
Continuing.

Breakpoint 3, _gdk_display_unpause_events (display=0x8858840)
    at gdkdisplay.c:2018
2018	{
(gdb) backtrace
#0  _gdk_display_unpause_events (display=0x8858840) at gdkdisplay.c:2018
#1  0xb78ff9f3 in gdk_window_resume_events (clock=0x8861150, data=0x885f980)
    at gdkwindow.c:11639
#2  0xb7551339 in g_cclosure_marshal_VOID__VOIDv (closure=0x85c9610, 
    return_value=0x0, instance=0x8861150, args=0xbfffe948 "?\022", 
    marshal_data=0x0, n_params=0, param_types=0x0)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gmarshal.c:115
#3  0xb754f8de in _g_closure_invoke_va (closure=closure@entry=0x85c9610, 
    return_value=return_value@entry=0x0, instance=instance@entry=0x8861150, 
    args=args@entry=0xbfffe948 "?\022", n_params=0, param_types=0x0)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gclosure.c:840
#4  0xb7568237 in g_signal_emit_valist (instance=instance@entry=0x8861150, 
    signal_id=signal_id@entry=142, detail=detail@entry=0, 
    var_args=var_args@entry=0xbfffe948 "?\022")
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gsignal.c:3234
#5  0xb7569291 in g_signal_emit_by_name (instance=instance@entry=0x8861150, 
    detailed_signal=detailed_signal@entry=0xb79389a0 "resume-events")
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./gobject/gsignal.c:3424
#6  0xb78f98d4 in gdk_frame_clock_paint_idle (data=0x8861150)
    at gdkframeclockidle.c:457
#7  0xb78eafc5 in gdk_threads_dispatch (data=data@entry=0x8a0df80) at gdk.c:788
#8  0xb74850b1 in g_timeout_dispatch (source=source@entry=0x88e9c80, 
    callback=0xb78eaf90 <gdk_threads_dispatch>, user_data=0x8a0df80)
---Type <return> to continue, or q <return> to quit---
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:4413
#9  0xb748442e in g_main_dispatch (context=0x884a1e8, context@entry=0x883a220)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3054
#10 g_main_context_dispatch (context=context@entry=0x884a1e8)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3630
#11 0xb74847d8 in g_main_context_iterate (context=context@entry=0x884a1e8, 
    block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3701
#12 0xb7484898 in g_main_context_iteration (context=0x884a1e8, 
    context@entry=0x0, may_block=may_block@entry=1)
    at /build/glib2.0-Ot8bbC/glib2.0-2.36.4/./glib/gmain.c:3762
#13 0xb7af0bd8 in gtk_main_iteration () at gtkmain.c:1260
#14 0x080f0091 in XTread_socket (terminal=0x8737818, hold_quit=0xbfffeb0c)
    at xterm.c:7077
#15 0x08123519 in gobble_input () at keyboard.c:6841
#16 0x08122f95 in handle_async_input () at keyboard.c:7081
#17 process_pending_signals () at keyboard.c:7095
#18 0x08171939 in Fmake_list (length=length@entry=4, init=138857410)
    at alloc.c:2597
#19 0x08190188 in concat (nargs=nargs@entry=1, args=args@entry=0xbfffec30, 
    target_type=Lisp_Cons, last_special=last_special@entry=false) at fns.c:578
#20 0x0819070e in Fcopy_sequence (arg=141242022) at fns.c:446
#21 0x08121e06 in timer_check () at keyboard.c:4559
---Type <return> to continue, or q <return> to quit---
#22 0x0812233b in readable_events (flags=flags@entry=1) at keyboard.c:3439
#23 0x0812361f in get_input_pending (flags=flags@entry=1) at keyboard.c:6756
#24 0x08126692 in detect_input_pending_run_timers (
    do_display=do_display@entry=true) at keyboard.c:9879
#25 0x081c678f in wait_reading_process_output (time_limit=<optimized out>, 
    nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, 
    do_display=do_display@entry=true, wait_for_cell=138857410, 
    wait_proc=wait_proc@entry=0x0, just_wait_proc=just_wait_proc@entry=0)
    at process.c:4680
#26 0x08062431 in sit_for (timeout=120, reading=reading@entry=true, 
    display_option=display_option@entry=1) at dispnew.c:5800
#27 0x08127383 in read_char (commandflag=1, map=map@entry=141054470, 
    prev_event=138857410, used_mouse_menu=used_mouse_menu@entry=0xbffff25b, 
    end_time=end_time@entry=0x0) at keyboard.c:2805
#28 0x0812865e in read_key_sequence (keybuf=keybuf@entry=0xbffff2f8, 
    prompt=138857410, dont_downcase_last=dont_downcase_last@entry=false, 
    can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, 
    prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
    at keyboard.c:9074
#29 0x0812a016 in command_loop_1 () at keyboard.c:1445
#30 0x08189163 in internal_condition_case (
    bfun=bfun@entry=0x8129e60 <command_loop_1>, handlers=138890506, 
---Type <return> to continue, or q <return> to quit---
    hfun=hfun@entry=0x8121750 <cmd_error>) at eval.c:1344
#31 0x0811d235 in command_loop_2 (ignore=138857410) at keyboard.c:1170
#32 0x08189093 in internal_catch (tag=138888554, 
    func=func@entry=0x811d210 <command_loop_2>, arg=138857410) at eval.c:1108
#33 0x081213a2 in command_loop () at keyboard.c:1149
#34 recursive_edit_1 () at keyboard.c:777
#35 0x08121663 in Frecursive_edit () at keyboard.c:841
#36 0x08058e88 in main (argc=<optimized out>, argv=0xbffff544) at emacs.c:1598
(gdb) delete
Delete all breakpoints? (y or n) y
(gdb) cont
Continuing.
[Thread 0xb4bffb40 (LWP 29239) exited]
[Thread 0xb552fb40 (LWP 29237) exited]
[Thread 0xb5f07b40 (LWP 29235) exited]
[Inferior 1 (process 29197) exited normally]
(gdb) quit
jcdeb:/home# exit
exit

Script done on Wed 04 Dec 2013 09:23:44 PM CET

  parent reply	other threads:[~2013-12-04 20:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 18:42 bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-11-05 12:57 ` bug#15801: 15801: commit identified Jarek Czekalski
2013-11-06 19:48 ` bug#15801: it's a different revision, 112892 Jarek Czekalski
2013-11-21  6:00   ` Jan Djärv
2013-11-21  7:25     ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-11-30 11:41       ` Jan Djärv
2013-11-30 11:54         ` Eli Zaretskii
2013-11-30 12:51           ` Jan Djärv
2013-11-30 13:55             ` Eli Zaretskii
2013-11-30 14:05               ` Jan Djärv
2013-11-30 18:11               ` Jarek Czekalski
2013-11-30 18:38                 ` Eli Zaretskii
2013-11-30 17:04 ` Jarek Czekalski
2013-11-30 23:16   ` Jan Djärv
     [not found]     ` <529AF507.5080509@poczta.onet.pl>
     [not found]       ` <0440E2A5-37C6-4F29-9B5D-38A6AE88C3B5@swipnet.se>
     [not found]         ` <529B12DB.6020407@poczta.onet.pl>
2013-12-01 11:07           ` Jan Djärv
2013-12-01 11:38             ` Jarek Czekalski
2013-12-01 11:48               ` Jan Djärv
2013-11-30 17:10 ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs - stdout warning Jarek Czekalski
2013-12-02  8:04 ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-12-02  8:18 ` Jarek Czekalski
2013-12-02 17:11 ` Jarek Czekalski
2013-12-03 22:27 ` Jarek Czekalski
2013-12-04 20:28 ` Jarek Czekalski [this message]
2013-12-05 17:08   ` Jarek Czekalski
2013-12-07 14:34     ` Jan Djärv
2013-12-08 16:14 ` Jarek Czekalski
2013-12-08 23:29 ` Jarek Czekalski
2013-12-11 19:52   ` Jan Djärv
2013-12-20  6:32   ` Jarek Czekalski
2013-12-20  8:58     ` Eli Zaretskii
2014-04-21 10:34 ` Jarek Czekalski
2014-04-21 15:56   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529F9076.5040309@poczta.onet.pl \
    --to=jarekczek@poczta.onet.pl \
    --cc=15801@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).