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

Unable to execute "fibonacci" demo by using napa #250

Open
SwenChan opened this issue Jul 16, 2018 · 2 comments
Open

Unable to execute "fibonacci" demo by using napa #250

SwenChan opened this issue Jul 16, 2018 · 2 comments

Comments

@SwenChan
Copy link

environment: macos 10.13.5
node: 10.6.0
napajs: 0.2.3
code

const napa = require('napajs');
const zone = napa.zone.create('zone', { workers: NUMBER_OF_WORKERS });
function fibParallel (n) {
      if (n <= 1) {
        return n;
      }
      var p1 = zone.execute('', 'fibParallel', [n - 1]);
      var p2 = zone.execute('', 'fibParallel', [n - 2]);
      var p3 = zone.execute('', 'fibParallel', [n - 3]);
      var p4 = zone.execute('', 'fibParallel', [n - 4]);
      // Returning promise to avoid blocking each worker.
      return Promise.all([p1, p2, p3, p4]).then(([result1, result2, result3, result4]) => {
        return result1.value + result2.value + result3.value + result4.value;
      });
    }
zone.broadcast(`
    var napa = require("napajs");
    var zone = napa.zone.get("zone");`);
    // Broadcast function declaration of 'fibonacci' to napa workers.
    zone.broadcast(fibParallel.toString());
const num = await zone.execute('', 'fibParallel', [30]);
console.log(num)

And it throw

/Users/swenchan/.n/bin/node[36217]: ../src/node_platform.cc:262:std::shared_ptr node::NodePlatform::ForIsolate(v8::Isolate ): Assertion `data' failed.
1: 0x100033d65 node::Abort() [/Users/swenchan/.n/bin/node]
2: 0x100032dab node::MakeCallback(v8::Isolate
, v8::Localv8::Object, char const*, int, v8::Localv8::Value, node::async_context) [/Users/swenchan/.n/bin/node]
3: 0x100090dfa node::NodePlatform::CallOnBackgroundThread(v8::Task
, v8::Platform::ExpectedRuntime) [/Users/swenchan/.n/bin/node]
4: 0x100090e55 node::NodePlatform::CallOnForegroundThread(v8::Isolate*, v8::Task*) [/Users/swenchan/.n/bin/node]
5: 0x1005cf3a1 v8::internal::Sweeper::StartSweeperTasks() [/Users/swenchan/.n/bin/node]
6: 0x100599147 v8::internal::MarkCompactCollector::Finish() [/Users/swenchan/.n/bin/node]
7: 0x10056d9b6 v8::internal::Heap::MarkCompact() [/Users/swenchan/.n/bin/node]
8: 0x10056b960 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/swenchan/.n/bin/node]
9: 0x10056a2f8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/swenchan/.n/bin/node]
10: 0x10057683c v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/swenchan/.n/bin/node]
11: 0x100553bb8 v8::internal::Factory::NewJSArray(v8::internal::ElementsKind, v8::internal::PretenureFlag) [/Users/swenchan/.n/bin/node]
12: 0x100553c92 v8::internal::Factory::NewJSArray(v8::internal::ElementsKind, int, int, v8::internal::ArrayStorageAllocationMode, v8::internal::PretenureFlag) [/Users/swenchan/.n/bin/node]
13: 0x10063b41c v8::internal::JsonStringifier::JsonStringifier(v8::internal::Isolate*) [/Users/swenchan/.n/bin/node]
14: 0x10025c25e v8::internal::Builtin_Impl_JsonStringify(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/swenchan/.n/bin/node]
15: 0x2b0eea90a1dd
16: 0x2b0eea90c5a3
17: 0x2b0eea9d3d62
18: 0x2b0eea9d401d

Anyone who can help me with this?

@SwenChan SwenChan changed the title Unable to execute "fibonacci" by using napa Unable to execute "fibonacci" demo by using napa Jul 16, 2018
@RajasekharAlluriGGK
Copy link

I'm also facing the same.

@SwenChan did you find any solution for that? , I know it's almost 3years back you posted this, but I hope you have some information, As i need a multi-thread feature in my nodejs application, Trying different available ways to fix.. My Node version 10.16.3

@SwenChan
Copy link
Author

SwenChan commented May 8, 2021

I'm also facing the same.

@SwenChan did you find any solution for that? , I know it's almost 3years back you posted this, but I hope you have some information, As i need a multi-thread feature in my nodejs application, Trying different available ways to fix.. My Node version 10.16.3

sorry pal, i have no solution yet. And i don't event know that this project is still maintained by somebody =)

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

2 participants