Bug 1300878 - [RFE] dnf makecache enabled on readonly-root systems wastes cpu
Summary: [RFE] dnf makecache enabled on readonly-root systems wastes cpu
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 23
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-22 00:33 UTC by Oleg Drokin
Modified: 2016-12-20 18:03 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-12-20 18:03:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1187111 0 low CLOSED Remove dnf-makecache service/timers 2025-07-02 04:41:21 UTC

Description Oleg Drokin 2016-01-22 00:33:37 UTC
Description of problem:

It looks like dnf makecache timer that is eanbled by default for some reason cannot understand that it's running on a readonly root system (i.e. nfsroot)
and fires anyway, so 10 minutes after system start we end up with dnf makecache process that hogs 100% of cpu.
32441 ?        RNs   14:24 /usr/bin/python -OO /usr/bin/dnf -v makecache timer

strace shows that it's looping trying to perform:
open("/var/cache/dnf/metadata_lock.pid", O_WRONLY|O_CREAT|O_EXCL, 0644) = -1 EEXIST (File exists)
open("/var/cache/dnf/metadata_lock.pid", O_RDONLY) = -1 ENOENT (No such file or directory)

The file does not exist:
# ls -la /var/cache/dnf/metadata_lock.pid
ls: cannot access /var/cache/dnf/metadata_lock.pid: No such file or directory

The /var/cache/dnf is not one of the default targets to be mounted in tmpfs (and for a good reason).

I see that the timer in question already contains a condition against running when started from livecd image:
ConditionKernelCommandLine=!rd.live.image

Now, if this could be replaced with a check of /etc/sysconfig/readonly-root and not run when READONLY is set to yes - that would be a lot more proper solution.
Or at least a check that /var/cache/dnf is actually writeable.

Version-Release number of selected component (if applicable):
present in all version of dnf starting from FC21

How reproducible:

100% reproducible

Steps to Reproduce:
If you are not up to the task of doing nfs readonly-root install or the like, you can simulate it by:

1. mount none /var/cache/dnf -t tmpfs
2. mount / /media --bind
3. cp -a /media/var/cache/dnf/* /var/cache/dnf/
4. umount /media

5. strace dnf makecache

Note it's important to do the copying of a real existing dnf cache as otherwise it's smart enough to fail seeing as it cannot create it if the /var/cache/dnf is empty (which it is not on a real readonly nfsroot install)

Actual results:

dnf enters infinite loop hogging 100% of one cpu.


Expected results:

should notice that it cannot do anything.
Even better if dnf makecache was not run by default in such a case.

Additional info:
This all got introduced with the mandatory on-by-default dnf makecache timer as part of dnf package, that sparked quite a heated discussion in bug 1187111.

Comment 1 Oleg Drokin 2016-01-22 00:38:51 UTC
There's one more step in the reproducer, btw, that I forgot to include:

3.5 mount /var/cache/dnf -o remount,ro

Otherwise the /var/cache/dnf is not readonly and you won't see the problem.

Comment 2 Honza Silhan 2016-01-25 13:11:33 UTC
we can add the readonly checker everytime we load cache directory.

Comment 3 Fedora Admin XMLRPC Client 2016-07-08 09:36:03 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora End Of Life 2016-11-24 15:06:12 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2016-12-20 18:03:46 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.