Lazarus

Programming => General => Topic started by: gii on October 29, 2019, 05:56:59 pm

Title: IDE freezing the OS
Post by: gii on October 29, 2019, 05:56:59 pm
I installed Ubuntu 19.10 and Lazarus 2.0.4.

However, a few minutes after I start the IDE, Ubuntu freezes, and I have to force shut down my computer.

The IDE starts normally, but the screen (attached) stays open, and no matter how much I click one of the buttons, nothing happens.

I installed Lazarus using Gdebi (fpc, fpc-src and lazarus).

Can anyone tell why this happens?
Title: Re: IDE freezing the OS
Post by: lainz on October 30, 2019, 03:20:22 pm
Something similar happens with LazPaint
https://github.com/bgrabitmap/lazpaint/issues/92

When running it and resizing, it hangs and sometimes it freezes the system too.
Title: Re: IDE freezing the OS
Post by: Guva on October 30, 2019, 03:54:26 pm
On Linux mint, too, this happens if an error occurs in the process. but only noticed on Cinnamon.
Title: Re: IDE freezing the OS
Post by: circular on October 30, 2019, 07:37:57 pm
Hmmm it would be related to Lazarus 2.0.4 maybe?

I am on Linux Mint 19.1 Tessa and Lazarus 2.0.2 and not having this problem.
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 30, 2019, 07:57:21 pm
"Freeze the system" or "freeze the desktop environment"?

If it freezes the system, i.e. you can't SSH into the system or use <Ctrl><Alt><F1> to go to a text screen, it's a kernel problem: that quite simply shouldn't happen whatever abuse an application program is throwing at the system.

If it's "merely" freezing the desktop environment... I've seen that sort of thing happening when using Lazarus to debug a program using threads, but not (recently at least) with anything simpler.

MarkMLl
Title: Re: IDE freezing the OS
Post by: lainz on October 30, 2019, 08:13:55 pm
I'm not sure if the OS or the desktop environment. I'm running on a VM, at least all the desktop is not working and I must restart the VM to continue when executing LazPaint (but this happens sometimes, other times happens that I can kill the app).
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 30, 2019, 09:33:54 pm
I'm not sure if the OS or the desktop environment. I'm running on a VM, at least all the desktop is not working and I must restart the VM to continue when executing LazPaint (but this happens sometimes, other times happens that I can kill the app).

Does the VM have an IP address? Can you ping it from the host?

Unfortunately the VM aspect also raises the possibility that it could be a problem in the virtualisation of the video subsystem. Obviously it's highly undesirable that this sort of thing should happen, but I think that the important thing at this stage is to try to tie down whether it's "just" the IDE which is locking up (and taking the desktop environment with it) or whether there's something more serious involved.

I've got 2.1.0 built from trunk on Debian "Buster" with KDE and definitely haven't seen any lockups /except/ for debugging issues. That shouldn't really happen either, but at least it's possible to go to a text console (or SSH in) and kill Lazarus (plus gdb and the program being tested) which results in no lost work. In terms of kernel, X11 server and libraries etc. that's goung to be fairly close to Ubuntu 19.x
Title: Re: IDE freezing the OS
Post by: circular on October 31, 2019, 10:09:55 am
Maybe that could be related to the window manager. On my distro, you can change it in Paramaters > Desktop Parameters. It shows a list of window managers.
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 31, 2019, 11:13:17 am
Maybe that could be related to the window manager. On my distro, you can change it in Paramaters > Desktop Parameters. It shows a list of window managers.

It's certainly something worth considering. However the first thing is to reach consensus on whether

* Lazarus etc. is locking up and has to be killed using a window manager facility.

* Lazarus etc. is locking up and taking the window manager with it.

* Lazarus etc. is breaking the kernel (unlikely, and a kernel developer's problem).

An obvious part of the problem is that the modern desktop environment is rather more than the traditional window manager. It /used/ to be possible to change the window manager on the fly since basically all it was doing was providing the "furniture" around application windows, i.e. title bar etc. These days the window manager is basically chosen by the display manager (which handles login etc.), and includes much more that the traditional window manager.

Remember that if you change the desktop environment (window manager etc.) you might not have a convenient GUI option to change it back. Going through my historical notes I think the selection is stored in ~/.dmrc but that might actually redirect to another configuration file stored by the display manager. I suggest that anybody tinkering with this work that detail out before starting, or at the very least make sure that the display manager login screen has the option of selecting the window manager (desktop environment).

Another fair question is whether it's widget-set specific, i.e. are the apps which are failing built for gtk3 rather than gtk2 etc.

I'm not in the loop for trying to fix this, but those are basic support level questions that the people with the problem need to consider.

MarkMLl
Title: Re: IDE freezing the OS
Post by: dbannon on October 31, 2019, 11:34:16 am
gii, are you using the Wayland Display Server or xorg ?

During logon, the screen where you type in your password has, just under the password field a small gear symbol, it will allow to to change some bootup things, at least choose between Gnome on Xorg (default) or Gnome on Wayland (a silly choice).  May just be the issue, Ubuntu has, at this stage, not made Wayland the default like Fedora has, if you are using it, I suggest you try the other option.

Davo
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 31, 2019, 11:48:37 am
Actual appearance of the login screen might vary slightly depending on the display manager, but I'd hope that there's something equivalent there- even if the overall operating system has to be told to install additional desktop environments e.g. KDE or xfce in addition to Gnome.
Title: Re: IDE freezing the OS
Post by: dbannon on October 31, 2019, 12:09:38 pm
Hmm, I just checked, definitely a gear symbol under the password field but the choices are "Ubuntu" and Ubuntu on Wayland". And, as Mark hinted, any other desktop you may have installed.

And maybe that prompts the idea that gii could pretty easily add another desktop to the existing Ubuntu install and see if that helps. I would (predictably) suggest Mate ....

Davo
Title: Re: IDE freezing the OS
Post by: gii on October 31, 2019, 02:52:14 pm
Hello, sorry for the delay.

I've been using Windows for at least 10 years now, I'm migrating to the Linux world now, so sorry if I don't know how to respond properly.

I am using Ubuntu 19.10 Eoan Ermine in dual boot with Windows 10.

I didn't know the shortcut <Ctrl> <Alt> <F1>, so I tried <Ctrl> <Alt> <Dell>, <Ctrl><Shift> <Esc> and <Ctrl><Alt> <T>, but nothing happened . The system also did not respond to any clicks.

And another try, I accessed the system monitor, and killed the startlazarus and Lazarus processes, but the screen (attached in the first post) keeps popping up, seconds later the system froze.

I already tried to reinstall Lazarus, and it was no use. Right now I am reinstalling Ubuntu.
Title: Re: IDE freezing the OS
Post by: lainz on October 31, 2019, 03:03:18 pm
I commented on the LazPaint issue, this exact text:

I can't find a way to change the window manager from a setting.

I seen running lazpaint from the command line
Failed to load module "canberra-gtk-module"

Then I installed
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

LazPaint freezed at the beginning, but then a popup of the system come saying "lazpaint is ready".

Then from now when I run LazPaint it says 'lazpaint is not responding' but if I wait a few seconds, then it becomes responsive and I can use it.

Edit: seems that the OS is not freezing, just the desktop, because if I wait enough it gets responsive again---
Title: Re: IDE freezing the OS
Post by: dbannon on October 31, 2019, 11:00:41 pm
It would be interesting to run 'top' in that period where its becoming responsive again.

It might be able to tell us whats being 'used up', ie memory, cpu, file handles, karma .....

My app also complains about missing canberra-gtk, however it does not require it and things work perfectly with or without it. I add it to the requirements list in the deb and rpm files I make but just to avoid seeing error messages.

From memory, canberra is a sound processing thing ....

Davo
Title: Re: IDE freezing the OS
Post by: gii on November 01, 2019, 03:03:25 am
Unfortunately, the problem remains.

I ran the command "sudo apt install libcanberra-gtk-module libcanberra-gtk3-module", but the problem persists.

During freezing, I pressed <Ctrl> <Alt> <F1> and the system responded. But if I log in again, everything will remain frozen. If you try to shut down or restart your computer at the lock screen, nothing happens.

Sometimes I can use the IDE normally (for a few seconds / minutes), sometimes the IDE doesn't work correctly, where I click it resizes the code editor.

The "top" command as requested.

https://i.imgur.com/qwvpOt4.png
Title: Re: IDE freezing the OS
Post by: gii on November 01, 2019, 03:08:36 am
Someone had commented about checking the "Ubuntu with Wayland" option, I did that, and in this mode the IDE works perfectly.
Title: Re: IDE freezing the OS
Post by: dbannon on November 01, 2019, 05:23:17 am
Ha Ha, my advice was uncheck Ubuntu on Wayland, I was certain it would be bad for you if you were using Wayland ! I blame Wayland for many of the World's ills. Embola, reality TV, climate change.....

But you had to go and mess up my theory !   :D

Why on earth would it work on Wayland but not tried and tested Xorg ?? No idea.

That picture of top you took, was that while the GUI was locked up or after it became usable again ?

It appears Gnome-Shell was working hard but not hard enough to explain a lock up. Lazarus was just sitting by watching ....

What sort of machine are you running on ? One with more than one core I expect ?

Davo
Title: Re: IDE freezing the OS
Post by: gii on November 01, 2019, 02:05:29 pm
I have only options with and without Wayland.

I own an i7-5500U 2.40 GHz.

I took the screenshot, and the system froze.
Title: Re: IDE freezing the OS
Post by: c600g on November 01, 2019, 04:12:00 pm
I am having the same issue with Ubuntu 19.10 and Lazarus 2.0.6. No matter which display server I choose to use (X or Wayland), Lazarus 2.0.6 freezes on startup and takes down the entire desktop environment with it. I have to switch to a text virtual console and reboot from there.

I've just used fpcupdeluxe to install fpc fixes3.0 and Lazarus fixes2.0 (Qt5 interface) and it seems to work so far.

Alan
Title: Re: IDE freezing the OS
Post by: Zvoni on November 01, 2019, 08:11:58 pm
By any chance: Does anyone of you use nvidia-drivers?
Title: Re: IDE freezing the OS
Post by: gii on November 01, 2019, 10:00:49 pm
My video card is an AMD R7 M265.
Title: Re: IDE freezing the OS
Post by: dbannon on November 01, 2019, 11:17:30 pm
So you can reasonably easily add another desktop to your existing install. At present you are using either Gnome or Gnome on Wayland.  I'd suggest something like Mate or XFce, both are very lightweight, not too much to download and not too much disk space taken up.

Once installed, they add an extra item in that list that you see under the gear symbol, if you don't select it, it has no effect on your system other than a bit of extra disk eaten up.

sudo apt install mate-desktop-environment-core <enter>

or

sudo apt install xfce <enter>

If you want something a bit 'richer' look at Plasma or Cinnamon perhaps ?

When running these desktops, your system will look quite different but you will have little trouble figuring out what you need to do. But in gii's case at least, maybe you are happy using just gnome on wayland ? Your call.  But 'we' do need to figure out whats happening here ....

Davo


Title: Re: IDE freezing the OS
Post by: gii on November 01, 2019, 11:45:46 pm
I have full interest in solving the problem.

For now, I'll keep developing on Windows 10.

If anyone needs me to perform a test, or pass some information, I will be available.
Title: Re: IDE freezing the OS
Post by: lainz on November 02, 2019, 01:46:16 am
Someone had commented about checking the "Ubuntu with Wayland" option, I did that, and in this mode the IDE works perfectly.

How I can change that, when Installing ubuntu I checked automatic login, and now I don't see that gear to change the desktop mode...
Title: Re: IDE freezing the OS
Post by: dbannon on November 02, 2019, 04:12:58 am
Ian, if you logout, not poweroff, you should get to the login screen. I think.  Or maybe it will still skip that step in which case you will need to go into the setting and reverse that decision to do "automatic login".

(as an old sysadmin, shocked at the idea of an auto login, sigh ....)

 :)

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on November 02, 2019, 08:35:31 am
Someone had commented about checking the "Ubuntu with Wayland" option, I did that, and in this mode the IDE works perfectly.

How I can change that, when Installing ubuntu I checked automatic login, and now I don't see that gear to change the desktop mode...

Settings - Information - User
Unlock your user - uncheck Auto-Login
Title: Re: IDE freezing the OS
Post by: Zvoni on November 02, 2019, 08:40:40 am
Something else i noticed on my Ubuntu19.10:
The Desktop (System) freezes as described above when trying to open Textfiles with gedit which are reasonably big in size.
Haven't tried with nano (or any other editor). Since the Texteditor is a big part of the IDE it might be that (at least under Gnome).
Also haven't tried other WM's
Title: Re: IDE freezing the OS
Post by: circular on November 02, 2019, 11:08:15 am
I've just used fpcupdeluxe to install fpc fixes3.0 and Lazarus fixes2.0 (Qt5 interface) and it seems to work so far.
.
I wonder if it is version 2.0 that works better or Qt5.
Title: Re: IDE freezing the OS
Post by: dbannon on November 03, 2019, 09:21:08 am
OK, I can confirm this freeze up happens on a VM running 19.10. But not every time I start Lazarus, sometimes it starts and continues to run normally. My rough guess is that it fails, for me, on a Virtual Box allocated 4G ram one in four times. Using Lazarus 2.0.6 debs from sourceforge.

I have seen four such freezups now, in each case an initial startup, have not seen it happen in a restart. I blow away the config files between tries to ensure an initial start.

(I have been running Fedora 30 in a VM for a week now without any sign of this issue, about the same level of gnome and release time, that may indicate the freeze up is a Ubuntu only thing ?)

Davo

