Skip to content

Commit 96eae97

Browse files
committed
http2: fix crash on Http2Stream::diagnostic_name()
It can happen that the Http2Stream::session_ has already been deleted when the Http2Stream destructor is called, causing `diagnostic_name()` to crash. Observed when running some http2 tests on Windows with the debug logs activated.
1 parent 5815e3e commit 96eae97

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node_http2.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -2060,9 +2060,11 @@ void Http2Stream::MemoryInfo(MemoryTracker* tracker) const {
20602060
}
20612061

20622062
std::string Http2Stream::diagnostic_name() const {
2063+
const Http2Session* sess = session();
2064+
const std::string sname = sess ? sess->diagnostic_name() : "nullptr";
20632065
return "HttpStream " + std::to_string(id()) + " (" +
20642066
std::to_string(static_cast<int64_t>(get_async_id())) + ") [" +
2065-
session()->diagnostic_name() + "]";
2067+
sname + "]";
20662068
}
20672069

20682070
// Notify the Http2Stream that a new block of HEADERS is being processed.

0 commit comments

Comments
 (0)