pcp icon indicating copy to clipboard operation
pcp copied to clipboard

pmdalinux generates a coredump every boot on Arch Linux

Open Akusari opened this issue 3 years ago • 6 comments

Hello there,

pmdalinux generates every single boot a coredump. I'm using pcp in combination of cockpit for virtual machines. I'm using Arch Linux and it looks like it's a pcp glibc problem. My automatic boot scripts logging such staff:

*********************************************
Generating boot report...
*********************************************

Date: Mo 29. Mai 11:30:10 CEST 2023

*********************************************

systemd:   UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.

*********************************************

systemd-journal: Mai 29 11:25:03 daten-box (udev-worker)[557]: 0000:28:00.1: /etc/udev/rules.d/15-amd-bar-support.rules:2 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.1/resource2_resize}, ignoring: No such file or directory
Mai 29 11:25:03 daten-box (udev-worker)[599]: 0000:28:00.0: /etc/udev/rules.d/15-amd-bar-support.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/resource0_resize}, ignoring: Device or resource busy
Mai 29 11:25:04 daten-box kernel: gspca_vc032x: reg_r err -32
Mai 29 11:25:12 daten-box smbd[978]: [2023/05/29 11:25:12.472103,  0] ../../source3/smbd/server.c:1746(main)
Mai 29 11:25:12 daten-box smbd[978]:   smbd version 4.18.2 started.
Mai 29 11:25:12 daten-box smbd[978]:   Copyright Andrew Tridgell and the Samba Team 1992-2023
Mai 29 11:25:12 daten-box smbd[978]: [2023/05/29 11:25:12.473818,  0] ../../lib/param/loadparm.c:1957(lpcfg_do_service_parameter)
Mai 29 11:25:12 daten-box smbd[978]:   Global parameter load printers found in service section!
Mai 29 11:25:12 daten-box systemd-coredump[1432]: Process 1094 (pmdalinux) of user 0 dumped core.
                                                  
                                                  Stack trace of thread 1094:
                                                  #0  0x00007f93a34f126c n/a (libc.so.6 + 0x8926c)
                                                  #1  0x00007f93a34a1a08 raise (libc.so.6 + 0x39a08)
                                                  #2  0x00007f93a348a538 abort (libc.so.6 + 0x22538)
                                                  #3  0x00007f93a348b2db n/a (libc.so.6 + 0x232db)
                                                  #4  0x00007f93a349a227 n/a (libc.so.6 + 0x32227)
                                                  #5  0x00007f93a34fdecc n/a (libc.so.6 + 0x95ecc)
                                                  #6  0x00007f93a34fee93 n/a (libc.so.6 + 0x96e93)
                                                  #7  0x00007f93a34ff82a malloc (libc.so.6 + 0x9782a)
                                                  #8  0x00007f93a371cb12 pmdaFetch (libpcp_pmda.so.3 + 0xeb12)
                                                  #9  0x0000556163027e60 n/a (pmdalinux + 0xfe60)
                                                  #10 0x00007f93a3718d44 __pmdaMainPDU (libpcp_pmda.so.3 + 0xad44)
                                                  #11 0x00007f93a3719909 pmdaMain (libpcp_pmda.so.3 + 0xb909)
                                                  #12 0x0000556163027510 n/a (pmdalinux + 0xf510)
                                                  #13 0x00007f93a348b850 n/a (libc.so.6 + 0x23850)
                                                  #14 0x00007f93a348b90a __libc_start_main (libc.so.6 + 0x2390a)
                                                  #15 0x0000556163027715 n/a (pmdalinux + 0xf715)
                                                  ELF object binary architecture: AMD x86-64
░░ Subject: Speicherabbild für Prozess 1094 (pmdalinux) generiert
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ Documentation: man:core(5)
░░ 
░░ Prozess 1094 (pmdalinux) ist abgebrochen worden und
░░ ein Speicherabbild wurde generiert.
░░ 
░░ Üblicherweise ist dies ein Hinweis auf einen Programmfehler und sollte
░░ als Fehler dem jeweiligen Hersteller gemeldet werden.
Mai 29 11:25:45 daten-box smbd[2214]: [2023/05/29 11:25:45.545637,  0] ../../lib/param/loadparm.c:1957(lpcfg_do_service_parameter)
Mai 29 11:25:45 daten-box smbd[2214]:   Global parameter load printers found in service section!

