Skip to content

Commit 92df037

Browse files
committed
Warn when max memory is exceeded
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
1 parent 40e88fa commit 92df037

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ tokio = "1"
165165
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12"] }
166166
toml = "0.8"
167167
toml_edit = "0.22"
168-
tracing = { version = "0.1", features = ["log"] }
168+
tracing = { version = "0.1.41", features = ["log"] }
169169
url = "2"
170170
walkdir = "2"
171171
wasi-common-preview1 = { version = "33.0.0", package = "wasi-common", features = [

crates/core/src/limits.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl ResourceLimiterAsync for StoreLimitsAsync {
1717
&mut self,
1818
current: usize,
1919
desired: usize,
20-
_maximum: Option<usize>,
20+
maximum: Option<usize>,
2121
) -> Result<bool> {
2222
let can_grow = if let Some(limit) = self.max_memory_size {
2323
desired <= limit
@@ -27,6 +27,15 @@ impl ResourceLimiterAsync for StoreLimitsAsync {
2727
if can_grow {
2828
self.memory_consumed =
2929
(self.memory_consumed as i64 + (desired as i64 - current as i64)) as u64;
30+
} else {
31+
tracing::warn!(
32+
"error.type" = "memory_limit_exceeded",
33+
current,
34+
desired,
35+
maximum,
36+
max_memory_size = self.max_memory_size,
37+
"instance memory limit exceeded",
38+
);
3039
}
3140
Ok(can_grow)
3241
}

0 commit comments

Comments
 (0)