Skip to content
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

v7.7.4 Release Proposal #11941

Merged
merged 48 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
14e3ad0
inspector: proper WS URLs when bound to 0.0.0.0
Mar 1, 2017
5b1d61c
child_process: fix deoptimizing use of arguments
vsemozhetbyt Feb 19, 2017
9a59913
util: avoid using forEach
jasnell Feb 27, 2017
5408301
tls: keep track of stream that is closed
jBarz Mar 9, 2017
646ee55
tls: avoid using forEach
jasnell Feb 26, 2017
5f6025b
test: fail when child dies in fork-net
joyeecheung Mar 4, 2017
c9cf922
test: add regex to assert.throws
matejkrajcovic Mar 12, 2017
d2c9111
test: fix repl-function-redefinition-edge-case
aqrln Mar 8, 2017
2df662c
test: test resolveObject with an empty path
watilde Mar 14, 2017
2649dab
test: added test for indexed properties
AnnaMag Mar 9, 2017
f9c831f
test: fix flaky test-domain-abort-on-uncaught
Trott Mar 12, 2017
560d8ee
test: delay child exit in AIX for pseudo-tty tests
gireeshpunathil Mar 6, 2017
3ae58ac
test: failing behaviour on sandboxed Proxy
AnnaMag Mar 2, 2017
8bda7b8
test: add coverage for child_process bounds check
Trott Mar 11, 2017
2cab00a
test: fix assertion in vm test
AnnaMag Mar 14, 2017
90be5a1
stream: avoid using forEach
jasnell Feb 26, 2017
62e7261
repl: avoid using forEach
jasnell Feb 27, 2017
e19ca8b
readline: remove unneeded eslint-disable comment
Trott Mar 14, 2017
a0b1aa1
readline: avoid using forEach
jasnell Feb 27, 2017
c0a2e02
net: avoid using forEach
jasnell Feb 27, 2017
7e23072
module: avoid using forEach
jasnell Feb 27, 2017
77c69f7
lib, test: add duplicate symbol checking in E()
DavidCai1111 Mar 13, 2017
9cc712c
lib: remove unused msg parameter in debug_agent
mr-spd Mar 13, 2017
fbbcd1a
lib: Fix swallowed events in inspect integration
Mar 15, 2017
cde5d71
doc: var -> let / const in events.md
vsemozhetbyt Mar 12, 2017
e6f113d
doc: console.log() -> console.error() in events.md
vsemozhetbyt Mar 12, 2017
ae52b63
doc: correct comment error in stream.md
Alex-Sokolov Mar 11, 2017
75fcf53
doc: missing argument types for events methods
ameliavoncat Mar 11, 2017
e84e33c
doc: fix a typo in api/process.md
sabakugaara Mar 10, 2017
78ca15d
doc: argument types for dns methods
ameliavoncat Mar 9, 2017
54879ab
doc: fix mistakes in stream doc (object mode)
chdh Mar 12, 2017
9861ec9
doc: increase Buffer.concat() documentation
cjihrig Mar 14, 2017
7c7228e
doc: gcc version is at least 4.8.5 in BUILDING.md
detailyang Mar 14, 2017
6d6a65e
doc: linkable commit message guidelines
sam-github Mar 10, 2017
0c09126
doc: add note that vm module is not a security mechanism
krydos Feb 25, 2017
a5f7393
doc: add vsemozhetbyt to collaborators
vsemozhetbyt Mar 20, 2017
a7e4b02
deps: Add node-inspect 1.10.6
Mar 15, 2017
5244ee3
build: mac OBJ_DIR should point to obj.target
danbev Mar 15, 2017
80949f3
build: add cpp linting to windows build
Mar 15, 2017
d0fb578
fs: avoid using forEach
jasnell Feb 26, 2017
dcac2d8
benchmark: benchmark comparing forEach with for
jasnell Feb 26, 2017
ca31986
deps: cherry-pick ca0f9573 from V8 upstream
ofrobots Mar 20, 2017
f48763c
benchmark: remove benchmarks forced optimizations
bzoz Feb 28, 2017
60ad7af
doc: deprecate debug protocol
Dec 17, 2016
0c00b65
Fix #7065: cli help documentation for --inspect
Mar 16, 2017
c626734
tls: fix segfault on destroy after partial read
bnoordhuis Mar 17, 2017
44b4c0b
2017-03-21, Version 7.7.4 (Current)
cjihrig Mar 21, 2017
bc664cb
Working on v7.7.5
cjihrig Mar 21, 2017
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
tls: keep track of stream that is closed
TLSWrap object keeps a pointer reference to the underlying
TCPWrap object. This TCPWrap object could be closed and deleted
by the event-loop which leaves us with a dangling pointer.
So the TLSWrap object needs to track the "close" event on the
TCPWrap object.

PR-URL: #11776
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Brian White <[email protected]>
  • Loading branch information
jBarz authored and italoacasas committed Mar 20, 2017
commit 540830116be5617cfd02407fecda2e6941f35296
6 changes: 6 additions & 0 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ TLSSocket.prototype._wrapHandle = function(wrap) {
res = null;
});

if (wrap) {
wrap.on('close', function() {
res.onStreamClose();
});
}

return res;
};

Expand Down
11 changes: 10 additions & 1 deletion src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ int TLSWrap::GetFD() {


bool TLSWrap::IsAlive() {
return ssl_ != nullptr && stream_->IsAlive();
return ssl_ != nullptr && stream_ != nullptr && stream_->IsAlive();
}


Expand Down Expand Up @@ -781,6 +781,14 @@ void TLSWrap::EnableSessionCallbacks(
}


void TLSWrap::OnStreamClose(const FunctionCallbackInfo<Value>& args) {
TLSWrap* wrap;
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());

wrap->stream_ = nullptr;
}


void TLSWrap::DestroySSL(const FunctionCallbackInfo<Value>& args) {
TLSWrap* wrap;
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
Expand Down Expand Up @@ -911,6 +919,7 @@ void TLSWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "enableSessionCallbacks", EnableSessionCallbacks);
env->SetProtoMethod(t, "destroySSL", DestroySSL);
env->SetProtoMethod(t, "enableCertCb", EnableCertCb);
env->SetProtoMethod(t, "onStreamClose", OnStreamClose);

StreamBase::AddMethods<TLSWrap>(env, t, StreamBase::kFlagHasWritev);
SSLWrap<TLSWrap>::AddMethods(env, t);
Expand Down
1 change: 1 addition & 0 deletions src/tls_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class TLSWrap : public AsyncWrap,
static void EnableCertCb(
const v8::FunctionCallbackInfo<v8::Value>& args);
static void DestroySSL(const v8::FunctionCallbackInfo<v8::Value>& args);
static void OnStreamClose(const v8::FunctionCallbackInfo<v8::Value>& args);

#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
static void GetServername(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down
43 changes: 43 additions & 0 deletions test/parallel/test-tls-socket-close.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';
const common = require('../common');
const assert = require('assert');

const tls = require('tls');
const fs = require('fs');
const net = require('net');

const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');

const T = 100;

// tls server
const tlsServer = tls.createServer({ cert, key }, (socket) => {
setTimeout(() => {
socket.on('error', (error) => {
assert.strictEqual(error.code, 'EINVAL');
tlsServer.close();
netServer.close();
});
socket.write('bar');
}, T * 2);
});

// plain tcp server
const netServer = net.createServer((socket) => {
// if client wants to use tls
tlsServer.emit('connection', socket);

socket.setTimeout(T, () => {
// this breaks if TLSSocket is already managing the socket:
socket.destroy();
});
}).listen(0, common.mustCall(function() {

// connect client
tls.connect({
host: 'localhost',
port: this.address().port,
rejectUnauthorized: false
}).write('foo');
}));