Skip to content

Commit 670999f

Browse files
Merge pull request #3147 from fibonacci1729/warn-on-mem-exceeded
Warn when max memory is exceeded
2 parents fd62274 + 92df037 commit 670999f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ tokio = "1"
164164
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12"] }
165165
toml = "0.8"
166166
toml_edit = "0.22"
167-
tracing = { version = "0.1", features = ["log"] }
167+
tracing = { version = "0.1.41", features = ["log"] }
168168
url = "2"
169169
walkdir = "2"
170170
wasm-encoder = "0.230"

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)