Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 819783

Summary: x11-misc/shared-mime-info: update-mime-database very slow, with huge disk I/O
Product: Gentoo Linux Reporter: bzoloid <bzoloid>
Component: EclassesAssignee: Freedesktop bugs <freedesktop-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=487504
https://bugs.freedesktop.org/show_bug.cgi?id=70366
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch proposal for Gentoo portage tree eclass
Patch proposal for x11-misc/shared-mime-info

Description bzoloid 2021-10-23 17:20:04 UTC
The "update-mime-database" step can take several minutes on my systems, with extremely high disk I/O.




Reproducible: Always

Steps to Reproduce:
1. Emerge a software that adds new mime types (e.g. media-gfx/hugin)
2. Observe the "Updating shared mime info database" step at install with iotop

Actual Results:  
"update-mime-database" takes 4 minutes to complete (HDD 5400rpm), iotop gets crazy

Expected Results:  
"update-mime-database" takes a few seconds to complete with low I/O


This issue was already reported in #487504 and fixed with "export ac_cv_func_fdatasync=no" in the ebuild. Sadly this trick doesn't work any more since >=x11-misc/shared-mime-info-2.0

I see 2 possible fixes:
- either set "PKGSYSTEM_ENABLE_FSYNC=0" in xdg-utils.eclass (see https://bugs.freedesktop.org/show_bug.cgi?id=70366 )
- or patch shared-mime-info to disable 'fdatasync' in meson.ebuild
Comment 1 Mike Gilbert gentoo-dev 2021-10-24 05:29:50 UTC
Slow spinning disks are much less common today than they were in 2013/2014 when bug 484504 was open. The performance hit on a solid state disk is probably trivial.

I would suggest setting PKGSYSTEM_ENABLE_FSYNC=0 in make.conf to work around this issue if you are running Gentoo with slow disks.
Comment 2 bzoloid 2021-10-24 09:28:29 UTC
Regarding the speed yes, but the high write I/O will reduce SSDs lifetime...
Comment 3 Mike Gilbert gentoo-dev 2021-10-24 15:21:41 UTC
I suppose that's a good point.

I guess we can rely on FEATURES="merge-sync" in Portage.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-10-25 12:16:48 UTC
(In reply to Mike Gilbert from comment #3)
> I suppose that's a good point.
> 
> I guess we can rely on FEATURES="merge-sync" in Portage.

Aye, and for e.g. Raspberry Pis on SD cards.
Comment 5 bzoloid 2021-10-31 19:02:10 UTC
Created attachment 747744 [details, diff]
Patch proposal for Gentoo portage tree eclass
Comment 6 bzoloid 2021-10-31 19:02:40 UTC
Created attachment 747747 [details, diff]
Patch proposal for x11-misc/shared-mime-info
Comment 7 bzoloid 2021-10-31 19:10:47 UTC
I attached to patches as fix proposals.

Maybe relying on FEATURES="merge-sync" could be an option too...
Comment 8 Larry the Git Cow gentoo-dev 2021-10-31 19:32:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99c24c9cd97877fe0a052f028061c177e066360c

commit 99c24c9cd97877fe0a052f028061c177e066360c
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2021-10-24 15:26:17 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-10-31 19:32:41 +0000

    xdg-utils.eclass: disable fdatasync() in update-mime-database
    
    This speeds up installation dramatically on slow disks, and may reduce
    wear on solid state storage.
    
    Portage will call 'sync' after installation if FEATURES="merge-sync" is
    enabled, so the risk should be small.
    
    Closes: https://bugs.gentoo.org/819783
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 eclass/xdg-utils.eclass | 3 +++
 1 file changed, 3 insertions(+)