Hi,
On Thu, Nov 11, 2021 at 06:56:33PM +0800, 李菲 wrote:
> wrote:
> I guess the below 'Reproduce' can tell this :) That is, if atop starts
> before
> atopacctd, it will read from /var/cache/atop.d/atop.acct. Instead, if
> atopacctd
> starts earlier, atop will read from /run/pacct_shadow.d/0000000000.paf
> which is generated by atopacctd.
Is this a race condition that only occurs once in a while? I tried it
three times now on a test system and all three times it ended up with
atop reading from the .paf file right after reboot.
On Thu, Nov 25, 2021 at 03:34:15PM +0800, 李菲 wrote:
> On Thu, Nov 25, 2021 at 3:32 AM Marc Haber <mh+debian...@zugschlus.de>
> wrote:
> > On Thu, Nov 11, 2021 at 06:56:33PM +0800, 李菲 wrote:
> > > wrote:
> > > I guess the below 'Reproduce' can tell this :) That is, if atop starts
> > > before
> > > atopacctd, it will read from /var/cache/atop.d/atop.acct. Instead, if
> > > atopacctd
> > > starts earlier, atop will read from /run/pacct_shadow.d/0000000000.paf
> > > which is generated by atopacctd.
> >
> > Is this a race condition that only occurs once in a while? I tried it
> > three times now on a test system and all three times it ended up with
> > atop reading from the .paf file right after reboot.
> >
> You mean reboot the machine? I am wondering why rebooting
> is needed after installing atop.
It is not. I just tried to reproduce your issue.
> I did the following check just
> after installing atop without rebooting the machine. :)
> As for the reboot, I am inclined to the problem is corrected
> after rebooting, mainly due to the "Before=atop.service"
> in atopacct.service file.
So I need to de- and reinstall atop to reproduce this?
--- a/debian/rules
+++ b/debian/rules
@@ -9,8 +9,8 @@ override_dh_auto_clean:
rm -f atop atopsar
override_dh_installinit:
- dh_installinit --name=atopacct
dh_installinit --name=atop
+ dh_installinit --name=atopacct
cp atop.service debian/atop.service | cp atop.service debian/atop.service
cp atop.default debian/atop.default | -----------------------------------------------------------------------------------------
cp atopacct.service debian/atopacct.service | cp atopacct.service debian/atopacct.service
cp atop.init debian/atop.init | cp atop.init debian/atop.init
cp atopacct.init debian/atopacct.init | cp atopacct.init debian/atopacct.init
make[1]: Leaving directory '/root/fei-gitcode/atop' | make[1]: Leaving directory '/root/fei-gitcode/debian-atop-github/atop'
dh_install | dh_install
dh_installdocs | dh_installdocs
dh_installchangelogs | dh_installchangelogs
dh_installman | dh_installman
dh_systemd_enable | dh_installcron
debian/rules override_dh_installinit | debian/rules override_dh_installinit
make[1]: Entering directory '/root/fei-gitcode/atop' | make[1]: Entering directory '/root/fei-gitcode/debian-atop-github/atop'
dh_installinit --name=atop | dh_installinit --name=atop
dh_installinit --name=atopacct | dh_installinit --name=atopacct
make[1]: Leaving directory '/root/fei-gitcode/atop' | make[1]: Leaving directory '/root/fei-gitcode/debian-atop-github/atop'
dh_systemd_start | dh_installsystemd
dh_perl | dh_perl
dh_link | dh_link
dh_strip_nondeterminism | dh_strip_nondeterminism
dh_compress | dh_compress
dh_fixperms | dh_fixperms
dh_missing | dh_missing
-----------------------------------------------------------------------------------------| dh_dwz
dh_strip | dh_strip
dh_makeshlibs | dh_makeshlibs
dh_shlibdeps | dh_shlibdeps
dh_installdeb | dh_installdeb
dh_gencontrol | dh_gencontrol
dh_md5sums | dh_md5sums
dh_builddeb | dh_builddeb
dpkg-deb: building package 'atop' in '../atop_2.6.0+byted3_amd64.deb'. | dpkg-deb: building package 'atop' in '../atop_2.6.0-1_amd64.deb'.
dpkg-deb: building package 'atop-dbgsym' in '../atop-dbgsym_2.6.0+byted3_amd64.deb'. | dpkg-deb: building package 'atop-dbgsym' in '../atop-dbgsym_2.6.0-1_amd64.deb'.
dpkg-genbuildinfo | dpkg-genbuildinfo
dpkg-genchanges >../atop_2.6.0+byted3_amd64.changes | dpkg-genchanges >../atop_2.6.0-1_amd64.changes
dpkg-genchanges: info: including full source code in upload | dpkg-genchanges: info: including full source code in upload
dpkg-source --after-build . | dpkg-source --after-build .
-----------------------------------------------------------------------------------------| dpkg-source: info: using options from atop/debian/source/local-options: --unapply-patches
-----------------------------------------------------------------------------------------| dpkg-source: warning: --unapply-patches is not a valid option for Dpkg::Source::Package::
dpkg-buildpackage: info: full upload; Debian-native package (full source is included) | dpkg-buildpackage: info: full upload; Debian-native package (full source is included)
log-bytedance log-debian
On Thu, Dec 23, 2021 at 07:48:19PM +0100, Marc Haber wrote:
> The interesting line of code is
>
> deb-systemd-invoke $_dh_action 'atop-rotate.service' 'atop-rotate.timer' 'atop.service' 'atopacct.service
>
> which will instruct systemd to start all those four services. I am not
> sure whether it makes sense for atop to explicitly start the two
> atop-rotate units, and I think that systemd decides by itself in which
> order the units are started.
The atopacct unit (systemctl cat atopacct) has an explicit "Before:
atop.service" listed. So, systemd SHOULD take care of starting atopacctd
first before atop is started.
Can you please verify (maybe from syslog?) that the start order is
actually wrong when you encounter the situation of misbehavior?
Dec 24 17:08:22 n198-252-111 atopacctd[27883]: Terminated by signal 15
Dec 24 17:08:22 n198-252-111 systemd[1]: atopacct.service: Succeeded.
Dec 24 17:08:22 n198-252-111 systemd[1]: atop.service: Succeeded.
Dec 24 17:08:22 n198-252-111 systemd[1]: atop-rotate.timer: Succeeded.
Dec 24 17:08:22 n198-252-111 systemd[1]: Stopped Daily atop restart.
Dec 24 17:08:31 n198-252-111 systemd[1]: Started Daily atop restart.
Dec 24 17:08:32 n198-252-111 atopacctd[29508]: Version: 2.6.0+byted3 - 2021/12/23 17:02:33 <gerlof.l...@atoptool.nl>
Dec 24 17:08:32 n198-252-111 atopacctd[29508]: accounting to /run/pacct_source
Just two possibly stupid questions:
(1) are you actually running systemd as PID 1 or did you decide to still
use sysv init?
# systemctl status atop
● atop.service - Atop advanced performance monitor
Loaded: loaded (/lib/systemd/system/atop.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-12-24 17:08:31 CST; 6min ago
(2) psacct is installed or not?
# dpkg -L atop |grep pacct
/etc/init.d/atopacct
/lib/systemd/system/atopacct.service
/usr/sbin/atopacctd
On Fri, Dec 24, 2021 at 05:17:07PM +0800, 李菲 wrote:
> On Fri, Dec 24, 2021 at 3:02 AM Marc Haber <mh+debian...@zugschlus.de>
> wrote:
>
> > On Thu, Dec 23, 2021 at 07:48:19PM +0100, Marc Haber wrote:
> > > The interesting line of code is
> > >
> > > deb-systemd-invoke $_dh_action 'atop-rotate.service' 'atop-rotate.timer'
> > 'atop.service' 'atopacct.service
> > >
> > > which will instruct systemd to start all those four services. I am not
> > > sure whether it makes sense for atop to explicitly start the two
> > > atop-rotate units, and I think that systemd decides by itself in which
> > > order the units are started.
> >
> > The atopacct unit (systemctl cat atopacct) has an explicit "Before:
> > atop.service" listed. So, systemd SHOULD take care of starting atopacctd
> > first before atop is started.
> >
> Actually I am not sure whether "before: " only guarantees this
> when the host machine restarts, but not installing packages.
I surely do hope that this also applies to systemctl transactions.
atop's maintainer scripts group all unit starts into a single
transaction, leaving the order of execution to systemd. That's done by
debhelper, and as a package maintainer I am not going to interfere with
that. The best I can do is to help upstream to properly design their
systemd units and probably make code changes to make startup more
robust.
> > Can you please verify (maybe from syslog?) that the start order is
> > actually wrong when you encounter the situation of misbehavior?
> >
> > Run `dpkg --purge atop && dpkg -i ../atop_2.6.0+byted3_amd64.deb`,
> and see the log, just as follows:
> # journalctl | grep atop
>
> Dec 24 17:08:22 n198-252-111 atopacctd[27883]: Terminated by signal 15
>
> Dec 24 17:08:22 n198-252-111 systemd[1]: atopacct.service: Succeeded.
>
> Dec 24 17:08:22 n198-252-111 systemd[1]: atop.service: Succeeded.
>
> Dec 24 17:08:22 n198-252-111 systemd[1]: atop-rotate.timer: Succeeded.
>
> Dec 24 17:08:22 n198-252-111 systemd[1]: Stopped Daily atop restart.
>
> Dec 24 17:08:31 n198-252-111 systemd[1]: Started Daily atop restart.
>
> Dec 24 17:08:32 n198-252-111 atopacctd[29508]: Version: 2.6.0+byted3 -
> 2021/12/23 17:02:33 <gerlof.l...@atoptool.nl>
>
> Dec 24 17:08:32 n198-252-111 atopacctd[29508]: accounting to
> /run/pacct_source
Is that reproducible?
> > (2) psacct is installed or not?
> >
> Yes,
>
> # dpkg -L atop |grep pacct
>
> /etc/init.d/atopacct
>
> /lib/systemd/system/atopacct.service
>
> /usr/sbin/atopacctd
> /usr/share/man/man8/atopacctd.8.gz
pSacct is a different package, dpkg --list psacct please.
# atop -V
Version: 2.6.0 - 2020/12/21 20:45:10 <gerlof.l...@atoptool.nl>
# dpkg --list psacct
dpkg-query: no packages found matching psacct
Greetings
> >
> Yes,
>
> # dpkg -L atop |grep pacct
>
> /etc/init.d/atopacct
>
> /lib/systemd/system/atopacct.service
>
> /usr/sbin/atopacctd
> /usr/share/man/man8/atopacctd.8.gz
pSacct is a different package, dpkg --list psacct please.Just make sure if the package's name is called psacct.As after installing v2.6.0 fromI still can not find this package:# atop -V
Version: 2.6.0 - 2020/12/21 20:45:10 <gerlof.l...@atoptool.nl>
# dpkg --list psacct
dpkg-query: no packages found matching psacct
Hi,
On Mon, Dec 27, 2021 at 10:57:45AM +0800, 李菲 wrote:
> On Fri, Dec 24, 2021 at 7:18 PM Marc Haber <mh+debian...@zugschlus.de>
> wrote:
> > I surely do hope that this also applies to systemctl transactions.
> > atop's maintainer scripts group all unit starts into a single
> > transaction, leaving the order of execution to systemd. That's done by
> > debhelper, and as a package maintainer I am not going to interfere with
> > that. The best I can do is to help upstream to properly design their
> > systemd units and probably make code changes to make startup more
> > robust.
>
> Sure.
I have engaged in discussion with upstream and this issue might be
addressed sooner or later. At the moment, do we agree that the proposed
patch, exchanging the two calls to dh_installinit will not help on
systemd systems?