Skip to content
Open
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
8 changes: 6 additions & 2 deletions src/runtime/webcore/fetch/FetchTasklet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,12 @@ impl FetchTasklet {
}
let self_ = Self::from_raw_ref(this);
if self_.javascript_vm.is_shutting_down() {
// SAFETY: last ref; exclusive access
unsafe { FetchTasklet::deinit(this) };
// SAFETY (Intentional Leak): We are on the background HTTP thread.
// During VM shutdown, the JS event loop is dead, so enqueueing a task
// is useless. However, calling `deinit()` synchronously from here is UB:
// it destroys JS-bound handles (`Response::unref` mutating `Cell<u32>`,
// `ReadableStream::Strong`, etc.) off the main JS thread.
// We explicitly abandon this allocation and let the OS reclaim it.
return;
}
// this is really unlikely to happen, but can happen
Expand Down