Re: coredumpctl: matching by e.g. env var?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Di, 28.03.23 08:13, Stephan Bergmann (sbergman@xxxxxxxxxx) wrote:

> On 27/03/2023 13:38, Lennart Poettering wrote:
> > another idea: can't you just wrap your tests in "systemd-run --scope
> > --user --name=somtestid47110815.scope" or so? we pick up unit
> > names in coredump handling. With that you'd run yur tests inside a
> > scope unit, and can then use that as key in logs+coredump.
>
> Thanks, that looks useful, `systemd-run --scope --user --unit=... ...` and
> `coredumpctl debug COREDUMP_USER_UNIT=....scope ...`.
>
> * Is it guaranteed for system-run --scope that the wrapped command will run
> in the surrounding process group?  (Because LibreOffice' Jenkins relies on a
> single process group for a whole `make check` to reliably kill stuck builds.
> And it looks like systemd-run --scope is just a lightweight wrapper that
> then exec's the command in the same process, which looks promising.)

Yes. Process groups and control groups are orthogonal. Moving a
process into a cgroup via systemd's "scope" concept won't affect
process group membership.

In fact, Linux doesn't have any API to change process group membership
from the "outside" anyway. Processes can only do this from "inside"
the process. Hence even if we wanted, we couln't affect that.

> * Is there a grammar for those --unit=X resp. COREDUMP_USER_UNIT=X'.scope
> values?  I noticed that at least "/" in X gets replaced with "-" in X'.  Is
> there a length limit?

See systemd.unit(5) man page describes unit name syntax:

<snip>
… The "unit prefix" must consist of one or more valid
characters (ASCII letters, digits, ":", "-", "_", ".", and "\"). The
total length of the unit name including the suffix must not exceed 256
characters. The type suffix must be one of ".service", ".socket",
".device", ".mount", ".automount", ".swap", ".target", ".path",
".timer", ".slice", or ".scope". …
</snip>

> * Is there a direct way to run `coredumpctl debug
> COREDUMP_USER_UNIT=....scope ...` on all matching core dumps, not just the
> most recent one?  (I figured I need to prepare a list with `coredumpctl
> --json=short list COREDUMP_USER_UNIT=....scope | jq -r
> 'map(select(.corefile="present"))|map(.pid)|join(" ")' first, and then
> iterate over it with `coredumpctl debug COREDUMP_USER_UNIT=....scope
> COREDUMP_PID="$i" ...`)

We currently do not support that, no. File an RFE issue asking for
that, if you like.

Lennart

--
Lennart Poettering, Berlin



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux