Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-02

GUI freeze under GTK2

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

denisgolovan

Hi all

Recently, I've started experiencing rather nasty bug - my GUI application started freezing when scrolling VirtualTreeView component vertically using scrollbar. VTV itself is rather old version (last commit from May 17 2015). FPC and Lazarus are from trunk, svn rev.35396 and rev.54204. I am under Gentoo x64, gtk2 widgetset, gtk+ library v2.24.31-r1.

When paused after freezing, callstack always shows the following stack trace. So I assume there is some infinite loop running.

#0 poll at :0
#1 ?? at :0
#2 ?? at :0
#3 xcb_wait_for_reply at :0
#4 _XReply at :0
#5 XGetGeometry at :0
#6 gdk_window_get_frame_extents at :0
#7 gdk_window_get_root_origin at :0
#8 GETWIDGETRELATIVEPOSITION(0x7fffed8cc490, 0, 0) at gtk2/gtk2proc.inc:7001 #9 SENDSIZENOTIFICATIONTOLCL(0x7fffed8cc490) at gtk2/gtk2proc.inc:6530 #10 GTKSIZE_ALLOCATECB(0x7fffed8cc490, 0x7fffffffcd20, 0x7fffed90a040) at gtk2/gtk2callback.inc:2530 #11 g_closure_invoke(0x7fffed93ac50, 0x0, 0x0, 2, 0x7fffffffcab0, 0x7fffffffcab0, 0x7fffffffca50, 0x7fffffffca50) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:804 #12 signal_emit_unlocked_R(0x7fffee036f40, 0x7fffee036f40, 0, 0, 0x7fffed8cc490, 0x7fffed8cc490, 0x0, 0x0, 0x7fffffffcab0, 0x7fffffffcab0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3629 #13 g_signal_emit_valist(<optimized out>, <optimized out>, <optimized out>, 0x7fffffffcc40, 0x7fffffffcc40) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3385 #14 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #15 gtk_widget_size_allocate at :0
#16 ?? at :0
#17 _g_closure_invoke_va(0x7fffed8c96a0, 0x7fffed8c96a0, 0x0, 0x0, 0x7fffed8cc490, 0x7fffed8cc490, 0x7fffffffd060, 0x7fffffffd060, <optimized out>, 0x0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:867 #18 g_signal_emit_valist(0x7fffed8cc490, <optimized out>, 0, 0x7fffffffd060, 0x7fffffffd060) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3294 #19 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #20 ?? at :0
#21 ?? at :0
#22 g_main_dispatch(0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154 #23 g_main_context_dispatch(0x7fffee0442c0, 0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769 #24 g_main_context_iterate(0x7fffee0442c0, 0x7fffee0442c0, 0, 0, 1, 1, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840 #25 g_main_context_iteration(0x7fffee0442c0, 0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901 #26 APPPROCESSMESSAGES(0x7fffee1b6040) at gtk2/gtk2widgetset.inc:2328 #27 HANDLEMESSAGE(0x7fffee079540) at include/application.inc:1274 #28 RUNLOOP(0x7fffee079540) at include/application.inc:1411 #29 APPRUN(0x7fffee1b6040, {Proc = {procedure (POINTER)} 0x7fffffffd430, Self = 0x7fffee079540}) at include/interfacebase.inc:54 #30 RUN(0x7fffee079540) at include/application.inc:1399

Any hints on how to resolve?

Regards, Denis Golovan

Reply by email

Cyrax
to denisgolovan
denisgolovan wrote 42 lines
Hi all Recently, I've started experiencing rather nasty bug - my GUI application started freezing when scrolling VirtualTreeView component vertically using scrollbar. VTV itself is rather old version (last commit from May 17 2015). FPC and Lazarus are from trunk, svn rev.35396 and rev.54204. I am under Gentoo x64, gtk2 widgetset, gtk+ library v2.24.31-r1. When paused after freezing, callstack always shows the following stack trace. So I assume there is some infinite loop running. #0 poll at :0 #1 ?? at :0 #2 ?? at :0 #3 xcb_wait_for_reply at :0 #4 _XReply at :0 #5 XGetGeometry at :0 #6 gdk_window_get_frame_extents at :0 #7 gdk_window_get_root_origin at :0 #8 GETWIDGETRELATIVEPOSITION(0x7fffed8cc490, 0, 0) at gtk2/gtk2proc.inc:7001 #9 SENDSIZENOTIFICATIONTOLCL(0x7fffed8cc490) at gtk2/gtk2proc.inc:6530 #10 GTKSIZE_ALLOCATECB(0x7fffed8cc490, 0x7fffffffcd20, 0x7fffed90a040) at gtk2/gtk2callback.inc:2530 #11 g_closure_invoke(0x7fffed93ac50, 0x0, 0x0, 2, 0x7fffffffcab0, 0x7fffffffcab0, 0x7fffffffca50, 0x7fffffffca50) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:804 #12 signal_emit_unlocked_R(0x7fffee036f40, 0x7fffee036f40, 0, 0, 0x7fffed8cc490, 0x7fffed8cc490, 0x0, 0x0, 0x7fffffffcab0, 0x7fffffffcab0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3629 #13 g_signal_emit_valist(<optimized out>, <optimized out>, <optimized out>, 0x7fffffffcc40, 0x7fffffffcc40) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3385 #14 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #15 gtk_widget_size_allocate at :0 #16 ?? at :0 #17 _g_closure_invoke_va(0x7fffed8c96a0, 0x7fffed8c96a0, 0x0, 0x0, 0x7fffed8cc490, 0x7fffed8cc490, 0x7fffffffd060, 0x7fffffffd060, <optimized out>, 0x0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:867 #18 g_signal_emit_valist(0x7fffed8cc490, <optimized out>, 0, 0x7fffffffd060, 0x7fffffffd060) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3294 #19 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 #20 ?? at :0 #21 ?? at :0 #22 g_main_dispatch(0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154 #23 g_main_context_dispatch(0x7fffee0442c0, 0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769 #24 g_main_context_iterate(0x7fffee0442c0, 0x7fffee0442c0, 0, 0, 1, 1, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840 #25 g_main_context_iteration(0x7fffee0442c0, 0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901 #26 APPPROCESSMESSAGES(0x7fffee1b6040) at gtk2/gtk2widgetset.inc:2328 #27 HANDLEMESSAGE(0x7fffee079540) at include/application.inc:1274 #28 RUNLOOP(0x7fffee079540) at include/application.inc:1411 #29 APPRUN(0x7fffee1b6040, {Proc = {procedure (POINTER)} 0x7fffffffd430, Self = 0x7fffee079540}) at include/interfacebase.inc:54 #30 RUN(0x7fffee079540) at include/application.inc:1399 Any hints on how to resolve?

Can you try attached unit source file? You need to add in your main program sources before any LCL units and after cthreads/cmem units. -------------- next part --------------
unit unix_init_xlib;

{$mode objfpc}{$H+}
interface
implementation
uses
   xlib;
Var
  AStatus : TStatus;
initialization
   AStatus := XInitThreads;
   AStatus := AStatus;
finalization
end.

Reply by email

denisgolovan
to Cyrax

Nope.
No change with this unit.
Still freezes, stack track is the same.

BR,
Denis

21.02.2017, 17:49, "Cyrax via Lazarus" :

Show quoted text 50 lines
On 20.02.2017 22:37, denisgolovan via Lazarus wrote: >  Hi all > >  Recently, I've started experiencing rather nasty bug - my GUI application started freezing when scrolling VirtualTreeView component vertically using scrollbar. >  VTV itself is rather old version (last commit from May 17 2015). FPC and Lazarus are from trunk, svn rev.35396 and rev.54204. >  I am under Gentoo x64, gtk2 widgetset, gtk+ library v2.24.31-r1. > >  When paused after freezing, callstack always shows the following stack trace. So I assume there is some infinite loop running. > >  #0 poll at :0 >  #1 ?? at :0 >  #2 ?? at :0 >  #3 xcb_wait_for_reply at :0 >  #4 _XReply at :0 >  #5 XGetGeometry at :0 >  #6 gdk_window_get_frame_extents at :0 >  #7 gdk_window_get_root_origin at :0 >  #8 GETWIDGETRELATIVEPOSITION(0x7fffed8cc490, 0, 0) at gtk2/gtk2proc.inc:7001 >  #9 SENDSIZENOTIFICATIONTOLCL(0x7fffed8cc490) at gtk2/gtk2proc.inc:6530 >  #10 GTKSIZE_ALLOCATECB(0x7fffed8cc490, 0x7fffffffcd20, 0x7fffed90a040) at gtk2/gtk2callback.inc:2530 >  #11 g_closure_invoke(0x7fffed93ac50, 0x0, 0x0, 2, 0x7fffffffcab0, 0x7fffffffcab0, 0x7fffffffca50, 0x7fffffffca50) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:804 >  #12 signal_emit_unlocked_R(0x7fffee036f40, 0x7fffee036f40, 0, 0, 0x7fffed8cc490, 0x7fffed8cc490, 0x0, 0x0, 0x7fffffffcab0, 0x7fffffffcab0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3629 >  #13 g_signal_emit_valist(<optimized out>, <optimized out>, <optimized out>, 0x7fffffffcc40, 0x7fffffffcc40) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3385 >  #14 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 >  #15 gtk_widget_size_allocate at :0 >  #16 ?? at :0 >  #17 _g_closure_invoke_va(0x7fffed8c96a0, 0x7fffed8c96a0, 0x0, 0x0, 0x7fffed8cc490, 0x7fffed8cc490, 0x7fffffffd060, 0x7fffffffd060, <optimized out>, 0x0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gclosure.c:867 >  #18 g_signal_emit_valist(0x7fffed8cc490, <optimized out>, 0, 0x7fffffffd060, 0x7fffffffd060) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3294 >  #19 g_signal_emit(<optimized out>, <optimized out>, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/gobject/gsignal.c:3441 >  #20 ?? at :0 >  #21 ?? at :0 >  #22 g_main_dispatch(0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154 >  #23 g_main_context_dispatch(0x7fffee0442c0, 0x7fffee0442c0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769 >  #24 g_main_context_iterate(0x7fffee0442c0, 0x7fffee0442c0, 0, 0, 1, 1, <optimized out>) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840 >  #25 g_main_context_iteration(0x7fffee0442c0, 0) at /var/tmp/paludis/dev-libs-glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901 >  #26 APPPROCESSMESSAGES(0x7fffee1b6040) at gtk2/gtk2widgetset.inc:2328 >  #27 HANDLEMESSAGE(0x7fffee079540) at include/application.inc:1274 >  #28 RUNLOOP(0x7fffee079540) at include/application.inc:1411 >  #29 APPRUN(0x7fffee1b6040, {Proc = {procedure (POINTER)} 0x7fffffffd430, Self = 0x7fffee079540}) at include/interfacebase.inc:54 >  #30 RUN(0x7fffee079540) at include/application.inc:1399 > >  Any hints on how to resolve? Can you try attached unit source file? You need to add in your main program sources before any LCL units and after cthreads/cmem units. ,-- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus
Regards, Denis Golovan

Reply by email

denisgolovan
to Cyrax: Can you try attached unit source file? You need to add in your main program sources…

Hi

Not sure if it can help, but I rebuilt Lazarus with -dVerboseSizeMsg -dVerboseFormPositioning and I got following in console after GUI freeze. Those exact lines repeat endlessly in console.
TEngineObjectTree is virtualtreeview control.

TWinControl.WMSize A :TEngineObjectTree Message=192,67 BoundsRealized=l=1,t=1,r=193,b=68 WChg=False HChg=False FromIntf=True ClientRectInvalid=False gtksize_allocate_client: pnlEngineTree:TPanel widget=00007FFFED971020 NewSize=194,69 Allocation=194x69 Requisiton=193x68 gtksize_allocateCB: pnlEngineTree:TPanel widget=00007FFFED9238E0=GtkFrame [RMVDFStPrNwDb] LCLObject=00007FFFEE1E3340=pnlEngineTree:TPanel<Is MainWidget><Is CoreWidget> fixwidget=00007FFFED971020 NewSize=194,69 GtkPos=428,0,194x69 LCLPos=428,0,194x69 gdkwindow=622x69 SendSizeNotificationToLCL checking ... pnlEngineTree:TPanel Widget=[RMVDFStPrNwDb] gtksize_allocate_client: frmMain:TfrmMain widget=00007FFFED840980 NewSize=622,69 Allocation=622x69 Requisiton=0x0 gtksize_allocateCB: frmMain:TfrmMain widget=00007FFFED8CD380=GtkWindow [RMVDStPrApDb] LCLObject=00007FFFED850040=frmMain:TfrmMain<Is MainWidget><Is CoreWidget> fixwidget=00007FFFED840980 NewSize=622,69 GtkPos=0,0,622x69 LCLPos=2471,264,622x69 gdkwindow=622x69 VFP gtksize_allocateCB: TfrmMain 0,0
SendSizeNotificationToLCL checking ... frmMain:TfrmMain Widget=[RMVDStPrApDb] VFP SendSizeNotificationToLCL frmMain:TfrmMain 2471,264,622x69 00007FFFED8CD380=GtkWindow [RMVDStPrApDb] LCLObject=00007FFFED850040=frmMain:TfrmMain<Is MainWidget><Is CoreWidget> gtksize_allocate_client: :TEngineObjectTree widget=00007FFFED840A30 NewSize=177,65 Allocation=177x65 Requisiton=0x0 gtksize_allocateCB: :TEngineObjectTree widget=00007FFFED8BFB50=LCLWinapiWidget [RMVDFStPrNwDb] LCLObject=00007FFFED899440=:TEngineObjectTree<Is MainWidget> fixwidget=00007FFFED840A30 NewSize=192,67 GtkPos=1,1,192x67 LCLPos=1,1,192x67 gdkwindow=194x69 SendSizeNotificationToLCL checking ... :TEngineObjectTree Widget=[RMVDFStPrNwDb] SendSizeNotificationToLCL :TEngineObjectTree GTK=1,1,192x67 LCL=1,1,192x67

Regards, Denis Golovan

Reply by email

denisgolovan
to Juha Manninen

22.02.2017, 02:45, "Juha Manninen via Lazarus" :

What revision caused the freezing?

Unfortunately I wasn't able to track the culprit commit. I tried building with year old Lazarus sources (the earliest my project builds from), but the bug was still there. I reckon some changes in gtk/other libs triggered that.

I managed to make a fix/hack for my case though.
See attachment. Please take a look and comment.

Regards, Denis Golovan -------------- next part -------------- A non-text attachment was scrubbed... Name: resize.patch Type: text/x-diff Size: 599 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170225/58ed93c9/attachment.patch>

Reply by email

denisgolovan

28.02.2017, 12:31, "Juha Manninen" :

Show quoted text 7 lines
I tested it and could not see any problems. Everything works as before. However I don't know how to reproduce the original bug. The removed line may be needed for old GTK2 versions or for GTK1. The LCL-GTK2 binding code was copied from LCL-GTK1 and has many historical remains. I applied the change in r54305. Everybody please test with different GTK2 versions and desktop environments.

Thanks.

Regards, Denis Golovan

Reply by email

Juha Manninen
to denisgolovan
denisgolovan wrote 11 lines
28.02.2017, 12:31, "Juha Manninen" : > I tested it and could not see any problems. Everything works as > before. However I don't know how to reproduce the original bug. > The removed line may be needed for old GTK2 versions or for GTK1. > The LCL-GTK2 binding code was copied from LCL-GTK1 and has many > historical remains. > I applied the change in r54305. > Everybody please test with different GTK2 versions and desktop environments. Thanks.

Ok, it caused a problem after all. See:
http://bugs.freepascal.org/view.php?id=31496
The freezing loop must be solved some other way, or maybe the ButtonPanel layout could be fixed some other way, don't know.

You wrote:
"VTV itself is rather old version (last commit from May 17 2015)" There are at least 2 maintained main versions of VTV now, versions 4 and 5. Could you please update your VTV and test again.
If the problem continues then we need a demo application attached to the bug report to reproduce the error.
Then somebody, maybe Jesus Reyes, can try to fix it in VTV code.

Any ideas are welcome.

Regards,
Juha

Reply by email