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

Firewalker breaks on Node.js 14/16 #21

Open
Qantas94Heavy opened this issue May 20, 2022 · 1 comment
Open

Firewalker breaks on Node.js 14/16 #21

Qantas94Heavy opened this issue May 20, 2022 · 1 comment

Comments

@Qantas94Heavy
Copy link
Collaborator

Qantas94Heavy commented May 20, 2022

Summary

When running firewalker on Node 14 or 16, firewalker will throw an error. Node <= 12 or >= 17.4.0 does not have this issue.

This is likely caused by node-ffi-napi/ref-napi#47.

Results of yarn test:

qantas94heavy@MBP % yarn test     
yarn run v1.22.18
$ jest

 RUNS  test/firewall.tests.ts


#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7ff7bfef45d0
 1: 0x100124c02 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
 2: 0x10104fca3 V8_Fatal(char const*, ...) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
 3: 0x1004ee80d v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
 4: 0x100213a06 v8::ArrayBuffer::GetBackingStore() [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
 5: 0x1000750ee napi_get_typedarray_info [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
 6: 0x104a4a981 (anonymous namespace)::GetBufferData(Napi::Value) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
 7: 0x104a4bdd5 (anonymous namespace)::AddressForArgs(Napi::CallbackInfo const&, unsigned long) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
 8: 0x104a49072 (anonymous namespace)::WritePointer(Napi::CallbackInfo const&) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
 9: 0x104a4c7ef napi_value__* Napi::details::WrapCallback<Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::'lambda'()>(Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*)::'lambda'()) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
10: 0x104a4c78d Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*) [/Users/qantas94heavy/code/firewalker/node_modules/ref-napi/prebuilds/darwin-x64/node.napi.node]
11: 0x100076a08 v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
12: 0x100272048 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
13: 0x1002715dc v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
14: 0x100270d42 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]
15: 0x100a8e8d9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/qantas94heavy/.nvm/versions/node/v14.19.3/bin/node]

Steps to reproduce

Either run yarn test or (intermittently) the following script:

const { Firewall, Request } = require('firewalker');
const firewall = new Firewall();
const rule = firewall.createRule(`
    http.host eq "www.example.org"
`);

// Expected: true
// Actual: Node.js crashes (intermittent)
rule.match(new Request('http://www.example.org'));

Related issues

Related: node-ffi-napi/ref-napi#47
Related: nodejs/node#32463
Related: nodejs/node#43617

@Qantas94Heavy
Copy link
Collaborator Author

While the fix has not been merged into ref-napi, there have been forks e.g. @rclnodejs/ref-napi which include this fix.

Would it make sense to use one of these forks, maintain our own version until the fix is upstreamed, or some alternative solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant