Skip to content

Accessing any unknown variable inside worker, program is not responding at all. #201

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

Open
amrendra007 opened this issue Jul 26, 2019 · 0 comments

Comments

@amrendra007
Copy link

amrendra007 commented Jul 26, 2019

var Worker = require("webworker-threads").Worker;

require("http")
  .createServer(function(req, res) {

var fibo = new Worker(function() {
  console.log('var', unknownvar)
  function fibo(n) {
    console.log('n', n)
    return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1;
  }

  this.onmessage = function(event) {
    postMessage(fibo(event.data));
  };
});

fibo.onerror = function(error) {
  console.log('error', error)
}

fibo.onmessage = function(event) {
  res.end("fib result" + event.data);
};

fibo.postMessage(10);

})
.listen(8001);

I am trying to access some unknown variable with this

>console.log('var', unknownvar)

and this code is not responding anything , its not working also. It becomes difficult to debug what is going on without any response.

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