Uh oh!
There was an error while loading. Please reload this page.
Remove StreamBase templating - #25142
Conversation
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Btw, we use 4 spaces of indentation here – and maybe it makes sense to turn this macro into a function?
There was a problem hiding this comment.
Tips: use CLANG_FORMAT_START=master make format-cpp to auto format, or replace master with some other commit that you are branching from
maclover7
commented
Dec 19, 2018
updated @addaleax@joyeecheung, PTAL |
maclover7
commented
Dec 21, 2018
Looks like there is an intermittent timeout issue on some platforms with |
addaleax
commented
Jan 7, 2019
addaleax
commented
Jan 9, 2019
@maclover7 It looks like the issue is that some streams, in particular libuv streams, delete the associated C++ object before the JS object is garbage collected. They set the first internal field to This would be a (but maybe not the best?) fix: diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index 1842962192db..d672fc5a0dae 100644
--- a/src/stream_base-inl.h+++ b/src/stream_base-inl.h@@ -274,6 +274,9 @@ inline void StreamBase::AttachToObject(v8::Local<v8::Object> obj) {
}
inline StreamBase* StreamBase::FromObject(v8::Local<v8::Object> obj) {
+ if (obj->GetAlignedPointerFromInternalField(0) == nullptr)+ return nullptr;+
return static_cast<StreamBase*>(
obj->GetAlignedPointerFromInternalField(kStreamBaseField));
} |
addaleax
commented
Jan 13, 2019
Ping @maclover7 – barring better ideas, I can also apply the patch above and push to this PR for you? |
addaleax
commented
Mar 7, 2019
Hm … ping @maclover7 again? :) |
addaleax
commented
Mar 7, 2019
I’ve rebased + pushed the suggested change… @jasnell Can you confirm your approval? |
addaleax
commented
Mar 7, 2019
addaleax
commented
Mar 8, 2019
Landed in 4697e1b 🎉 |
PR-URL: #25142 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Since 4697e1b, it is no longer necessary to use `v8::External`s to pass `StreamBase` instances to native functions. Refs: nodejs#25142
Since 4697e1b, it is no longer necessary to use `v8::External`s to pass `StreamBase` instances to native functions. PR-URL: #26510 Refs: #25142 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#25142 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Since 4697e1b, it is no longer necessary to use `v8::External`s to pass `StreamBase` instances to native functions. PR-URL: #26510 Refs: #25142 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #25142 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Since 4697e1b, it is no longer necessary to use `v8::External`s to pass `StreamBase` instances to native functions. PR-URL: #26510 Refs: #25142 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
First attempt at trying to remove the templating in shared
StreamBasemethods. This approach casts directly toStreamBasevia an internal field.Unfortunately, I keep hitting linker errors when trying to run
make -j8, and would appreciate any help in figuring out where they're coming from:Details
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes