Skip to content

Commit

Permalink
add support for oom detection
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Phillips <rphillips@redhat.com>
  • Loading branch information
rphillips committed May 9, 2022
1 parent 7bcb7e2 commit c354aaf
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 78 deletions.
142 changes: 138 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ release-static:
make release && \
strip -s target/x86_64-unknown-linux-musl/release/$(BINARY)"

lint:
lint: .install.golangci-lint
cargo fmt
$(GOTOOLS_BINDIR)/golangci-lint run

unit:
cargo test --bins --no-fail-fast
Expand All @@ -39,7 +40,7 @@ integration: .install.ginkgo release # It needs to be release so we correctly te
export CONMON_BINARY="$(MAKEFILE_PATH)target/release/$(BINARY)" && \
export RUNTIME_BINARY="$(RUNTIME_PATH)" && \
export MAX_RSS_KB=10240 && \
"$(GOTOOLS_BINDIR)/ginkgo" -v -r pkg/client
sudo -E "$(GOTOOLS_BINDIR)/ginkgo" -v -r pkg/client

integration-static: .install.ginkgo # It needs to be release so we correctly test the RSS usage
export CONMON_BINARY="$(MAKEFILE_PATH)target/x86_64-unknown-linux-musl/release/$(BINARY)" && \
Expand All @@ -48,11 +49,14 @@ integration-static: .install.ginkgo # It needs to be release so we correctly tes
fi && \
export RUNTIME_BINARY="$(RUNTIME_PATH)" && \
export MAX_RSS_KB=2800 && \
$(GOTOOLS_BINDIR)/ginkgo -v -r pkg/client
sudo -E "$(GOTOOLS_BINDIR)/ginkgo" -v -r pkg/client

.install.ginkgo:
GOBIN=$(abspath $(GOTOOLS_BINDIR)) go install github.com/onsi/ginkgo/v2/ginkgo@latest

.install.golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(abspath $(GOTOOLS_BINDIR)) sh -s v1.45.2

clean:
rm -rf target/

Expand Down
4 changes: 4 additions & 0 deletions conmon-rs/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ tracing = "0.1.34"
tracing-journald = "0.3.0"
tracing-subscriber = "0.3.11"
uuid = { version = "1.0.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
regex = "1.5.5"
notify = "5.0.0-pre.14"
tokio-eventfd = "0.2.0"
lazy_static = "1.4.0"

[build-dependencies]
shadow-rs = "0.11.0"
Expand Down
5 changes: 5 additions & 0 deletions conmon-rs/server/src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub struct Child {
#[getset(get = "pub")]
exit_paths: Vec<PathBuf>,

#[getset(get = "pub")]
oom_exit_paths: Vec<PathBuf>,

#[getset(get = "pub")]
timeout: Option<Instant>,

Expand All @@ -26,13 +29,15 @@ impl Child {
id: String,
pid: u32,
exit_paths: Vec<PathBuf>,
oom_exit_paths: Vec<PathBuf>,
timeout: Option<Instant>,
io: SharedContainerIO,
) -> Self {
Self {
id,
pid,
exit_paths,
oom_exit_paths,
timeout,
io,
}
Expand Down

0 comments on commit c354aaf

Please sign in to comment.