Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
afa5499
src: introduce custom smart pointers for `BaseObject`s
addaleax Sep 28, 2019
e1b1267
http2: use custom BaseObject smart pointers
addaleax Sep 28, 2019
95bf451
src: use BaseObjectPtr for keeping channel alive in dns bindings
addaleax Nov 12, 2019
cb196ce
src: remove keep alive option from SetImmediate()
addaleax Nov 12, 2019
92cb961
src: remove HandleWrap instances from list once closed
addaleax Oct 11, 2019
b18531d
src: keep object alive in stream_pipe code
addaleax Nov 26, 2019
ece9faf
src: add more `can_call_into_js()` guards
addaleax Nov 26, 2019
c3fff25
src: no SetImmediate from destructor in stream_pipe code
addaleax Nov 26, 2019
2470035
src: run native immediates during Environment cleanup
addaleax Nov 26, 2019
973f8ef
src: better encapsulate native immediate list
addaleax Dec 16, 2019
5e1bcae
src: exclude C++ SetImmediate() from count
addaleax Jan 15, 2020
f1aeed5
src: add a threadsafe variant of SetImmediate()
addaleax Jan 15, 2020
3f9d1dd
src: remove AsyncRequest
addaleax Jan 15, 2020
b0ce668
src: add interrupts to Environments/Workers
addaleax Jan 16, 2020
4e1a192
src: move MemoryInfo() for worker code to .cc files
addaleax Jan 16, 2020
a9c4fe5
report: add support for Workers
addaleax Jan 16, 2020
9c43d0e
src: simplify native immediate queue running
addaleax Jan 25, 2020
1915b5b
worker: move JoinThread() back into exit callback
addaleax Jan 22, 2020
4d3275b
src: harden running native `SetImmediate()`s slightly
addaleax Jan 22, 2020
d85cb07
src: delete BaseObjectWeakPtr data when pointee is gone
addaleax Mar 20, 2020
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
Prev Previous commit
Next Next commit
src: no SetImmediate from destructor in stream_pipe code
Guard against running `SetImmediate()` from the destructor.
The object will not be alive or usable in the callback,
so it does not make sense to attempt to schedule the
`SetImmediate()`.

PR-URL: #30666
Fixes: #30643
Refs: #30374
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed Apr 1, 2020
commit c3fff2511588e01da38dd84be4312f8a2c1f4616
6 changes: 4 additions & 2 deletions src/stream_pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ StreamPipe::StreamPipe(StreamBase* source,
}

StreamPipe::~StreamPipe() {
Unpipe();
Unpipe(true);
}

StreamBase* StreamPipe::source() {
Expand All @@ -53,7 +53,7 @@ StreamBase* StreamPipe::sink() {
return static_cast<StreamBase*>(writable_listener_.stream());
}

void StreamPipe::Unpipe() {
void StreamPipe::Unpipe(bool is_in_deletion) {
if (is_closed_)
return;

Expand All @@ -69,6 +69,8 @@ void StreamPipe::Unpipe() {
if (pending_writes_ == 0)
sink()->RemoveStreamListener(&writable_listener_);

if (is_in_deletion) return;

// Delay the JS-facing part with SetImmediate, because this might be from
// inside the garbage collector, so we can’t run JS here.
HandleScope handle_scope(env()->isolate());
Expand Down
2 changes: 1 addition & 1 deletion src/stream_pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StreamPipe : public AsyncWrap {
StreamPipe(StreamBase* source, StreamBase* sink, v8::Local<v8::Object> obj);
~StreamPipe() override;

void Unpipe();
void Unpipe(bool is_in_deletion = false);

static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Start(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down