Lazarus

Programming => Widgetset => GTK => Topic started by: winni on March 31, 2022, 01:37:34 am

Title: gtk2 steals 8 seconds
Post by: winni on March 31, 2022, 01:37:34 am
Hi!

If I start an app in the IDE it takes 7500 to 8500 ms between FormCreate and FormActivate. That's bothering.

If I start the same app from a console or a filemanager it takes 400..500 ms - that's ok.

System is Linux64, Suse Tumbleweed, fpc 3.2.2 Laz 2.2.0, gtk2

Happend maybe a week ago after a rolling release of Tumbleweed.

Suspected is something of gtk2.

Any ideas or experience?

Winni

Title: Re: gtk2 steals 8 seconds
Post by: dbannon on March 31, 2022, 02:44:44 am
Hmm, there was an issue involving a dbus timeout with gtk2, that was 20 seconds from memory -

https://forum.lazarus.freepascal.org/index.php/topic,47240.msg376845.html#msg376845

Its a long read ....

It was never resolved completely IMHO, related to Ubuntu leaving out some necessary package. But seems to pop up again and again ....

Davo
Title: Re: gtk2 steals 8 seconds
Post by: winni on April 03, 2022, 02:50:13 pm
Hi!

Thanx for the reply.

Still not solved.

In the 8 seconds when the app tries to start from the IDE the gdb consumes betwenn 70% and 90% of CPU time, Measured by Top.

Winni
Title: Re: gtk2 steals 8 seconds
Post by: Martin_fr on April 03, 2022, 04:39:58 pm
If it is only in the debugger.....

Well maybe gdb is loading debug info? Maybe your update installed debug info for gtk libraries (or some other libs that are loaded).

That would explain why the time is spent in gdb. And yes, gdb could be holding/pausing the app during that time.

You can disable gdb loading debug info for libs. Set  "DisableLoadSymbolsForLibraries" to "True". See:
https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working_.2F_SigSegv_with_Open.2FClose_Dlg
Title: Re: gtk2 steals 8 seconds
Post by: winni on April 03, 2022, 05:37:49 pm
Hi!

Thanx for your tipp.

I tried that but nothing changed.

Then I changed the build mode to "Release" - but nothing changed.

All the devel packages for gtk2 are installed.

I'm running out of ideas.

Winni
Title: Re: gtk2 steals 8 seconds
Post by: Martin_fr on April 03, 2022, 06:52:07 pm
Then I changed the build mode to "Release" - but nothing changed.

That wouldn't have changed the relevant libs/so files. => You don't rebuild the gtk.so files, if they had (included, or as separate file) any debug info (such that gdb could find it), then gdb would find it, even if the main exe was build without debug info.
Does the memory footprint of the gdb process increase during the slow down? Because if gdb loads debug info, that requires significant amount of memory.


There are plenty of other reasons for a process to be slow under a debugger. Those are not necessarily a fault of the process itself.

E.g., if the process (any code in the process, including libs/so) performs certain tasks (such as loading libs, triggering signals /sig..., eg sighup etc) then those signals may first be seen by the debugger.
Normally that is only a few ticks... But if the process triggers that a million times.... Well, unlikely ....

You can check
 menu: View > Ide internals > Debug output
for any feedback gdb prints.
Maybe it will have a hint.



Anyway, you said gdb is at high cpu usage during this time.

You could try fpdebug instead (search forum / announcements / wiki). Maybe you get better results. Depends what exactly is happening.
Title: Re: gtk2 steals 8 seconds
Post by: Tommi on April 03, 2022, 07:30:26 pm
Maybe it's something like this:

https://forum.lazarus.freepascal.org/index.php/topic,57653.msg429164.html#msg429164
Title: Re: gtk2 steals 8 seconds
Post by: rca on April 09, 2022, 09:07:25 pm

Could you try with:
Code: [Select]
export GTK_MODULES=gail:atk-bridge:appmenu-gtk-module
It worked for me on Zorin OS 16

https://forum.lazarus.freepascal.org/index.php/topic,51016.msg374099.html#msg374099 (https://forum.lazarus.freepascal.org/index.php/topic,51016.msg374099.html#msg374099)
Title: Re: gtk2 steals 8 seconds
Post by: winni on April 09, 2022, 09:24:26 pm

Could you try with:
Code: [Select]
export GTK_MODULES=gail:atk-bridge:appmenu-gtk-module
It worked for me on Zorin OS 16

https://forum.lazarus.freepascal.org/index.php/topic,51016.msg374099.html#msg374099 (https://forum.lazarus.freepascal.org/index.php/topic,51016.msg374099.html#msg374099)

Thanx for the hint but it did not change anything.

Working the most time with disabled debugger  and now the delay  is down to ~4000 ms.
Not a solution but endurable ....

Winni
TinyPortal © 2005-2018