After updating my ubuntu from 18.10 to 19.04 it startet to freeze occasionally for a few seconds.
Googling did not really help, there were a few bug reports but nothing that helped. However,
I found that it might have to do with gnome-shell using a lot of CPU. Looking further in /var/log/syslog, the following line kept repeating every
five minutes:
Jun 26 00:00:04 xxx gnome-shell[2411]: JS ERROR: TypeError: fileItem is null#012_updateDesktopIfChanged@/usr/share/gnome-shell/extensions/desktop-icons@csoriano/desktopManager.js:339:17#012_monitorDesktopFolder/<@/usr/share/gnome-shell/extensions/desktop-icons@csoriano/desktopManager.js:299:89Now it was easy to verify that the freeze-times correlated with this log entry. I really am no ubuntu or gnome expert, so that did not really help. But then, I noted that my desktop icons always flickered when the freeze was ending.
I had configured ~/.config/user-dirs.dirs so that XDG_DESKTOP_DIR pointed to $HOME instead of ~/Desktop. After restoring the default (empty) ~/Desktop directory and pointing XDG_DESKTOP_DIR to it, the problem was solved!
I suspect gnome-shell to do some deep scanning of folders or something like this, and have not really
an idea if it is a bug or feature...