*********************************************

Packages:

[daniel@daten-box]~$ pacman -Ss pcp |grep -i install
extra/cockpit-pcp 292-1 [Installiert]
extra/pcp 6.0.4-1 [Installiert]
[daniel@daten-box]~$ pacman -Ss cockpit |grep -i install
extra/cockpit 292-1 [Installiert]
extra/cockpit-machines 290-1 [Installiert]
extra/cockpit-pcp 292-1 [Installiert]
extra/cockpit-storaged 292-1 [Installiert]
[daniel@daten-box]~$ pacman -Ss glibc |grep -i install
core/glibc 2.37-3 [Installiert]
core/lib32-glibc 2.37-3 [Installiert]
extra/nss-mdns 0.15.1-1 [Installiert]

Linux Kernel:

[daniel@daten-box]~$ sudo dmesg |grep "Command line:"
[    0.000000] Command line: initrd=\amd-ucode.img initrd=\initramfs-linux.img root=/dev/mapper/sys-root rw init=/usr/lib/systemd/systemd amd_pstate=active preempt=voluntary iommu=pt vfio-pci.ids=1002:73df,1002:ab28 video=efifb:off modprobe.blacklist=amdgpu lang=de locale=de_DE.UTF-8 loglevel=3 mitigations=off noresume
[daniel@daten-box]~$ uname -a
Linux daten-box 6.3.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 24 May 2023 17:44:00 +0000 x86_64 GNU/Linux

Coredump:

[daniel@daten-box]~$ sudo coredumpctl
[sudo] Passwort für daniel:
TIME                          PID UID GID SIG     COREFILE EXE                                  SIZE
Mon 2023-05-29 09:23:46 CEST 1076   0   0 SIGABRT present  /usr/lib/pcp/pmdas/linux/pmdalinux 269.2K
Mon 2023-05-29 11:25:12 CEST 1094   0   0 SIGABRT present  /usr/lib/pcp/pmdas/linux/pmdalinux 268.2K

Fresh (re)installed, but i had the same problems some weeks ago and removed all packages to wait for a new version. Now i saw a new minor version and test again.

Please let me know if you need more informations. :-)

Regards Akusari

Akusari avatar May 29 '23 10:05 Akusari

@Akusari This is new. I run a 64-bit ArchLinux VM in my QA Farm and have not seen anything like this before ... so it is probably something specific to your hardware or kernel configuration or boot timing.

Does pmdalinux fail if pmcd is restarted after reboot? If no, then we're looking at an issue during booting. If yes, then the problem is more systemic (and should be easier to debug).

Immediately after pmdalinux has dumped core, can you add the contents of the /var/log/pcp/pmcd/linux.log file to this issue?

And if the log file does not contain anything interesting, could I ask that you edit /etc/pcp/pmcd/pmcd.conf and add -Dlibpmda to the pmdalinux line, e.g.

linux	60	pipe	binary		/var/lib/pcp/pmdas/linux/pmdalinux -Dlibpmda

and repeat the experiment. When the abort occurs, we'll need the contents of the /var/log/pcp/pmcd/linux.log (which will be much bigger this time).

kmcdonell avatar May 29 '23 21:05 kmcdonell

Thanks for the pretty good information and help so far. :-) Well, i can restart pcmd.service without any problems. No crashes at all. So yes, it could be a boot timing problem. I started to play a little with some drop-in lines in the pmcd and pmlogger systemd services. Just for example i added a waiting time for one of them, reversed order and back and together. Each time a full system reboot was done of course. During the tests i noticed that the pmdalinux crash will be triggered through pmlogger.service. If pcmd.service boots without a pmlogger.service enabled everything runs smoothly like it should be. If i start pmlogger.service manual after that boot the crash is there. :-/ Funny thing is that this is default dependencies inside these services. pmlogger.service should trigger pcmd.service. That's the reason why pmdalinux crashed each system boot. Both services has a systemd respawn feature enabled, if they fail a respawn is triggered by systemd like a getty tty device. After that "respawn" pmdalinux runs without any problems.

