Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ sct = { version = "0.7" }
semver = { version = "1.0" }
serde = { version = "1.0" }
serde_json = { version = "1.0" }
sharded-slab = { version = "0.1" }
sha2 = { version = "0.10" }
signature = { version = "2.2" }
thiserror = { version = "1.0" }
Expand All @@ -162,9 +163,14 @@ tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }
wasm-bindgen = { version = "0.2" }
wasm-bindgen-futures = { version = "0.4" }
web-spawn = { version = "0.2" }
web-spawn = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "f674edd" }
web-time = { version = "0.2" }
webpki-roots = { version = "1.0" }
webpki-root-certs = { version = "1.0" }
ws_stream_wasm = { version = "0.7.5" }
zeroize = { version = "1.8" }

[patch.crates-io]
# Replace sharded-slab with a wasm-friendly fork that provides explicit
# thread-id cleanup (wasm-bindgen does not run Rust TLS destructors).
sharded-slab = { git = "https://github.com/tlsnotary/sharded-slab" }
3 changes: 1 addition & 2 deletions crates/harness/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ edition = "2024"
publish = false

[features]
# Disable tracing events as a workaround for issue 959.
default = ["tracing/release_max_level_off"]
default = []
# Used to debug the executor itself.
debug = []

Expand Down
1 change: 1 addition & 0 deletions crates/harness/executor/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use harness_core::{

use crate::Executor;

#[allow(unused_imports)]
pub use tlsn_wasm::*;

unsafe extern "C" {
Expand Down
1 change: 1 addition & 0 deletions crates/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pin-project-lite = { workspace = true }
rayon = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { version = "1.0" }
sharded-slab = { workspace = true }
time = { version = "=0.3.37", features = ["wasm-bindgen"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["time"] }
Expand Down
13 changes: 13 additions & 0 deletions crates/wasm/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,16 @@ pub(crate) fn filter(config: LoggingConfig) -> impl Fn(&Metadata) -> bool {
meta.level() <= level
}
}

#[no_mangle]
pub(crate) extern "C" fn __worker_teardown() {
use sharded_slab::DefaultConfig;
// Manually release sharded_slab's per-thread state.
//
// On native targets this would normally be cleaned up by Rust's
// thread-local destructors when a thread exits. However, in the
// wasm32 + wasm-bindgen threading model, TLS destructors are not
// invoked when a Web Worker is terminated. As a result, we must
// perform this cleanup explicitly before the worker is destroyed.
sharded_slab::release_current_thread_id::<DefaultConfig>();
}
Loading