Liking cljdoc? Tell your friends :D

hive-compose.promote.oom

Pure: resource caps on suite runners and the diagnosis of an OOM kill (hc-16b).

  • mem-bytes / mem-str docker memory notation <-> bytes.
  • capped-argv the argv a host command runs under for a cap: systemd-run --user --scope -p MemoryMax=<cap> -p MemorySwapMax=0, or ulimit -v when no systemd user manager answers (cap-mode).
  • container-cap-args the docker run flags of a cap.
  • container-finding a finding out of one docker inspect object: State.OOMKilled true with exit 137.
  • host-finding a finding out of a capped host run: the scope's Result is oom-kill, or, under the ulimit fallback, an allocation failure in the output.
  • why-line '<service> OOM-killed at <cap>', the line the failure bundle and compose why print.
  • mark-run / mark-rows the finding on a run result and on its flake history rows (:case/oom? true), so the history classifies the run as :oom, never as a flake.

A finding is {:oom/service s :oom/cap bytes-or-nil :oom/source :container|:scope|:ulimit :oom/exit n-or-nil :oom/line string} No IO here: docker inspect and systemctl answers arrive as values.

Pure: resource caps on suite runners and the diagnosis of an OOM kill
(hc-16b).

- `mem-bytes` / `mem-str`  docker memory notation <-> bytes.
- `capped-argv`            the argv a host command runs under for a cap:
                           `systemd-run --user --scope -p MemoryMax=<cap>
                           -p MemorySwapMax=0`, or `ulimit -v` when no
                           systemd user manager answers (`cap-mode`).
- `container-cap-args`     the `docker run` flags of a cap.
- `container-finding`      a finding out of one `docker inspect` object:
                           State.OOMKilled true with exit 137.
- `host-finding`           a finding out of a capped host run: the scope's
                           Result is oom-kill, or, under the ulimit
                           fallback, an allocation failure in the output.
- `why-line`               '<service> OOM-killed at <cap>', the line the
                           failure bundle and `compose why` print.
- `mark-run` / `mark-rows` the finding on a run result and on its flake
                           history rows (`:case/oom? true`), so the history
                           classifies the run as :oom, never as a flake.

A finding is
  {:oom/service s :oom/cap bytes-or-nil :oom/source :container|:scope|:ulimit
   :oom/exit n-or-nil :oom/line string}
No IO here: docker inspect and systemctl answers arrive as values.
raw docstring

cap-modeclj

(cap-mode mem systemd?)

How a host command with memory cap mem (bytes or nil) runs: :none with no cap, :systemd when a systemd user manager answers (systemd?), else :ulimit, the fallback that bounds address space rather than resident memory and is reported as such.

How a host command with memory cap `mem` (bytes or nil) runs: :none with
no cap, :systemd when a systemd user manager answers (`systemd?`), else
:ulimit, the fallback that bounds address space rather than resident
memory and is reported as such.
sourceraw docstring

cap-noteclj

(cap-note mode mem)

What the report says about how a command was capped, nil when it was not.

What the report says about how a command was capped, nil when it was not.
sourceraw docstring

capped-argvclj

(capped-argv command {:keys [mode mem cpus unit]})

The argv command (an argv vector, or a string run through sh -c) runs under for opts {:mode (see cap-mode) :mem bytes :cpus n? :unit name}.

:systemd systemd-run --user --scope --quiet --unit=<unit> -p MemoryMax=<mem> -p MemorySwapMax=0 [-p CPUQuota=<n>%] -- cmd.. The scope is not --collect'ed: its Result (oom-kill) is read after the run, then the unit is reset (scope-result-argv, scope-reset-argv). :ulimit sh -c 'ulimit -v <KiB> && exec "$@"' sh cmd.. :none the command as is.

The argv `command` (an argv vector, or a string run through `sh -c`) runs
under for `opts` {:mode (see `cap-mode`) :mem bytes :cpus n? :unit name}.

:systemd  systemd-run --user --scope --quiet --unit=<unit>
          -p MemoryMax=<mem> -p MemorySwapMax=0 [-p CPUQuota=<n>%] -- cmd..
          The scope is not --collect'ed: its Result (oom-kill) is read after
          the run, then the unit is reset (`scope-result-argv`,
          `scope-reset-argv`).
:ulimit   sh -c 'ulimit -v <KiB> && exec "$@"' sh cmd..
:none     the command as is.
sourceraw docstring

container-cap-argsclj

(container-cap-args {:keys [mem cpus]})

The docker run flags of caps {:mem bytes? :cpus n?}: memory with no swap beyond it (--memory-swap equal to --memory), and cpus.

The `docker run` flags of `caps` {:mem bytes? :cpus n?}: memory with no
swap beyond it (--memory-swap equal to --memory), and cpus.
sourceraw docstring

container-findingclj

(container-finding service inspect)

The finding of inspect, one object of docker inspect output (string keys, as JSON reads it), for service; nil unless the container was OOM-killed: State.OOMKilled true and exit code 137. The cap is HostConfig.Memory when positive.

The finding of `inspect`, one object of `docker inspect` output (string
keys, as JSON reads it), for `service`; nil unless the container was
OOM-killed: State.OOMKilled true and exit code 137. The cap is
HostConfig.Memory when positive.
sourceraw docstring

findingclj

(finding service cap source exit)

A finding with its :oom/line.

A finding with its `:oom/line`.
sourceraw docstring

host-findingclj

(host-finding service {:keys [mode mem exit scope-result output]})

The finding of a capped host run of service, nil when it was no OOM kill. run is {:mode :systemd|:ulimit|:none :mem bytes :exit n :scope-result string (systemd) :output text (the run's last output)}.

  • :systemd the scope's Result is oom-kill.
  • :ulimit a non-zero exit with an allocation failure in the output.
  • :none never: an uncapped run's death is no cap's doing.
The finding of a capped host run of `service`, nil when it was no OOM kill.
`run` is {:mode :systemd|:ulimit|:none :mem bytes :exit n
:scope-result string (systemd) :output text (the run's last output)}.
- :systemd  the scope's Result is oom-kill.
- :ulimit   a non-zero exit with an allocation failure in the output.
- :none     never: an uncapped run's death is no cap's doing.
sourceraw docstring

logged-commandclj

(logged-command command log)

command with its output appended to file log and stdin from /dev/null, as an argv: sh -c 'log=$1; shift; exec "$@" >>"$log" 2>&1 </dev/null' sh <log> cmd... A runner's output can be unbounded; it goes to a file and only its tail is read, never the whole stream.

`command` with its output appended to file `log` and stdin from /dev/null,
as an argv: `sh -c 'log=$1; shift; exec "$@" >>"$log" 2>&1 </dev/null'
sh <log> cmd..`. A runner's output can be unbounded; it goes to a file and
only its tail is read, never the whole stream.
sourceraw docstring

mark-rowsclj

(mark-rows run rows)

The flake history rows of run (hc-13 CaseOutcome) tagged :case/oom? true when the run was OOM-killed, so the history reads it as :oom.

The flake history rows of `run` (hc-13 CaseOutcome) tagged `:case/oom?
true` when the run was OOM-killed, so the history reads it as :oom.
sourceraw docstring

mark-runclj

(mark-run run findings)

Run result run (hc-8 cell result) with the first of findings under :oom, unchanged when there is none.

Run result `run` (hc-8 cell result) with the first of `findings` under
:oom, unchanged when there is none.
sourceraw docstring

mem-bytesclj

(mem-bytes v)

Bytes of v: a positive integer as is, or docker's notation (digits, an optional binary k|m|g|t unit with an optional trailing b, any case: "512m", "2g", "64kb"). nil for nil, zero, a negative number or text that is not that notation.

Bytes of `v`: a positive integer as is, or docker's notation (digits, an
optional binary k|m|g|t unit with an optional trailing b, any case:
"512m", "2g", "64kb"). nil for nil, zero, a negative number or text
that is not that notation.
sourceraw docstring

mem-strclj

(mem-str bytes)

bytes in docker notation with the largest binary unit that divides it exactly: 536870912 -> "512m", 2147483648 -> "2g", 1610612736 -> "1536m", 1000 -> "1000b".

`bytes` in docker notation with the largest binary unit that divides it
exactly: 536870912 -> "512m", 2147483648 -> "2g", 1610612736 ->
"1536m", 1000 -> "1000b".
sourceraw docstring

oom-run?clj

(oom-run? run)

True when run result run carries an OOM finding.

True when run result `run` carries an OOM finding.
sourceraw docstring

scope-reset-argvclj

(scope-reset-argv unit)

argv releasing a failed transient scope unit once its Result is read.

argv releasing a failed transient scope `unit` once its Result is read.
sourceraw docstring

scope-result-argvclj

(scope-result-argv unit)

argv reading the Result of transient scope unit (oom-kill, success ..).

argv reading the Result of transient scope `unit` (oom-kill, success ..).
sourceraw docstring

scope-unitclj

(scope-unit name now-ms)

The transient scope a suite command runs in: hc-suite-<name>-<ms>, the name reduced to [a-zA-Z0-9_.-] so it is a valid unit name.

The transient scope a suite command runs in: `hc-suite-<name>-<ms>`, the
name reduced to [a-zA-Z0-9_.-] so it is a valid unit name.
sourceraw docstring

why-lineclj

(why-line {:oom/keys [service cap source]})

The line a failure bundle and compose why print for a finding: '<service> OOM-killed at <cap>', '<service> OOM-killed (no cap; host OOM killer)' when no cap is known, and under the ulimit fallback '<service> hit its address-space cap at <cap> (ulimit -v)'.

The line a failure bundle and `compose why` print for a finding:
'<service> OOM-killed at <cap>', '<service> OOM-killed (no cap; host OOM
killer)' when no cap is known, and under the ulimit fallback '<service>
hit its address-space cap at <cap> (ulimit -v)'.
sourceraw docstring

why-linesclj

(why-lines findings)

The why lines of findings, sorted by service, distinct.

The why lines of `findings`, sorted by service, distinct.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close