-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: sanitize build artifacts using ASAN/LSAN #2794
Conversation
Great - so this failed with a very readable error:
It says we're leaking the snapshot blob. That seems not unlikely. |
core/libdeno/api.cc
Outdated
@@ -68,6 +68,8 @@ Deno* deno_new(deno_config config) { | |||
// If no snapshot is provided, we initialize the context with empty | |||
// main source code and source maps. | |||
deno::InitializeContext(isolate, context); | |||
} else { | |||
delete[] d->snapshot_.data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But makes tests fail 😓 still digging...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so I figured what causes this leak, however I'm not yet sure how to fix it.
The problem is in will_snapshot
test case in //cli/isolate.rs
; this test does a snapshot of a short script and then tries to instantiate a new isolate with that snapshot. Isolate.snapshot()
returns Snapshot1
which explicitly says in comment:
/// The type returned from deno_snapshot_new. Needs to be dropped.
During creation of new isolate (Isolate::new
) this snapshot is passed in deno_config
as load_snapshot
(which has a type of Snapshot2
not Snapshot1
). However there is no way to tell that this is the type of snapshot on C++ side and Rust's borrow checker prevents an explicitly drop after calling libdeno::deno_new
.
@bartlomieju Isolate::snapshot will stick around, it's how deno_typescript makes snapshots. That said, I think more work needs to be put into fixing the memory ownership situation and merging the Snapshot1 Snapshot2 types. |
Closing because it's old. We've since removed the ASAN test completely when we moved to "cargo build"... Hoping to bring that back at some point when Rust supports it in stable. |
This PR is intended to sanitize more build targets.
Currently only
libdeno_test
is built and run with ASAN/LSAN