You are not logged in.

#1 2016-11-30 04:39:27

thenextdon13
Member
Registered: 2013-01-18
Posts: 58

[SOLVED] update-desktop-database.hook hangs with 100% cpu utilization

Hello-
A recent system update  (pacman -Suy) hung on my system.

(1/1) Updating the desktop file MIME type cache...

A look at top shows 100% cpu on a single process

12149 root      20   0   11.8m   2.4m 100.0  0.0   9:13.25 R update-desktop-                                                                                                                0.0m

Looking at the full command of the process

[dylan@shoparch pkg]$ ps aux | grep 12149
root     12149 99.9  0.0  12132  2472 pts/1    R+   19:14  10:49 /usr/bin/update-desktop-database --quiet
dylan    12159  0.0  0.0  10756  2160 pts/3    S+   19:25   0:00 grep 12149
[dylan@shoparch pkg]$ 

It seems to be a hook

[dylan@shoparch pkg]$ grep update-desktop /var/log/pacman.log 
[2016-05-16 07:06] [ALPM] running 'update-desktop-database.hook'...

control + c during the update will stop the process:

(1/1) Updating the desktop file MIME type cache...
^C
Interrupt signal received
error: command terminated by signal 2: Interrupt
[dylan@shoparch pkg]$ 

Anyway, at least i know the command, and can run it manually

I can see in help that it has a '--verbose' option

  -v, --verbose         Display more information about processing and updating progress

run manually with a bunch of v's:

[dylan@shoparch pkg]$ sudo /usr/bin/update-desktop-database -vvvvv
Search path is now: [/usr/local/share/applications, /usr/share/applications]
Could not create cache file in "/usr/local/share/applications": Error opening directory '/usr/local/share/applications': No such file or directory

The first path doesnt' exist, the second does exist, so the error I assume is expected:

[dylan@shoparch pkg]$ ls -ld /usr/local/share/applications /usr/share/applications/
ls: cannot access '/usr/local/share/applications': No such file or directory
drwxr-xr-x 2 root root 4096 Nov 29 19:14 /usr/share/applications/
[dylan@shoparch pkg]$ 

After reading the man page, its clear that update-desktop-database scans for files in those directories, with a suffix of .desktop.
There are a lot of files there that match that description:

[dylan@shoparch pkg]$ ls -l /usr/share/applications/*.desktop | wc -l
94

Maybe one is corrupt (even though man page says it will skip corrupt), or it is getting stuck on one...

[dylan@shoparch pkg]$ sudo ls -l /proc/12273/fd
total 0
lrwx------ 1 root root 64 Nov 29 19:56 0 -> /dev/pts/3
lrwx------ 1 root root 64 Nov 29 19:56 1 -> /dev/pts/3
lrwx------ 1 root root 64 Nov 29 19:56 2 -> /dev/pts/3
lr-x------ 1 root root 64 Nov 29 19:56 3 -> /usr/share/applications
lr-x------ 1 root root 64 Nov 29 19:56 4 -> /usr/share/applications/gtk3-widget-factory.desktop
[dylan@shoparch pkg]$ 

It hangs there and never continues.  If i remove that file, it hangs at the next file and never continues.

I moved the /usr/share/applications directory, and created a new on in it's place:  then the command executes successfully and creates a file as expected

[dylan@shoparch pkg]$ sudo mv /usr/share/applications/ /home/dylan/
[dylan@shoparch pkg]$ sudo mkdir /usr/share/applications
[dylan@shoparch pkg]$ sudo /usr/bin/update-desktop-database -vvvvv
Search path is now: [/usr/local/share/applications, /usr/share/applications]
Could not create cache file in "/usr/local/share/applications": Error opening directory '/usr/local/share/applications': No such file or directory
[dylan@shoparch pkg]$ echo $?
0
[dylan@shoparch pkg]$ ls -al /usr/share/applications/
total 12
drwxr-xr-x   2 root root 4096 Nov 29 20:06 .
drwxr-xr-x 198 root root 4096 Nov 29 20:05 ..
-rw-r--r--   1 root root   13 Nov 29 20:06 mimeinfo.cache
[dylan@shoparch pkg]$ 

The first file it hangs on is as follows, and how it looks

[dylan@shoparch pkg]$ ls -l /usr/share/applications/gtk3-widget-factory.desktop 
-rw-r--r-- 1 root root 246 Nov 29 20:14 /usr/share/applications/gtk3-widget-factory.desktop
[dylan@shoparch pkg]$ cat /usr/share/applications/gtk3-widget-factory.desktop 
[Desktop Entry]
Name=Widget Factory
Comment=A showcase for GTK+ widgets, designed for testing themes.
Exec=gtk3-widget-factory
Icon=gtk3-widget-factory
Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true
[dylan@shoparch pkg]$ 

I've tried copying just a single .desktop file into /usr/share/applications, but it hangs on any single file i put in the directory
I've also tried reinstalling desktop-file-utils, including forcing a new download by removing the cached file in  /var/cache/pacman/pkg/ and using pacman -Syy
I'm at a loss as to how to further troubleshoot.
Suggestions?

Last edited by thenextdon13 (2016-12-04 05:12:43)

Offline

#2 2016-12-01 06:10:44

thenextdon13
Member
Registered: 2013-01-18
Posts: 58

Re: [SOLVED] update-desktop-database.hook hangs with 100% cpu utilization

Offline

#3 2016-12-04 05:11:55

thenextdon13
Member
Registered: 2013-01-18
Posts: 58

Re: [SOLVED] update-desktop-database.hook hangs with 100% cpu utilization

Help from the dev pinpointed that glib2 was causing the hang.
I reinstalled glib2 and all dependencies (there weren't any), and now update-destop-database -v has the same output as on other machines.

I think perhaps my glib2 install was corrupted, perhaps by a bad hard drive? while I was building glib and desktop-file-utils with debug options, I saw ata timeouts in my dmesg.

[454571.466004] ata7.00: failed command: WRITE FPDMA QUEUED
[454571.468081] ata7.00: cmd 61/00:c8:9b:ca:1f/0a:00:00:00:00/40 tag 25 ncq dma 1310720 ou
[454571.472260] ata7.00: status: { DRDY }
[454571.474344] ata7: hard resetting link

Anyway, all is now good with update-desktop-database. i'm going to mark this thread 'solved',

Offline

Board footer

Powered by FluxBB