Skip to content

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

@amrendra007

Description

@amrendra007
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions