Bug 1774645 - Tuned daemon is stuck upon receiving SIGHUP when in "auto" mode and a recommended profile does not exist.
Summary: Tuned daemon is stuck upon receiving SIGHUP when in "auto" mode and a recomme...
Keywords:
Status: CLOSED DUPLICATE of bug 1702724
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned
Version: 7.7
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-20 15:37 UTC by jmencak
Modified: 2019-11-27 10:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-27 10:43:46 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description jmencak 2019-11-20 15:37:22 UTC
Description of problem:
Tuned supports profile reloading upon receiving a SIGHUP signal.  Unfortunately, when it is in "auto" mode and a given profile does not exist, it is stuck and the tuned service needs to be restarted.

Version-Release number of selected component (if applicable):
[root@b77 ~]# rpm -qi tuned
Name        : tuned
Version     : 2.11.0
Release     : 5.el7
Architecture: noarch
Install Date: Tue 23 Jul 2019 10:38:46 AM EDT
Group       : Unspecified
Size        : 815344
License     : GPLv2+
Signature   : RSA/SHA256, Fri 07 Jun 2019 12:33:01 PM EDT, Key ID 199e2f91fd431d51
Source RPM  : tuned-2.11.0-5.el7.src.rpm
Build Date  : Fri 07 Jun 2019 12:15:40 PM EDT
Build Host  : ppc-029.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://www.tuned-project.org/
Summary     : A dynamic adaptive system tuning daemon
Description :
The tuned package contains a daemon that tunes system settings dynamically.
It does so by monitoring the usage of several system components periodically.
Based on that information components will then be put into lower or higher
power saving modes to adapt to the current usage. Currently only ethernet
network and ATA harddisk devices are implemented.

How reproducible:
# add debugging option to tuned service in /etc/systemd/system/multi-user.target.wants/tuned.service
[root@b77 ~]# echo auto > /etc/tuned/profile_mode
[root@b77 ~]# systemctl daemon-reload
[root@b77 ~]# systemctl restart tuned

# tail /var/log/tuned/tuned.log

[root@b77 ~]# tuned-adm active
Current active profile: virtual-guest

[root@b77 ~]# cat > /etc/tuned/recommend.d/50-poc.conf << EOF
[network-throughput]
/etc/tuned/recommend.d/50-poc.conf=.*
EOF

[root@b77 ~]# pkill -HUP tuned
[root@b77 ~]# tuned-adm active
Current active profile: network-throughput

# So far so good, so reloading profiles works when they exist.

[root@b77 ~]# cat > /etc/tuned/recommend.d/50-poc.conf << EOF
[does-not-exist]
/etc/tuned/recommend.d/50-poc.conf=.*
EOF

[root@b77 ~]# pkill -HUP tuned
[root@b77 ~]# tuned-adm active
No current active profile.
[root@b77 ~]# tuned-adm recommend
does-not-exist

# Still, so far so good, this is understandable

[root@b77 ~]# tail /var/log/tuned/tuned.log
2019-11-20 10:19:13,048 DEBUG    tuned.units.manager: cleaning plugin 'cpu'
2019-11-20 10:19:13,048 DEBUG    tuned.units.manager: cleaning plugin 'disk'
2019-11-20 10:19:13,048 DEBUG    tuned.hardware.inventory: removing handler: block (<tuned.plugins.plugin_disk.DiskPlugin object at 0x7f4c9be93590>)
2019-11-20 10:19:13,048 DEBUG    tuned.units.manager: cleaning plugin 'sysctl'
2019-11-20 10:19:13,049 INFO     tuned.daemon.daemon: Running in automatic mode, checking what profile is recommended for your configuration.
2019-11-20 10:19:13,049 DEBUG    tuned.utils.commands: Read data from file: '<closed file '/etc/tuned/recommend.d/50-poc.conf', mode 'r' at 0x7f4c9beb9660>' > '#[network-throughput]
[does-not-exist]
/etc/tuned/recommend.d/50-poc.conf=.*
'
2019-11-20 10:19:13,049 INFO     tuned.daemon.daemon: Using 'does-not-exist' profile

# Let's try to switch back to a profile that exists.

[root@b77 ~]# tuned-adm active
Current active profile: virtual-guest
[root@b77 ~]# cat > /etc/tuned/recommend.d/50-poc.conf << EOF
[network-throughput]
/etc/tuned/recommend.d/50-poc.conf=.*
EOF

[root@b77 ~]# pkill -HUP tuned
[root@b77 ~]# tuned-adm active
No current active profile.

# So this is not good, why don't I see 'network-throughput'?

[root@b77 ~]# tail /var/log/tuned/tuned.log
2019-11-20 10:19:13,049 INFO     tuned.daemon.daemon: Running in automatic mode, checking what profile is recommended for your configuration.
2019-11-20 10:19:13,049 DEBUG    tuned.utils.commands: Read data from file: '<closed file '/etc/tuned/recommend.d/50-poc.conf', mode 'r' at 0x7f4c9beb9660>' > '#[network-throughput]
[does-not-exist]
/etc/tuned/recommend.d/50-poc.conf=.*
'
2019-11-20 10:19:13,049 INFO     tuned.daemon.daemon: Using 'does-not-exist' profile
2019-11-20 10:19:31,175 DEBUG    tuned.exports.dbus_exporter: checking authorization for for action 'com.redhat.tuned.active_profile' requested by caller ':1.75'
2019-11-20 10:19:31,176 DEBUG    tuned.exports.dbus_exporter: action 'com.redhat.tuned.active_profile' requested by caller ':1.75' was successfully authorized by polkit
2019-11-20 10:22:32,585 DEBUG    tuned.exports.dbus_exporter: checking authorization for for action 'com.redhat.tuned.active_profile' requested by caller ':1.76'
2019-11-20 10:22:32,586 DEBUG    tuned.exports.dbus_exporter: action 'com.redhat.tuned.active_profile' requested by caller ':1.76' was successfully authorized by polkit

# No sign of trying to load 'network-throughput'

[root@b77 ~]# tuned-adm recommend
network-throughput

# Let's restart the tuned service

[root@b77 ~]# systemctl restart tuned
[root@b77 ~]# tuned-adm active
Current active profile: network-throughput

# OK, so I had to restart the service to take the tuned daemon from some "stuck" state.

Expected results:
Tuned daemon does not enter the "stuck" state and subsequent SIGHUP signals set the correct profile.

Comment 2 Ondřej Lysoněk 2019-11-21 09:43:51 UTC
(In reply to jmencak from comment #0)
> # Let's try to switch back to a profile that exists.
> 
> [root@b77 ~]# tuned-adm active
> Current active profile: virtual-guest

This part seems wrong. Doesn't it say 'No current active profile.' here?

Other than that, I can reproduce the bug. Thanks for the report!

Comment 3 jmencak 2019-11-21 10:22:55 UTC
(In reply to Ondřej Lysoněk from comment #2)
> (In reply to jmencak from comment #0)
> > # Let's try to switch back to a profile that exists.
> > 
> > [root@b77 ~]# tuned-adm active
> > Current active profile: virtual-guest
> 
> This part seems wrong. Doesn't it say 'No current active profile.' here?
> 
> Other than that, I can reproduce the bug. Thanks for the report!

This is correct, sorry about that.  Copy&paste error when I was preparing the BZ.
Thanks for looking into this!


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