Skip to content

Commit 362525f

Browse files
committed
Add experimental "no-panic" feature.
When enabled, any "this should never happen" errors in dispatcher and/or hostcalls will be logged, but the processing will continue as if nothing happened, instead of panicking and trapping WasmVM. Note that any execution past the "should have panicked" point is undefined, since the state of contexts can get out-of-sync with the host when errors and/or events are being ignored. Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
1 parent 2218c34 commit 362525f

File tree

6 files changed

+505
-147
lines changed

6 files changed

+505
-147
lines changed

‎BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ rust_library(
3939
],
4040
)
4141

42+
rust_library(
43+
name = "proxy_wasm_no_panic",
44+
srcs = glob(["src/*.rs"]),
45+
crate_features = ["no-panic"],
46+
crate_name = "proxy_wasm",
47+
edition = "2018",
48+
visibility = ["//visibility:public"],
49+
deps = [
50+
":proxy_wasm_build_script",
51+
"//bazel/cargo/remote:hashbrown",
52+
"//bazel/cargo/remote:log",
53+
],
54+
)
55+
4256
rust_binary(
4357
name = "http_auth_random",
4458
srcs = ["examples/http_auth_random/src/lib.rs"],

‎Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ build = "build.rs"
1414
hashbrown = "0.15"
1515
log = "0.4"
1616

17+
[features]
18+
default = []
19+
no-panic = []
20+
1721
[profile.release]
1822
lto = true
1923
opt-level = 3

‎examples/http_auth_random/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212

1313
[dependencies]
1414
log = "0.4"
15-
proxy-wasm = { path = "../../" }
15+
proxy-wasm = { path = "../../", features = ["no-panic"] }
1616

1717
[profile.release]
1818
lto = true

0 commit comments

Comments
 (0)