After all this time, I found my fan turning on regularly and the same program 
still.
I assume it reports package status back, fine with me.

BTW this is on landscape-client 24.02-0ubuntu5.3

But given what it is doing the cpu consumption to do so seems a bit much
for my taste and expectation.

sudo /usr/bin/time -v python3 /usr/bin/landscape-package-reporter
        Command being timed: "python3 /usr/bin/landscape-package-reporter"
        User time (seconds): 26.32
        System time (seconds): 36.89
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 1:03.25
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 229232
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 55168
        Voluntary context switches: 10
        Involuntary context switches: 3216
        Swaps: 0
        File system inputs: 0
        File system outputs: 32
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

AFAICS It does not spawn sub-processes - at least not in side the process 
hierarchy.
So we'd want to profile the consumption of the script itself I guess?

Also that is quite some time in system, given that I assume it would be probing 
the apt database right?
Checked behind which system calls that happens and got this:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 97.61  173.666872           3  48083857  39039084 newfstatat
  1.48    2.630453           3    846972           fcntl
  0.56    0.989142           3    273133           pread64
  0.34    0.600204           2    212784           fstat
  0.00    0.008634        2878         3           wait4
  0.00    0.005327           4      1269           read
  0.00    0.005153        1288         4           execve
  0.00    0.005143           4      1057           munmap
  0.00    0.004791           3      1329           mmap
  0.00    0.003859        1286         3           clone
  0.00    0.002790           3       832        49 openat
  0.00    0.001694           2       793           close
  0.00    0.001104           1       897         3 lseek
  0.00    0.000876           4       179           getdents64
  0.00    0.000623           1       457       448 ioctl
  0.00    0.000422           3       134           brk
  0.00    0.000248           3        63           mprotect
  0.00    0.000194           2        91           rt_sigaction
  0.00    0.000081          13         6         6 statfs
  0.00    0.000049           9         5           write
  0.00    0.000041           5         7           epoll_wait
  0.00    0.000034           3        11         7 access
  0.00    0.000026           8         3           sendto
  0.00    0.000023           2        11           getrandom
  0.00    0.000021           0        24           futex
  0.00    0.000017           5         3           recvmsg
  0.00    0.000014           1        13           epoll_ctl
  0.00    0.000012           3         4           rseq
  0.00    0.000011           2         4           getuid
  0.00    0.000011           2         4           arch_prctl
  0.00    0.000011           2         4           set_tid_address
  0.00    0.000010           2         4           umask
  0.00    0.000010           2         4           getgid
  0.00    0.000009           1         7           set_robust_list
  0.00    0.000009           2         4           prlimit64
  0.00    0.000007           7         1           rt_sigreturn
  0.00    0.000007           3         2           epoll_create1
  0.00    0.000007           1         5           pipe2
  0.00    0.000006           0        14           getpid
  0.00    0.000004           2         2           msync
  0.00    0.000004           0        10         9 readlink
  0.00    0.000003           0         5           geteuid
  0.00    0.000003           1         2           gettid
  0.00    0.000002           1         2           getcwd
  0.00    0.000000           0         9           dup2
  0.00    0.000000           0         1           socket
  0.00    0.000000           0         1           connect
  0.00    0.000000           0         1           shutdown
  0.00    0.000000           0         1           getsockopt
  0.00    0.000000           0         3           uname
  0.00    0.000000           0         1           flock
  0.00    0.000000           0         1           getegid
  0.00    0.000000           0         6         4 prctl
------ ----------- ----------- --------- --------- ----------------
100.00  177.927961           3  49424042  39039610 total

That is quite some unexpected fsstat and if that keeps my CPU busy for a
minute I wonder even more why :-/


I've looked a bit, but didn't have enough time.
Could be around _compute_packages_changes and its calling eventually causing 
way too many find_index in apt_pkg.SourceList which takes 82ns each and happens 
about a quarter million times. I feel this might be a red herring, so do not go 
too much into that, but for completeness I'll attach a screenshot of a python 
profile in kcachegrind.

Repro for me is as easy as:
  $ sudo /usr/bin/time -v python3 /usr/bin/landscape-package-reporter

Maybe someone else could start cross checking if this is about a minute
of activity on every system or if a certain condition needs to be met.

** Attachment added: "kcachegrind (potential red herring though)"
   
https://bugs.launchpad.net/landscape-client/+bug/675577/+attachment/5883406/+files/Screenshot%20from%202025-06-11%2012-12-22.png

** Changed in: landscape-client (Ubuntu)
       Status: Invalid => New

** Changed in: landscape-client
       Status: Invalid => New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/675577

Title:
  landsape package reporter takes up too much cpu and memory resources

To manage notifications about this bug go to:
https://bugs.launchpad.net/landscape-client/+bug/675577/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to