For this attached test (linux.log) i started pmcd manual first. After that pmlogger.service:

Journal messages for the linux.log file.

Mai 30 10:25:29 daten-box systemd-coredump[37900]: [🡕] Process 37453 (pmdalinux) of user 0 dumped core.
                                                   
                                                   Stack trace of thread 37453:
                                                   #0  0x00007fb9d092b26c n/a (libc.so.6 + 0x8926c)
                                                   #1  0x00007fb9d08dba08 raise (libc.so.6 + 0x39a08)
                                                   #2  0x00007fb9d08c4538 abort (libc.so.6 + 0x22538)
                                                   #3  0x00007fb9d08c52db n/a (libc.so.6 + 0x232db)
                                                   #4  0x00007fb9d08d4227 n/a (libc.so.6 + 0x32227)
                                                   #5  0x00007fb9d0937ecc n/a (libc.so.6 + 0x95ecc)
                                                   #6  0x00007fb9d0938e93 n/a (libc.so.6 + 0x96e93)
                                                   #7  0x00007fb9d093982a malloc (libc.so.6 + 0x9782a)
                                                   #8  0x00007fb9d0b56b12 pmdaFetch (libpcp_pmda.so.3 + 0xeb12)
                                                   #9  0x0000557c80f8ae60 n/a (pmdalinux + 0xfe60)
                                                   #10 0x00007fb9d0b52d44 __pmdaMainPDU (libpcp_pmda.so.3 + 0xad44)
                                                   #11 0x00007fb9d0b53909 pmdaMain (libpcp_pmda.so.3 + 0xb909)
                                                   #12 0x0000557c80f8a510 n/a (pmdalinux + 0xf510)
                                                   #13 0x00007fb9d08c5850 n/a (libc.so.6 + 0x23850)
                                                   #14 0x00007fb9d08c590a __libc_start_main (libc.so.6 + 0x2390a)
                                                   #15 0x0000557c80f8a715 n/a (pmdalinux + 0xf715)
                                                   ELF object binary architecture: AMD x86-64

However, i did all your propose steps and attached the file.

Regards Akusari linux.log

Akusari avatar May 30 '23 08:05 Akusari

I'm seeing this exact same core dump and stack trace on my Arch system at boot time as well.

If it is in fact "pmlogger.service should trigger pcmd.service.", then is there something we can do in the service files to avoid this crash?

It seems to me that there is some missing exception handling someplace as well. An error message would be preferable to a dump I think.

tildar avatar Jun 08 '23 12:06 tildar

@Akusari and/or @tildar ... I am going to need some help here. I cannot reproduce this and will need feedback from running some specially built versions of libpcp_pmda (and possibly pmdalinux) to make progress. Are you able to assist in this way?

I don't think this has anything to do with systemd nor timing, nor the tail end of the log file @Akusari captured. The problem is most likely in some kernel "stats" file that is not fully populated or not in the expected state when pmdalinux accesses it ... pmlogger is implicated simply because it is the FIRST process that is likely to trigger a metrics fetch from the linux PMDA.

Is there any chance you could collect the actual core file (I don't know what systemd-coredump is using to produce the call backtrace), but it would help to know which malloc() call in pmdaFetch() is triggering the fault ... but as I said to @Akusari in email, this might simply be the victim of some earlier malloc()/free() botch, rather than the cause.

I can harden the code in pmdaFetch() but without a reproducible test case this is something of a shotgun in the dark approach.

Hope you can help, 'cause I'd like to fix this.

kmcdonell avatar Jun 09 '23 05:06 kmcdonell

@kmcdonell I can offer you to rebuild the Arch Linux pcp package with debug symbols enabled und no stripe of course. Additional i can upload a coredump file. What else can i do for you ?

Akusari avatar Jun 10 '23 06:06 Akusari

Since some weeks there are no more coredumps on my system at all. I don't know what happend excatly, but everything is clean and runs smoothy. I can tell you that i'm using a pmproxy with a redis-server on this machine now to collect pcp data from other hosts and virtual machines as well. Maybe that could be a reason or something was updated on my rolling distro. However, from my point of view this issue ticket can be closed. :-)

Akusari avatar Oct 01 '23 04:10 Akusari