Skip to content

tests/ui-smoke: match the versioned python in coredumpctl - #4703

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:crashdump-coredumpctl-exe
Open

grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:crashdump-coredumpctl-exe

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

@hdiethelm, this is the coredumpctl bug you found in #4648.

A bare name given to coredumpctl matches the command name, and the GUIs start from a #!/usr/bin/python3.13 line, so systemd-coredump records a crashed gmoccapy as gmoccapy, with /usr/bin/python3.13 as the executable. The python3 match in crashdump.sh found nothing and the report always fell back to "no readable core dump". It now matches readlink -f "$(command -v python3)", which coredumpctl compares with the executable and which finds the right interpreter whatever its version, and gdb gets that path too.

Tested with systemd-coredump on Debian 13: a script with a #!/usr/bin/python3.13 line that segfaults after crashdump_arm. On master the report says there is no core; with this change it prints the native backtrace. The plain-file core_pattern path is unchanged.

A bare name given to coredumpctl matches the command name, and the GUIs run from a "#!/usr/bin/python3.13" line, so systemd-coredump records them as "gmoccapy", "qtvcp" and so on, with /usr/bin/python3.13 as the executable. The "python3" match found nothing and crashdump.sh never got the core. Match the resolved path of python3 instead, which coredumpctl compares with the executable, and give the same path to gdb. Hannes Diethelm found it in LinuxCNC#4648.
@hdiethelm

Copy link
Copy Markdown
Contributor

Thanks for fixing this. Tested, it works.

Now looking at the code: coredumpctl could race in parallel tests. You take the newest coredump since test start, right? So if multiple tests crash, you could get twice the same coredump or otherwise mixed up results.

There is pretty much no doc about this, so i tested it. Inside bwrap, you see coredumps created in an other bwrap the way it is set up right now with coredumpctl due to the host handles coredumps but read access inside the bwrap to coredumps works fine. However, the PID is not the one inside but the one from the host.

File coredumps work well due to there are handled respecting the mount namespace. With sysctl -w kernel.core_pattern=/tmp/linuxcnc-ui-smoke-cores/core.%e.%p, the coredumps land inside the bwrap, not visible from the host, so no risk of a race.

Do you have a good idea to fix this?

  • Using the PID won't work. It is a different PID inside bwrap and the coredump shows always the host PID.
  • We could check for races and show a warning. If there are more than one python3 coredump since @$crashdump_arm_time, probably something went wrong, so better ignore it than show the wrong one.
  • Just write in the doc that for parallel tests, you need to set sysctl -w kernel.core_pattern=/tmp/linuxcnc-ui-smoke-cores/core.%e.%p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants