diff --git a/src/stream_base.cc b/src/stream_base.cc index 3f2e4183291d35..86b56c740103ae 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -388,6 +388,7 @@ void ReportWritesToJSStreamListener::OnStreamAfterReqFinished( StreamBase* stream = static_cast(stream_); Environment* env = stream->stream_env(); AsyncWrap* async_wrap = req_wrap->GetAsyncWrap(); + CHECK(!async_wrap->persistent().IsEmpty()); Local req_wrap_obj = async_wrap->object(); Local argv[] = { diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 7ff49522438d65..f2118b5228a351 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -618,8 +618,10 @@ int TLSWrap::DoWrite(WriteWrap* w, if (i != count) { int err; Local arg = GetSSLError(written, &err, &error_); - if (!arg.IsEmpty()) + if (!arg.IsEmpty()) { + current_write_ = nullptr; return UV_EPROTO; + } pending_cleartext_input_.insert(pending_cleartext_input_.end(), &bufs[i],