Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ac8f37

Browse filesBrowse files
davedoesdevruyadorno
authored andcommitted
http2: check write not scheduled in scope destructor
Fixes: #33156 PR-URL: #36241 Backport-PR-URL: #36355 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent cd9a810 commit 4ac8f37
Copy full SHA for 4ac8f37

File tree

Expand file treeCollapse file tree

2 files changed

+48
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+48
-1
lines changed
Open diff view settings
Collapse file

‎src/node_http2.cc‎

Copy file name to clipboardExpand all lines: src/node_http2.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ Http2Scope::~Http2Scope() {
9292
return;
9393

9494
session_->flags_ &= ~SESSION_STATE_HAS_SCOPE;
95-
session_->MaybeScheduleWrite();
95+
if (!(session_->flags_ & SESSION_STATE_WRITE_SCHEDULED))
96+
session_->MaybeScheduleWrite();
9697
}
9798

9899
// The Http2Options object is used during the construction of Http2Session
Collapse file
+46Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
// https://github.com/nodejs/node/issues/33156
3+
const common = require('../common');
4+
const fixtures = require('../common/fixtures');
5+
6+
if (!common.hasCrypto) {
7+
common.skip('missing crypto');
8+
}
9+
10+
const http2 = require('http2');
11+
12+
const key = fixtures.readKey('agent8-key.pem', 'binary');
13+
const cert = fixtures.readKey('agent8-cert.pem', 'binary');
14+
const ca = fixtures.readKey('fake-startcom-root-cert.pem', 'binary');
15+
16+
const server = http2.createSecureServer({
17+
key,
18+
cert,
19+
maxSessionMemory: 1000
20+
});
21+
22+
let client_stream;
23+
24+
server.on('session', common.mustCall(function(session) {
25+
session.on('stream', common.mustCall(function(stream) {
26+
stream.resume();
27+
stream.on('data', function() {
28+
this.write(Buffer.alloc(1));
29+
process.nextTick(() => client_stream.destroy());
30+
});
31+
}));
32+
}));
33+
34+
server.listen(0, function() {
35+
const client = http2.connect(`https://localhost:${server.address().port}`, {
36+
ca,
37+
maxSessionMemory: 1000
38+
});
39+
client_stream = client.request({ ':method': 'POST' });
40+
client_stream.on('close', common.mustCall(() => {
41+
client.close();
42+
server.close();
43+
}));
44+
client_stream.resume();
45+
client_stream.write(Buffer.alloc(64 * 1024));
46+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.