Davo
Title: Re: IDE freezing the OS
Post by: Ariador on November 03, 2019, 08:40:04 pm
Absolutely the same problem with Lazarus 2.0.2 under Ubuntu 19.10...
And as for the latest Lazarus 2.0.6 - it hangs the desktop right immediately, before even showing the welcome picture :(
Had to switch to another desktop with Ctrl-Alt-F8 and then press Ctrl-Alt-Del.
Title: Re: IDE freezing the OS
Post by: MarkMLl on November 03, 2019, 08:51:38 pm
Remember that you can go to a text console using <Crtl><Alt><F1> and use the kill or killall command to be a bit more selective.

MarkMLl


Title: Re: IDE freezing the OS
Post by: Zvoni on November 04, 2019, 11:37:40 am
OK, I can confirm this freeze up happens on a VM running 19.10. But not every time I start Lazarus, sometimes it starts and continues to run normally. My rough guess is that it fails, for me, on a Virtual Box allocated 4G ram one in four times. Using Lazarus 2.0.6 debs from sourceforge.

I have seen four such freezups now, in each case an initial startup, have not seen it happen in a restart. I blow away the config files between tries to ensure an initial start.

(I have been running Fedora 30 in a VM for a week now without any sign of this issue, about the same level of gnome and release time, that may indicate the freeze up is a Ubuntu only thing ?)

Davo

Davo, exactly my thoughts. I think it's an Ubuntu 19.10-thing, since i had freeze-ups that had nothing to do with Lazarus, but with trying to open files with the Texteditor

EDIT: Just found something suggesting it's a swap-Problem.
https://askubuntu.com/questions/1185491/ubuntu-19-10-freezes-and-lags-reguarly?noredirect=1&lq=1
The last 4 answers
Title: Re: IDE freezing the OS
Post by: dbannon on November 04, 2019, 12:06:41 pm
EDIT: Just found something suggesting it's a swap-Problem.
https://askubuntu.com/questions/1185491/ubuntu-19-10-freezes-and-lags-reguarly?noredirect=1&lq=1
The last 4 answers
Yes, looks an interesting read, well spotted !  My test u1910 is a VirtualBox VM, fresh install, no extensions. I have given it 4G of ram and, at first though giving it an 8G instead eliminated the problem. But going back to 4G also seemed to 'fix' it  :(

Thats when I realised it was erratic, needed losts of tests to get some valid statistics.

So, swap could indeed do just that, my VM has only 800M swap, thats plainly not enough. Although I do feel with 4G ram it should not really poke much into swap anyway doing what we have been doing. But  I will have a go at those suggestions tomorrow ....

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on November 04, 2019, 12:08:00 pm
EDIT: Just found something suggesting it's a swap-Problem.
https://askubuntu.com/questions/1185491/ubuntu-19-10-freezes-and-lags-reguarly?noredirect=1&lq=1
The last 4 answers
Yes, looks an interesting read, well spotted !  My test u1910 is a VirtualBox VM, fresh install, no extensions. I have given it 4G of ram and, at first though giving it an 8G instead eliminated the problem. But going back to 4G also seemed to 'fix' it  :(

Thats when I realised it was erratic, needed losts of tests to get some valid statistics.

So, swap could indeed do just that, my VM has only 800M swap, thats plainly not enough. Although I do feel with 4G ram it should not really poke much into swap anyway doing what we have been doing. But  I will have a go at those suggestions tomorrow ....

Davo
Check your swappiness-value
Title: Re: IDE freezing the OS
Post by: dbannon on November 05, 2019, 04:48:25 am
OK, some results.  Firstly, I am somewhat surprised to find that my (testing) VMs don't have a swap partition, instead depending on a /swapfile. Thats poor IMHO, dedicated partions were once considered the only worthwhile way to swap. But I just realized that my host machine is setup the same way. The host has 16G ram and a 1.4G swapfile, that also offends the old sysadmin in me.  Sigh.

Now, my results may not be directly related to the original question asker because my test machine is a VM but it sure is worth looking into.

'swapiness', its a measure of when, as we run out of ram, the system starts using swap. Ubuntu's default is apparently 60, it will use swap when 60 of ram is left. Now, my VMs get 4G ram, that 'should' be heaps (if you forgive the pun) so, I will set swappiness to 20 instead.

sudo sysctl vm.swappiness=20 <enter>

Note, that won't stick around after a boot. First two starts of Lazarus resulted in a lockup that required a reboot. So, I increased the swapfile size to 2G, See https://askubuntu.com/questions/927854/how-do-i-increase-the-size-of-swapfile-without-removing-it-in-the-terminal

Like this, I  repeatably started Lazarus and closed without saving config 11 out of 15 times. Four times I experienced a delay of maybe 30 seconds and then either things resumed  eventually, maybe a dialog would pop up saying Lazarus was not responding  and sometimes it needed a reset.

During these bad starts, the VM's cpu might go to 100%, gnome-shell was often reported to  be using most of that.

The extra swap space and lower swappiness certainly helped but did not solve the problem !

Similar results running Ubuntu on Wayland  and even Mate (but no so many tests done). Seems clear its a Ubuntu 1910 problem, not just Ubuntu Gnome.

Davo






Title: Re: IDE freezing the OS
Post by: Thaddy on November 05, 2019, 06:02:02 am
Well, I am old school and that is probably not relevant anymore with 16 or 32 GB desktop but I still always have a swap at least 1:1 with physical memory. 800MB is way too small.
Swap space will not be used if not necessary, but when necessary you will never know if the whole lot needs to be swapped. With VM's this is always the case anyway.
Title: Re: IDE freezing the OS
Post by: dbannon on November 05, 2019, 07:16:22 am
Yes, I agree a reasonable swap space is important but I don't think its core to this problem. I can still see the problem if I give the VM 8G !

I'll pull down Lazarus source and build that way, see if it still does it, maybe I can do some debugging.....

(Recent advise does not seem to be the 1:1 swap ratio, Ubuntu talks about the sqr root of your ram (in Gigs) when more than 4 (?) is available.  Clearly is all lazy swap these days ....

Davo 
Title: Re: IDE freezing the OS
Post by: 440bx on November 05, 2019, 07:35:22 am
(Recent advise does not seem to be the 1:1 swap ratio, Ubuntu talks about the sqr root of your ram (in Gigs) when more than 4 (?) is available.  Clearly is all lazy swap these days ....

Davo
Mark Russinovich has a series of excellent articles (as is most everything he does) about memory management and in one them, he addresses the advice given on pagefile size (among other things.)

The article is found at https://blogs.technet.microsoft.com/markrussinovich/2008/11/17/pushing-the-limits-of-windows-virtual-memory/  and while it is Windows specific, what he says about the size of the pagefile is applicable to just about any virtual memory based OS.

If more people read Mark's blog, they would probably give better advice concerning what a "recommended" size of the pagefile should be ;)


Title: Re: IDE freezing the OS
Post by: dbannon on November 05, 2019, 08:57:48 am
Now I am, sort of, starting to think this is a dbus issue.  There are some reports of delays starting app in U1910 and the delay is believed to be the dbus timeout.

I found starting lazarus with its own dbus daemon seems to help -

dbus-run-session startlazarus <enter>

That started the deb installed lazarus 15 time in a row without incident.  I did the same with a locally built lazarus, again, 15 times without incident. 

I am not suggesting this is a fix, but maybe it will help someone who understand what lazarus is doing over dbus to identify the issue ??

Davo

PS 440bx, thanks for that link, I notice its a 2008 release, I will have a read but I do suspect the relative cheapness of ram these days and the follow on of people having so much more may date it a bit ?  When I was running HPC systems, if we saw a user's job running into swap, we'd consider killing in, certainly suggest to them they need to have a little think ....

Davo
Title: Re: IDE freezing the OS
Post by: 440bx on November 05, 2019, 09:28:20 am
PS 440bx, thanks for that link, I notice its a 2008 release, I will have a read but I do suspect the relative cheapness of ram these days and the follow on of people having so much more may date it a bit ?  When I was running HPC systems, if we saw a user's job running into swap, we'd consider killing in, certainly suggest to them they need to have a little think ....

Davo
You're welcome and your point that the article is "a bit old" is valid but, my own experience is that what he states about the page file remains and, has remained true throughout the years.  Specifically, the more RAM we put in our machines the more programs we feel free to run simultaneously.  For instance, most of the time, I'm running three (3) VMs, each consumes more memory than what my 2008 machine had in total.  It seems that, no matter how much RAM we have, we'll always consume more than what's available, in part because the programs we use keep getting bigger and bigger, most development environments are good examples of that and, more and more "utility" type programs are needed/useful to get the job done, e.g, text editors, debuggers, hex editors, CLIs, file explorers, internet browsers (which consume ever more memory, mine is consuming 1.5GB as I type this!), etc, etc.

Basically, the pagefile is a binary credit card, don't compute without it. !! ;) 
Title: Re: IDE freezing the OS
Post by: Zvoni on November 05, 2019, 05:26:48 pm
LOL, just did a update-check on my U1910, and there are 6 updates, ALL for problem reporting, crash reporting etc.
BRUAHAHAHA
Title: Re: IDE freezing the OS
Post by: Zvoni on November 06, 2019, 09:32:05 am
OK Folks.
I'm pretty sure now, that the freezing of Ubuntu19.10 on Gnome has nothing to do with Lazarus.
I wanted to test Lubuntu in a VirtualBox yesterday.
The only thing running on my Ubuntu19.10/Gnome was VirtualBox.
8GB RAM/16GB swap/swappiness=30
When i tried installing Lubuntu (assigned: 4GB RAM, 1 CPU, 50GB VDI) from a mounted ISO inside the VirtualBox = FREEZE!
So, apparently, there is nothing wrong with FPC/Lazarus, but definitely something with U1910/Gnome
Title: Re: IDE freezing the OS
Post by: dbannon on November 06, 2019, 10:40:40 am
Well, those updates make no difference.  I'd like to see some updates that mention DBUS....

I wonder if the problem relates to apps using GTK2, may explain why not all apps are a problem ?  Just speculation I'm afraid.

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on November 06, 2019, 12:23:01 pm
Well, those updates make no difference.  I'd like to see some updates that mention DBUS....

I wonder if the problem relates to apps using GTK2, may explain why not all apps are a problem ?  Just speculation I'm afraid.

Davo

Davo, coud you take a look here?
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1834583
Starting from Post #16 could you check out, if it applies to you?
I'll be able to check it myself on Thursday evening.
Title: Re: IDE freezing the OS
Post by: c600g on November 06, 2019, 11:13:54 pm
I've just used fpcupdeluxe to install fpc fixes3.0 and Lazarus fixes2.0 (Qt5 interface) and it seems to work so far.
.
I wonder if it is version 2.0 that works better or Qt5.

I just rebuilt Lazarus using fpcupdeluxe for the Gtk widget set, and experienced the same semi-freeze experienced with the .deb packages. It must be a Gnome issue. I've also encountered long launch times for other applications, so I think there is something fundamentally borked in the Gnome / GTK environment.

Alan
Title: Re: IDE freezing the OS
Post by: dbannon on November 06, 2019, 11:19:41 pm
I just rebuilt Lazarus using fpcupdeluxe for the Gtk widget set, and experienced the same semi-freeze experienced with the .deb packages. It must be a Gnome issue. I've also encountered long launch times for other applications, so I think there is something fundamentally borked in the Gnome / GTK environment.

No, I am afraid its more than just Gnome(-shell), I have tested two other ubuntu desktops and they show the same problem.  Interesting, my app (which is quite small) works fine. I still think it relates to dbus (my app does not use dbus) but have just not had the time to try and isolate it down....

Davo
Title: Re: IDE freezing the OS
Post by: dbannon on November 07, 2019, 08:17:45 am
I still think it relates to dbus (my app does not use dbus) but have just not had the time to try and isolate it down....

Two problems with that theory, firstly, I cannot find any dbus action in the Lazarus IDE and, secondly, I made a small pascal dbus comms app that responds instantly. Sigh ....

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on November 07, 2019, 06:56:35 pm
OK, quick report.
i found on bugs.launchpad.net a lot of entries complaining about freezes on U1910
In nearly every single instance, the dev's/mod's there said to remove (not just disable) any gnome-shell-extensions (in particualr 3rd party) and to test again.
What do you know? i removed some extensions i don't use, and now it seems (!) to work.
While on Tuesday i could not even install an OS in my VirtualBox, now it ran without problem.
Had System-Monitor running and i watched it closely for hangups (CPU=100%) and/or running out of RAM.

Suggestion: Everybody who has freezes, remove extensions!
I don't know if it's any particular extension fouling everything up, but that's what it was for me, at least up until now.

Will have to do some more tests with actions which did cause a Lock-up (would you believe it? opening a 2MB Textfile with gedit locked up my system)

EDIT: What i remember removing:
Window Placement (or whatever it's called)
Harddisk LED (or something)
No Annoyance
Title: Re: IDE freezing the OS
Post by: c600g on November 07, 2019, 11:41:32 pm
My install of Ubuntu 19.10 was a fresh one, with no gnome shell extensions present. :-s

Alan
Title: Re: IDE freezing the OS
Post by: dbannon on November 07, 2019, 11:49:10 pm
Not wanting to rain on your parade, my test rig is a U1910 VM, clean install, updated as recommended. Only one extension manually installed, Applications Menu, I have removed it, logged out, logged in same issues.

Quote
Davo, coud you take a look here?
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1834583

No, I don't think so. Thats a problem that crops up as a window closes, we see the lockup before any windows are displayed. It was reported to have been fixed in mutter (3.32.2+git20190711-2ubuntu1) and U1910 uses 3.34...

I 'think' but am not sure that mutter is only used with Wayland, that means Gnome-shell only right now. I can demo this problem on (eg) Mate Desktop too.

Davo
Title: Re: IDE freezing the OS
Post by: dbannon on November 08, 2019, 07:48:53 am
All right, here is a very back handed solution but it has passed my 15 starts in a row test, twice !  A version of Lazarus 206 built with QT5 instead of GTk2 ! 

Here is how, if starting from fresh install, see note below if you already have an install. By the way, this is how I always install Lazarus (apart from the Qt5 thing), you end up with a heap more usable system.

Building a QT5 version of Lazarus
1. sudo app Install fpc fpc-source <enter>   // 580meg,  see below if you already have a compiler installed.
2. sudo app install libqt5pas-dev    // ~49meg
3. sudo app install subversion <enter>  // ~10meg, for the svn command
4. mkdir -p bin/Lazarus; cd bin/Lazarus <enter>
5. svn checkout http://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6 <enter>
6. cd lazarus_2_0_6 <enter>
7.  make bigide LCL_PLATFORM=qt5 <enter>

Notes
* If you already have a fpc installed, perhaps from the sourceforge repo, skip step 1. Indeed, if you already have a binary Lazarus install of any sort, please use your package manager (not rm) to remove it, will avoid a lot of confusion later on. But leave your fpc there, it does not matter which one you use as long as its 3.0.4
* Have a look at the wiki page, Installing Lazarus_on_Linux to see how to make menu entries and pretty icons.
* While your Lazarus IDE is using Qt5 widget set, it still defaults to producing gtk2 applications. And, obviously, can be used to make GTK3 or Qt5 ones if you so set it.
* If you distribute Qt5 binaries, don't forget that they will be dependent on libqt5pas1, just marking that as a dependency is enough, the package managers will pull down the other necessary libraries. That dependancy is worth 49Meg of disk, compare to GTK2.0 at 321Meg. Hmm....

If we find other people can confirm that this fixes their problem, it leaves me wondering if the issue is within Ubuntu's GTK2 kit. Frankly, I don't think they will be willing to put much effort into fixing it if that's the case ! Nasty.

Thank sash on the forum for putting this idea into my head.

Title: Re: IDE freezing the OS
Post by: Zvoni on November 08, 2019, 08:02:40 am
Not wanting to rain on your parade, my test rig is a U1910 VM, clean install, updated as recommended. Only one extension manually installed, Applications Menu, I have removed it, logged out, logged in same issues.

Quote
Davo, coud you take a look here?
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1834583

No, I don't think so. Thats a problem that crops up as a window closes, we see the lockup before any windows are displayed. It was reported to have been fixed in mutter (3.32.2+git20190711-2ubuntu1) and U1910 uses 3.34...

I 'think' but am not sure that mutter is only used with Wayland, that means Gnome-shell only right now. I can demo this problem on (eg) Mate Desktop too.

Davo

Damn! You're right.
I just noticed everything working more smoothly after removing the extensions (more "fluid"), but then i started Lazarus, and for the heck of it, i wanted to recompile it to QT5-Interface, and BANG: Lock-Up.
after recovering (CTRL+ALT+F1), started Lazarus anew, Recompile to QT5, and it worked.
Will have to watch it now.
Title: Re: IDE freezing the OS
Post by: dbannon on November 08, 2019, 08:43:39 am
I just built my tomboy-ng app, 14k lines of code plus KControls, all on a VM with 4gig ram and no fiddling with swap. I am starting to feel a bit confident.

I am not that sure I consider this a good solution but it is a solution !  And the "build lazarus from source" is always my preferred approach. But not looking forward to what I put on the wiki " .... unless you are using Ubuntu 19.10....".  I think we also need to log this in mantis too.

Davo
Title: Re: IDE freezing the OS
Post by: tk on November 12, 2019, 04:02:43 pm
Hi, experiencing the same freezes on my Ubuntu 19.10 vmdk.
How do I build Lazarus with Qt5 using fpcupdeluxe?
I installed fpc+laz using https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.4d/fpcupdeluxe-x86_64-linux

The following does not work for me:
7.  make bigide LCL_PLATFORM=qt5 <enter>

Thanks
Title: Re: IDE freezing the OS
Post by: dbannon on November 13, 2019, 10:56:52 am
Hi, experiencing the same freezes on my Ubuntu 19.10 vmdk.
How do I build Lazarus with Qt5 using fpcupdeluxe?
I installed fpc+laz using https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.4d/fpcupdeluxe-x86_64-linux

The following does not work for me:
7.  make bigide LCL_PLATFORM=qt5 <enter>

Thanks
You might be confusing two approaches here TK, if you decide to use fpcupdeluxe you don't build the Qt5 version of Lazarus, however, I will be surprised (pleasantly so) if it avoids whatever this mystery problem in U1910.    If you want to build a Qt5 version, and indications are that does avoid the problem, you should download the source (using svn), install the Qt5 libraries, and then build with that command. Refer to wiki.

I guess it would be possible to build a Qt5 Lazarus from the source delivered by fpcupdeluxe but you would want to know what changes have been made ....

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on November 13, 2019, 11:43:05 am
Hi, experiencing the same freezes on my Ubuntu 19.10 vmdk.
How do I build Lazarus with Qt5 using fpcupdeluxe?
I installed fpc+laz using https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.4d/fpcupdeluxe-x86_64-linux

The following does not work for me:
7.  make bigide LCL_PLATFORM=qt5 <enter>

Thanks
You might be confusing two approaches here TK, if you decide to use fpcupdeluxe you don't build the Qt5 version of Lazarus, however, I will be surprised (pleasantly so) if it avoids whatever this mystery problem in U1910.    If you want to build a Qt5 version, and indications are that does avoid the problem, you should download the source (using svn), install the Qt5 libraries, and then build with that command. Refer to wiki.

I guess it would be possible to build a Qt5 Lazarus from the source delivered by fpcupdeluxe but you would want to know what changes have been made ....

Davo
My FPC304/Laz206 is installed with fpcupdeluxe --> Standard-IDE gtk2 --> Freezes.
Start the gtk2-IDE (hope no freeze-up's), recompile IDE with widgetset QT5.
Done
Title: Re: IDE freezing the OS
Post by: c600g on November 15, 2019, 12:47:26 am
Hi, experiencing the same freezes on my Ubuntu 19.10 vmdk.
How do I build Lazarus with Qt5 using fpcupdeluxe?

I did it by downloading the following version of fpcupdeluxe:

fpcupdeluxe-x86_64-linux-qt5

Note that you'll need to have the Qt-dev libraries installed (qt5-dev package), as well as the libqt5pas1 and libqt5pas-dev packages for Ubuntu 19.10.

Alan
Title: Re: IDE freezing the OS
Post by: Zvoni on November 22, 2019, 11:35:35 am
Not wanting to rain on your parade, my test rig is a U1910 VM, clean install, updated as recommended. Only one extension manually installed, Applications Menu, I have removed it, logged out, logged in same issues.

Quote
Davo, coud you take a look here?
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1834583

No, I don't think so. Thats a problem that crops up as a window closes, we see the lockup before any windows are displayed. It was reported to have been fixed in mutter (3.32.2+git20190711-2ubuntu1) and U1910 uses 3.34...

I 'think' but am not sure that mutter is only used with Wayland, that means Gnome-shell only right now. I can demo this problem on (eg) Mate Desktop too.

Davo

Funny enough, when i ran Update on my Ubuntu-machine yesterday, i got updates for gir and mutter.....
Haven't tested for IDE-freezes with gtk2-IDE
Title: Re: IDE freezing the OS
Post by: xinyiman on November 30, 2019, 11:29:39 pm
Hi, I also have the same problem. Sometimes the Lazarus IDE and the programs that I compile with lazarus at startup send the graphic environment into freeze. Has anyone solved it ?!
Title: Re: IDE freezing the OS
Post by: dbannon on December 01, 2019, 12:28:56 am
Has anyone solved it ?!
Not as far as I know.   Are you using Ubuntu 19.10 ?   Thats where all reports focus ...

I don't use U19.10 myself, have only seen this problem in a VM running tests.  I did find that a QT5 version of Lazarus (and, obviously, making QT5 apps) did seem to solve the problem. I suspect that its a problem with Ubuntu's GTK2 but, really, no one knows for sure.

The next release of Ubuntu will be the long term support release, if it has the same problem, we will be stuck with it for many years !

Davo
Title: Re: IDE freezing the OS
Post by: xinyiman on December 01, 2019, 12:39:41 pm
And it really is a big problem. But has anyone already communicated the problem to those who develop and maintain the ubuntu project?
Title: Re: IDE freezing the OS
Post by: Handoko on December 01, 2019, 12:49:07 pm
I am using Ubuntu Mate 19.10 + Lazarus 2.0.6 GTK2 64-bit, so far I haven't experienced any freeze issue. But I didn't test it intensively because I am busy with other non-programming tasks after upgraded to Ubuntu 19.10.
Title: Re: IDE freezing the OS
Post by: xinyiman on December 01, 2019, 02:25:13 pm
This morning I made updates to ubuntu and it seems to not do it anymore. Is it also up to you?
Title: Re: IDE freezing the OS
Post by: Handoko on December 01, 2019, 02:48:21 pm
I've just tried to update, my Ubuntu Software Updater still worked.
Title: Re: IDE freezing the OS
Post by: xinyiman on December 01, 2019, 09:25:05 pm
I meant to say that after making ubuntu updates when I use lazarus it no freeze my Ubuntu
Title: Re: IDE freezing the OS
Post by: dbannon on December 01, 2019, 10:34:45 pm
And it really is a big problem. But has anyone already communicated the problem to those who develop and maintain the ubuntu project?

As far as I know, it has not been put in Mantis yet because its simply not repeatable. There have been several 'fixes' defined that ended up being wrong. We need to hear from the people who switched over to QT5 (if they did) as to whether of not that definitely fixed it. Nothing less than a week's testing with zero freezes would be acceptable IMHO.

So, if you think recent updates fixed it, please keep using (the gtk2 version) it for at least a week and post back here !  Be really good if you could note down what was updated ....

Davo

Davo
Title: Re: IDE freezing the OS
Post by: ChrisR on December 02, 2019, 04:34:09 pm
I believe this is the same issue as
  https://forum.lazarus.freepascal.org/index.php/topic,47125.0.html
I reported this on Mantis
  https://bugs.freepascal.org/view.php?id=36359

I just did an update on Ubuntu 19.10 this morning, including a hard restart. The problem seems to persist with me. As I note, the system does not freeze with the default hello world GTK2 program compiled in C, and it seems like any Lazarus project (including the IDE) compiled for the GTK2 widgets gets stuck in a loop checking TGtk2WidgetSet.AppProcessMessages for about 25 seconds. Any solutions appreciated (so far, QT5 seems my best solution).
Title: Re: IDE freezing the OS
Post by: ChrisR on December 02, 2019, 06:12:26 pm
I have updated the Mantis notes with solutions that worked for me. Maybe others can test and see if this solves their issues:


This page details solutions
    https://askubuntu.com/questions/1184774/some-applications-on-ubuntu-19-10-very-slow-to-start
 1.) launch program as super user ("sudo ./project1")
 2.) launch application with launch "dbus-launch --exit-with-session ./project1"
 3.) Run "sudo apt-get install appmenu-gtk2-module" and restart your computer - after this applications launch quickly, though they report
        [DEBUG] Name com.canonical.AppMenu.Registrar does not exist on the session bus
Title: Re: IDE freezing the OS
Post by: dbannon on December 02, 2019, 10:47:37 pm
I have updated the Mantis notes with solutions that worked for me. Maybe others can test and see if this solves their issues:


This page details solutions
    https://askubuntu.com/questions/1184774/some-applications-on-ubuntu-19-10-very-slow-to-start
 1.) launch program as super user ("sudo ./project1")
 2.) launch application with launch "dbus-launch --exit-with-session ./project1"
 3.) Run "sudo apt-get install appmenu-gtk2-module" and restart your computer - after this applications launch quickly, though they report
        [DEBUG] Name com.canonical.AppMenu.Registrar does not exist on the session bus

Yeah, I suspected DBus early on. The default timeout is about 25 seconds.  But near as I could tell, Lazarus does not do dbus. And "qdbus -l" does not list it (I believe qdbus lists all dbus actors, not just QT ones).

And I have certainly seen the problem in (Lazarus) apps that don't use DBus.

The message about the name not existing has been there in all GTK2 apps since, at least U18.04 and is benign, its a debug statement left in a library, I am a bit disappointed its still there in U19.10



Lets wait and see .....

Davo
Title: Re: IDE freezing the OS
Post by: ChrisR on December 03, 2019, 02:10:58 pm
Davo
 I think for GTK apps you use gdbus, not qdbus:
   command 'gdbus' from deb libglib2.0-bin (2.62.1-1)
 I am unfamiliar with how to use these tools. Is there a way to use this to monitor a simple Lazarus application, e.g. if I have a GTK2 project "~/project1" how can I see when it is calling the dbus?
Title: Re: IDE freezing the OS
Post by: dbannon on December 03, 2019, 10:52:33 pm
ChrisR, I am currently working on a Lazarus app that uses DBus, I compile and run a GTK2 version of it and qdbus does find it.

And running "find ide  |  xargs  grep  -ni  dbus   2>  /dev/null" from the Lazarus source tree finds nothing.  That says to me that Lazarus does not mention dbus anywhere is in its source.

But more importantly, are you running freeze free now ?

Davo
Title: Re: IDE freezing the OS
Post by: ChrisR on December 05, 2019, 05:20:55 pm
Davo-
  I have two machines running 19.10. On one I installed appmenu-gtk2-module and GTK2 apps now load on that machine instantly. For testing, I have not upgraded the other machine, and it still has the delays (unless I launch with sudo or  ""dbus-launch --exit-with-session"). While Lazarus may not explicitly call dbus, it seems like some part of the GTK2 widgetset implicitly invokes dbus. As others have noted, some non-Lazarus GTK2 tools have the same behavior (hexchat), but not all. Is there any way to see what calls are queued during the delay? Happy to help bebug this, but I have very little insight into the GTK2 widgetset.
Title: Re: IDE freezing the OS
Post by: dbannon on December 06, 2019, 12:32:23 am
Davo-
  I have two machines running 19.10. On one I installed appmenu-gtk2-module and GTK2 apps now load on that machine instantly.
OK, Chris, are you saying that just installing appmenu-gtk2-module makes the problem go away or are you then using it to put the dbus-launcher env var in front of your launch commands ?

The askubuntu links seem to suggest the latter approach ....

Big difference, if it is just a case of adding appmenu~ to the dependencies list, wow, I agree, you have a solution !    But if thats just a tool to help make the command to launch any Lazarus app in its own DBus env, thats not really viable. We cannot suggest to end user that they run a separate DBus instance with every app they run.

(and by the way, I do like your determination to get this solved ! )

Davo
Title: Re: IDE freezing the OS
Post by: ChrisR on December 06, 2019, 01:16:36 am
Yes, installing app menu completely resolved the issue on my computer, no need for other hacks.
Title: Re: IDE freezing the OS
Post by: dbannon on December 06, 2019, 07:03:07 am
In that case, congratulations ! You have solved it !

I'll run a clean vm and confirm your findings !

(And congrats on becoming a full member too ! )

Davo
Title: Re: IDE freezing the OS
Post by: JuhaManninen on December 06, 2019, 07:32:09 am
The last note in issue
 https://bugs.freepascal.org/view.php?id=36359
now lists solutions. I understand they are alternatives to each other and the last one is recommended. Is that correct? I will resolve it as "no change required".
Title: Re: IDE freezing the OS
Post by: dbannon on December 06, 2019, 12:19:12 pm
Hmm, yep, appmenu-gtk2 certainly seems to solve the problem. I have absolutely no idea why however. It also brings in a dependency that is not the active ingredient.  Between them, they add  175K to the install.

Juha, I don't think this is a "no change required", instead the change is we need is to add appmenu-gtk2 to the Lazarus Deb's list of dependencies. Its quite small and will otherwise do no harm. It seems to already be on most older Ubuntus that were more GTK2 friendly.

(Although I note once installed, removing it seems to leave the system unstable until a reboot. Thats something I really don't like but there is no reason anyone would bother to remove it unless doing bulk testing like I've been doing.)

We also need to tell everyone that this [expletive deleted] library might be needed to be added to the dependency list for other Lazarus apps. ldd does not mention it so just how we tell in advance, I don't know.

Why it works is still a mystery however. Its about translating the older menu entries (presumably the desktop files). Starting (eg) lazarus from the command line should not involve these two libraries in any way. But other people appear to have solved other, similar problems this way too. Sigh ....

Davo


Title: Re: IDE freezing the OS
Post by: ChrisR on December 06, 2019, 02:22:53 pm
I would also suggest we keep the bug open as the fix is not intuitive for users who experience the problem. There seem to be two possible long term solutions:

1. Ubuntu gets updated to support all the GTK2 applications that are impacted
  https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1852016
2. We work out a patch for Lazarus that allows Lazarus and applications built by Lazarus to avoid these penalties.
Title: Re: IDE freezing the OS
Post by: JuhaManninen on December 06, 2019, 10:22:42 pm
Juha, I don't think this is a "no change required", instead the change is we need is to add appmenu-gtk2 to the Lazarus Deb's list of dependencies. Its quite small and will otherwise do no harm. It seems to already be on most older Ubuntus that were more GTK2 friendly.
Ok. It means the Ubuntu maintainers should update their .deb package. Mattias should add the dependency for the .deb of next release.

I would also suggest we keep the bug open as the fix is not intuitive for users who experience the problem. There seem to be two possible long term solutions:

1. Ubuntu gets updated to support all the GTK2 applications that are impacted
  https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1852016
2. We work out a patch for Lazarus that allows Lazarus and applications built by Lazarus to avoid these penalties.
A patch for Lazarus would be the ideal solution. How to make it? What pulls in the dependency? I don't even know what appmenu-gtk2 does.
Title: Re: IDE freezing the OS
Post by: dbannon on December 07, 2019, 12:14:13 am
A patch for Lazarus would be the ideal solution. How to make it? What pulls in the dependency? I don't even know what appmenu-gtk2 does.

I suspect the solution is to use GTK3, its not a 'patch to GTK2 issue'.  ::)

What this library does is take the GTK2 way of describing menu entries for an app and turn them into a DBus compliant equivalent, sends the relevent data up via DBus to the Desktop. But it seems to be more than 'just' dealing with menu entries because its loaded at run time even when the app has not been started with a menu click. Might allow, for example, the icon to show on a Dock or  right click to add it to 'favourites'.  I have used strace on both Lazarus and my app, tomboy-ng, and both do try to load libappmenu-gtk2 at startup. If its not present, they appear to fail silently and, sometimes, go into this freeze state.

We could take the approach that its a Ubuntu bug, GTK2 should be dependent on appmenu-gtk2. Its there in older systems that are more supportive of GTK2 and its small and does no harm.  But whether we can interest Ubuntu in changing something they wish to see the end of, I don't know.

I think our only solution right now is to

* get it mentioned in the Lazarus Deb's dependencies.
* Mention it on the wiki for people building Lazarus from source
* Mention, repeatedly, that if you distribute a Lazarus app it probably is dependent on appmenu-gtk2.
* Nag Ubuntu to add it to GTK2's list. Almost certainly won't change U19.10 but maybe the LTS U20.04 ?

Chris and I will watch the forum, Juha, can you trigger an addition to the Lazarus Deb's dependencies list ?

EDIT: Note that Fedora does not have anything like appmenu-gtk2, that says its one of those things Ubuntu add to make their OS a bit friendlier. Fedora are happy to say, "you are not keeping up, goodbye!".

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on December 07, 2019, 12:54:17 pm
Just something funny i noticed:
Since people mentioned VLC being slow on startup, and after installing appmenu-gtk2-module, it starts faster:
i just did a "vlc" from a terminal..... --> Gtk-Message: 12:52:56.533: Failed to load module "appmenu-gtk-module"
LOL? Gtk? Not Gtk2?
Title: Re: IDE freezing the OS
Post by: dbannon on December 07, 2019, 11:52:16 pm
Sorry, not quite sure what you are saying there Zvoni.

There certainly a number of other applications that are are affected by this bug, its not just Lazarus or Lazarus Applications. And, apparently, installing appmenu-gtk2 solves it for all of them.

Now, totally guessing about whats happening.  As there are many ways to get things done in GTK2, my guess is that all GTK2 apps use a particular GTK2 thing (perhaps present their menu icon credentials to the OS in a particular way) are affected.  So, the problem is not in Lazarus Code but does relate to how the original Lazarus developers choose to do that thing. Obviously, LCL developers choose the same way. Back then, it was a safe and correct choice.

But now, distros all want to leave out as much GTK2 as they can, some leave it all out. And the leaving out of appmenu-gtk2 even when GTK2 is manually installed is causing us (and heaps of other apps) a problem.

Add appmenu-gtk2 to your list of dependencies and your app will work OK.  I am yet to find out what alien does when converting a Deb to an RPM package, the RPM world does not know about appmenu-gtk2 ....

Davo
Title: Re: IDE freezing the OS
Post by: winni on December 08, 2019, 12:01:56 am
Hi!

The RPM-World calls it

appmenu-gtk2-module

Suse Tumbleweed, zypper info:

Code: Text  [Select][+][-]
  1. Information for package appmenu-gtk2-module:
  2. --------------------------------------------
  3. Repository     : openSUSE:Factory                    
  4. Name           : appmenu-gtk2-module                
  5. Version        : 0.7.3-1.1                          
  6. Arch           : x86_64                              
  7. Vendor         : openSUSE                            
  8. Installed Size : 34.8 KiB                            
  9. Installed      : Yes                                
  10. Status         : up-to-date                          
  11. Source package : vala-panel-appmenu-0.7.3-1.1.src    
  12. Summary        : GtkMenuShell D-Bus exporter (GTK+ 2)
  13. Description    :                                    
  14.     This GTK 2 module exports GtkMenuShells over D-Bus.
  15.  

Winni
Title: Re: IDE freezing the OS
Post by: dbannon on December 08, 2019, 12:45:03 am
OK, thats interesting.

I looked for a fedora version only.  Perhaps I had a boy look.....

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on December 12, 2019, 09:44:46 am
Davo,
i still think it's nothing to do with appmenu
look here at accepted answer.
https://askubuntu.com/questions/1185491/ubuntu-19-10-freezes-and-lags-reguarly

Could you test a clean install Ubuntu19.10 with Gnome3.34 with Kernel 5.4?
Would do it myself, but i'm preparing for my holiday-trip to USofA

EDIT: Just yesterday evening i fired up my VM with Manjaro/Gnome, and what do you know? 332 (!) updates available, and that install is a minimal Manjaro/Gnome-Install
Haven't tested anything in the VM (see reason above)
Title: Re: IDE freezing the OS
Post by: dbannon on December 12, 2019, 10:23:07 am
Zvoni, I really don't know !

When we first started poking around this issue, 'we' identified several things that at first seemed to be related.  Swap space, swap policy, DBus come to mind.  Reading the post you linked to, it may not actually be what we are talking about here. It talks about freezes, some of which are apparently quite short. This problem here, as I understand it, is usually about 25 seconds. And, interestingly, 25seconds is the default DBus time out.

My tests, on a VirtualBox VM did seem to indicate that Chris's solution solved it. I fired up the VM, started a GTK2 version of lazarus and found the problem in 13 out of 15 starts.  Most fails were just the 25 second delay, a couple required a reboot.

I installed Chris's package (which incidentally does use DBus) and started Lazarus 15 time in a row without problems.  I removed it and restarted, with problems, two or three times.

I have not gone back into that VM since them, I would like to hear from people who are  are using U19.10 on a day to day basis, they must have more valuable experience than mine !

I don't feel like forcing a new Kernel on my VM, its a testing platform and I need it much like my end users systems are likely to be like.

Davo
Title: Re: IDE freezing the OS
Post by: Zvoni on December 12, 2019, 11:23:10 am
Davo, no Problem.
Since i decided to switch from U19.10/Gnome to Deb10/Gnome
(which is going to happen in a few days, since right now i'm backup-ing the hell out of my machine),
i'll probably be able to report if it has to do with the kernel or with Gnome and/or appmenu, since Deb10 still runs on Kernel4.19
Title: Re: IDE freezing the OS
Post by: Zvoni on December 18, 2019, 09:55:39 pm
Reporting back.
Switched from U19.10/GDM/Gnome to Debian10/Lightdm/Gnome
No more issues anymore.
Pretty clean install of Debian/Gnome, installed FPC304/Laz206 from deb's, and setting up Lazarus with what i like, Lazarus booted some 15-20 times in a row (recompile), and no freezes or lags or whatever.

So, Canonical borked 19.10
Title: Re: IDE freezing the OS
Post by: dbannon on December 19, 2019, 12:18:42 am
Switched from U19.10/GDM/Gnome to Debian10/Lightdm/Gnome
No more issues anymore.
So, Canonical borked 19.10
Ah, but the issue is "do you have appmenu-gtk2 installed in your Debian install now" ?

dpkg -l | grep appmenu-gtk2 {enter}

Davo
Title: Re: IDE freezing the OS
Post by: segfault on July 27, 2020, 10:13:12 am
I know this is an old thread, but I'm getting exactly the same issues with slow start up of applications built with Lazarus, and also within lazarus itself. There is no delay starting the IDE, but if I'm opening some other window (eg search and replace) it often takes a long time to appear.

The funny thing is, it's not consistent. ie sometimes the app/window starts up more or less straight away, but at other times it takes 15 seconds or more.

Not only that, but while waiting for the appliction/window to open, the desktop is unresponsive. I'm using MX Linux, which is a derivative of Debian 10 (stable).

Furthermore, when googling the problem I found the suggested solution of installing appmenu-gtk-module, which I did, but it has made no difference at all.

Any other suggestions? This is a serious problem and I can't see myself continuing to use Lazarus if I can't fix it. :(
Title: Re: IDE freezing the OS
Post by: segfault on July 27, 2020, 10:54:24 am
I don't know if this is significant, but I get this message when starting an application from the terminal :

Quote
(project1:32719): Gdk-WARNING **: 09:47:28.316: gdk_window_set_icon_list: icons too large

Also worth mentioning maybe; I noticed the same delays when using an application built with Lazarus (or FP, at least), even before I had Lazarus installed. You may have heard of it :

https://en.wikipedia.org/wiki/MyNotex

Funny thing is, the problem didn't become apparent immediately. It was only after using the application a number of times that the delays/freezes started, then I removed it from my system because I thought it was a bug.

I've never had these issues with any other software, only those built with Lazarus. And evidently the problem seems to be confined to Linux.
Title: Re: IDE freezing the OS
Post by: MarkMLl on July 27, 2020, 12:05:02 pm
@segfault: not seeing that here, and I'm on Debian 10 x86_64.

At an absolute minimum, please say what versions of FPC etc. you're on.

MarkMLl
Title: Re: IDE freezing the OS
Post by: segfault on July 27, 2020, 02:13:15 pm
FPC 3.2 + Laz 2.0.10, using MX 19 (x64)

I've tried looking at top when starting a Laz application, but see nothing because the OS freezes. I'm not a Linux guru so don't how to investigate further, or which logs I need to look at, if any. 
Title: Re: IDE freezing the OS
Post by: MarkMLl on July 27, 2020, 02:38:18 pm
Use <Ctrl><Alt><F1> to get to a text console. If you can't, /then/ your OS has locked up.

I've had lockups over the last couple of days which I attribute to a dud Qemu update, but that doesn't sound relevant.

I see slow performance in the IDE on occasion, but again that doesn't sound like your problem.

I've seen desktop lockups caused by poorly-chosen breakpoints in the IDE, which could be fixed by killing the relevant programs from a text console. Again, that doesn't sound like your problem.

MarkMLl
Title: Re: IDE freezing the OS
Post by: ChrisR on July 27, 2020, 03:39:38 pm
I would try
  sudo apt-get install appmenu-gtk2-module
and restarting your computer. You could also try compiling to QT5. My guess is you are experiencing impacts described here
  https://bugs.freepascal.org/view.php?id=36359
Please tell me if this resolves your issue.
Title: Re: IDE freezing the OS
Post by: segfault on July 27, 2020, 05:13:18 pm
Chris, I did install it some days ago after reading about the issue on another forum. So it seems to be not confined to Laz apps, however I haven't had any issues with any other software, only Laz and apps built with it.

I thought I rebooted after installing appmenu-gtk-module, but perhaps I didn't. Anyway it seemed to make no difference. However,  I've just rebooted and the problem 'appears' to be fixed, so I'll wait to see what happens and report back here if the problem reoccurs.
Title: Re: IDE freezing the OS
Post by: dbannon on July 29, 2020, 03:48:24 am
I believe (just believe) that the original issue this thread was about related to just the GTK2 package in Ubuntu 19.10, they left out a dependency, appmenu-gtk-module. Installing that reliably fixed it.

Ubuntu 20.04 included GTK2 'out of the box' and showed no sign of this issue. So we have all assumed that the problem was purely a U19.10 problem and a thing of the past. MX is based on Debian, not unbuntu so should not have inherited Ubuntu's mistake.  So, still just 'belief' I am afraid, I don't believe this is your problem.

Further, this thread's  problem showed up with either a crash or a 25 second delay when starting the initial gtk2 app (ie the IDE) that sounds quite different to what you are seeing.

Please look at dmesg after a crash, might mention d-bus.

Davo

Title: Re: IDE freezing the OS
Post by: segfault on September 02, 2020, 10:42:28 am
Installing appmenu-gtk-module only works temporarily. After a reboot there are no delays, but then after some time the problem returns. No idea why. It's definitely related to gtk apps though because when I compile using Qt there are no delays in startup of apps. I've been trying to compile Laz using Qt but haven't succeeded, so far.
Title: Re: IDE freezing the OS
Post by: jamie on September 02, 2020, 04:10:31 pm
I believe this all started when some one insisted on getting the TTrayIcon to work they way they wanted to.
Title: Re: IDE freezing the OS
Post by: dbannon on September 03, 2020, 02:34:41 am
jamie, as possibly the only person to do any work on TTrayIcon for some time, I can assure you there is no connection.

The older TTrayIcon behavior, in particular being able to detect separately left and right clicks was dependent on appindicator1 library. However, that has not worked on newer distributions at all for some time. The newer behavior uses appindicator3 which was derived from Ubuntu's not so lamented Unity desktop.  You can force an application to try and do the old behavior but it will not work at all in any recent distribution. See https://wiki.lazarus.freepascal.org/How_to_use_a_TrayIcon

So, that work was not about "getting the TTrayIcon to work they way [I, they] wanted to", it was about getting it to work.

The delay (and possibly crash) problem problem with U19.10 was apparent in Lazarus itself and other apps that did not use the TTrayIcon at all.

@segfault, I routinely test  my app on a range of Linux distributions in including MX and have not seen this 25second delay on any one except U19.10.  However, my tests are all with new installs not systems that have been updated.  The significent of an update is that the OS you started with may have had and used successfully the old libappindicator1. An update to you OS probably added libappindicator3 but would not remove the original, they are not interchangeable. 

I don't think its at all likely but it would be interesting to know if you do have a legacy libappindicator lying around. So, try this command -

find / -name "libappindicator*" 2>/dev/null

If its there you could try running an app with the env setting mentioned on the wiki page I refered Jamie to, using it to force appindicator3 first, and just to prove or disprove Jamie's rather strange theory, try forcing appindicator1.

Sorry if I appear to be clouding the issue with facts !

Davo

 
Title: Re: IDE freezing the OS
Post by: segfault on September 04, 2020, 02:28:36 pm
Hi Davo,

I ran the command you suggested and this was the result :

$ find / -name "libappindicator*" 2>/dev/null
/usr/share/doc/libappindicator3-1
/usr/lib/x86_64-linux-gnu/libappindicator3.so.1
/usr/lib/x86_64-linux-gnu/libappindicator3.so.1.0.0
/var/lib/dpkg/info/libappindicator3-1:amd64.list
/var/lib/dpkg/info/libappindicator3-1:amd64.triggers
/var/lib/dpkg/info/libappindicator3-1:amd64.shlibs
/var/lib/dpkg/info/libappindicator3-1:amd64.md5sums
/var/lib/dpkg/info/libappindicator3-1:amd64.symbols

I only recently installed MX and am using the latest version 19.2.
Title: Re: IDE freezing the OS
Post by: dbannon on September 05, 2020, 01:11:54 pm
....
I only recently installed MX and am using the latest version 19.2.

Well, that eliminates that theory, I am not surprised.

I have tested my app, its a gtk2 Lazarus app, on MX running in a VM.  I have tested against one installed straight from the install media and then, again, after a full update. I cannot replicate your problem.  Are you using the default desktop ?  Or some other desktop ?  I have tested against both the XSession and XFCe and its all working fine.

Davo
Title: Re: IDE freezing the OS
Post by: segfault on September 05, 2020, 03:54:08 pm
I'm using the default Xfce desktop. The odd thing is it doesn't affect the startup time of the Lazarus IDE itself. The delays only occur when opening windows within it. For example, just now it took over a minute for the new project window to appear. But the other thing is that it's intermittent, so when opening the 'Find' window sometimes it appears almost instantly, other times it takes 20 seconds or more. I could make a video to demonstrate it, but I don't suppose that will be of much help in trying to locate the source of the problem. So, in a nutshell :

* Windows within Lazarus are sometimes delayed in opening, but never the IDE itself.
* Gtk applications created by Lazarus are (again, only sometimes) delayed in starting up.
* Applications created using the qt5 widgets never experience any delays in starting up.
* The problem disappears after a reboot, only to reappear later.
* The OS freezes (no responses to anything) until the window appears.
* Doesn't seem to affect any other Gtk2 apps (only Lazarus and apps built with it).

Anyway, thanks for trying to help.
Title: Re: IDE freezing the OS
Post by: dbannon on September 06, 2020, 02:12:04 am

* Windows within Lazarus are sometimes delayed in opening, but never the IDE itself.
So, that says its actually not the same issue as this thread started. It applied to the IDE as well and it was a quite repeatable 20 or so seconds and sometimes triggered a crash.  Not very interesting (that its not the same issue) but its one fact we can keep.

* The problem disappears after a reboot, only to reappear later.
Again, thats not typical of original problem. More like some resource being consumed. Hmm, and it says my tests are not useful then, I fired up the VM, ran the test.  Is it enough to just have the OS just running, doing nothing or does it need to be actively used ?   And what sort of time frame are we looking at ?  Minutes, hours, days ?

Most Linux distros have some sort of resource usage monitor app available, something that plots your cpu; disk i/o; network traffic on a little graph over, say, 10 minutes.  If you could find something like that and install it, it may tell us what the contention is during that delay.

The original problem was a problem with a GTK2 app talking, via dbus, to the desktop, as that dbus channel was limited, it choked the desktop but memory and cpu usage was minimal. Be interesting to see if thats still the case.

Davo
Title: Re: IDE freezing the OS
Post by: Awesome Programmer on October 19, 2022, 05:50:22 pm
Hi fellow programmers,

Yes, I realize that this is an OLD question and/or post.

I am having the SAME ISSUE with my latest Lazarus FreePascal Program I wrote.

I am using latest Ubuntu OS using WAYLAND interface and the LATEST LAZARUS COMPILER.

All this program does is read scheduled system shutdown date time and when only 10 minutes left before system shuts down it ALERTS the user of this impending system shutdown by popping up a form with displaying animated GIF or window and playing a warning AUDIO FILE in the background.

As soon as the program ALERTS while displaying GIF and playing AUDIO FILE, the program FREEZES momentarily putting up a message box saying, "Program is not responsive" with buttons force quit or wait. Then, the messagebox goes away until the next time ALERT or WARNING window is up and the Audio file is played. Ubuntu OS doesn't freeze or crash. It is only the Lazarus PROGRAM.

I read through this post and it seems that no one found a solution yet.

What do you think is happening?

Title: Re: IDE freezing the OS
Post by: AlexTP on October 19, 2022, 07:36:09 pm
Quote
and the LATEST LAZARUS COMPILER.
Do you mean latest from Git branch 'main' or the last release?
What FPC version, if you run the "fpc"?
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 19, 2022, 08:06:41 pm
I am having the SAME ISSUE with my latest Lazarus FreePascal Program I wrote.

So, what version of Lazarus and FPC are you using? Please put those in the body of your message, since something like "latest" is utterly useless... particularly when somebody re-reads the thread in a couple of years (as you have just done) and "latest" is now something totally different.

Apart from that, what widgetset are you using and what happens if you run your program on an OS which isn't quite so "bleeding edge"? How are you actually playing the audio, do you have a background thread etc.?

Can you duplicate it with a simple program which plays a sound when a button is pressed? Posting the complete source of a test program like that would make life much easier.

And /that/ you see, is whet you get when you necropost: unwelcome procedural suggestions from somebody who was engaged in the discussion some years ago, even if he does not necessarily consider himself the best to sort out a problem of this type with current releases and OSes :-)

MarkMLl
Title: Re: IDE freezing the OS
Post by: dbannon on October 19, 2022, 11:52:13 pm
Awesome, I have no idea what the problem is but I am pretty sure it has nothing to do with this thread !
Firstly, this thread affected ALL GTK2 apps made by Lazarus (and other dev systems), including Lazarus itself. The original problem never saw a message popup. We are quite sure the original problem related to a missing component from GTK that Cannonical left out in one, short term, release of Ubuntu.

There was an additional report from Segfault but he/she has not reported back what eventually happened.

Awesome, you problem appears important enough to warrant a new thread !

Maybe interesting see if you experience the same problem with QT5 ?  Remember to install libqt5pas-dev

Davo
Title: Re: IDE freezing the OS
Post by: MarkMLl on October 20, 2022, 08:59:17 am
Awesome, you problem appears important enough to warrant a new thread !

He'd already duplicated it at https://forum.lazarus.freepascal.org/index.php/topic,60957.msg457279.html

This sort of thing is irritating, since we don't have an "ignore this thread from now on" button and are effectively spammed whenever anybody notices that a dormant thread has a lot of participants.

MarkMLl
TinyPortal © 2005-2018