Closed rwalle61 closed 5 years ago
I think option 1 is ok given that Node 6 is no longer in LTS. Agree that a longer term plan to support N-Api would be the right one to avoid issues in the future. We should document that Node 6 is no longer supported and the last known working appmetrics level
Dropping 6.x support sounds like a good idea to me, but it requires bumping the appmetrics major (because dropping 6 support is a breaking change for people using node 6). That's NBD, but don't forget to do the book keeping: it eans finding all the other runtimes packages (prometheus, etc) that depend on appmetrics, and publishing an updated major of them, that depends on the new appmetrics major.
The issues raised in the comments will be dealt with as separate PR's
Build intermittently failing on Windows (various versions of Node) with seemingly the same error in a test in http-outbound-probe-test.js
.
Therefore, we will keep running the Windows tests on Travis but flag them as allowed to fail.
I've updated the docs, so this PR also resolves https://github.com/RuntimeTools/appmetrics/issues/571
(These changes break Node 6. See below)
Fix for Node 12:
General information about the V8 API changes between Node 10 and 12
These fixes frequently involve the following:
isolate
object - get viaIsolate* isolate = v8::Isolate::GetCurrent()
context
object - get viaLocal<Context> context = Nan::GetCurrentContext()
MaybeLocal
types returned by many Nan functions toLocal
usingmaybeLocalObj.ToLocalChecked()
Specific error fixes and my specific sources of information
s->WriteUtf8(buf)
tos->WriteUtf8(isolate, buf)
X->ToString()
toNan::To<String>(X).ToLocalChecked()
X->ToObject()
toNan::To<Object>(X).ToLocalChecked()
X->ToInteger()
toNan::To<Integer>(X).ToLocalChecked()
X->GetOwnPropertyNames()
toNan::GetOwnPropertyNames(cache).ToLocalChecked()
X->GetOwnPropertyNames(context).ToLocalChecked()
X->GetFunction()
toX->GetFunction(context).ToLocalChecked()
String::Utf8Value X(Y)
toNan::Utf8Value X(Y)
X->Int32Value()
toX->Int32Value(context).FromJust()
X->IntegerValue()
toX->IntegerValue(context).FromJust()
kApiPointerSize
tokApiSystemPointerSize
isolate->GetCpuProfiler()
to ... (larger fix, because whereas the V8 engine previously had just 1 CpuProfiler, it now has multiple)const Handle<String> X
toconst Local<String> X
node-gyp
from v3 to v4Specific deprecation warning fixes and my specific sources of information
from
X->Get(Y)
toNan::Get(X, Y).ToLocalChecked()
from
X->Set(Y, Z)
toNan::SetMethod(X, Y2, Z2)
X->Set(..)
to their Nan equivalents, see Nan docs https://github.com/nodejs/nan/blob/master/doc/methods.md#nansetprototypemethod and example https://github.com/astro/node-expat/pull/196/files#diff-2b6f822b34553a6cadd4627d4dc9e84fR29)Notes
These changes break Node 6:
Problem:
Error output from `npm i` on Node 6
``` /Users/richard.waller@ibm.com/.node-gyp/6.17.1/include/node/v8.h:21:10: fatal error: 'utility' file not found #includeThis can be resolved simply following https://github.com/nodejs/node-gyp/issues/1564 and https://github.com/nodejs/node-gyp/issues/1574. However, that reveals that my upgrade to Node 12 is incompatible with Node 6:
Error output from `CXXFLAGS="-mmacosx-version-min=10.9" LDFLAGS="-mmacosx-version-min=10.9" npm i` on Node 6
``` In file included from ../src/plugins/node/prof/watchdog.h:21: ../src/plugins/node/prof/compat-inl.h:308:38: error: no member named 'New' in 'v8::CpuProfiler' cpu_profiler_ = v8::CpuProfiler::New(isolate); ~~~~~~~~~~~~~~~~~^ Release/obj.target/appmetrics/geni/appmetrics.cpp:467:29: warning: 'Call' is deprecated [-Wdeprecated-declarations] listener->callback->Call(argc, argv); ^ ../node_modules/nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here NAN_DEPRECATED inline v8::LocalSolution 1
Drop Node 6. This PR achieves this.
Solution 2
Support Node 6 alongside 8, 10, and 12. We would need to spend considerable time converting probably ~60% of the fixes in this PR to use NAN and
if
blocks.Ideal long-term solution
Rewrite much of appmetrics using N-API, but that is beyond the scope of this issue.