locked
[Bug] Worker not terminated when app is terminated RRS feed

  • Question

  • My app had an error and was "terminated" by the default RP error handler. However, the worker thread was still running (in VS) and the wwahost.exe did not terminate.

    Also, the workers onerror function is not called.
    • Edited by phil_ke Tuesday, June 19, 2012 9:36 PM
    Tuesday, June 19, 2012 9:33 PM

All replies

  • Hi Phil,

    Worker runs in a background process and is not a thread:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh453265.aspx

    so it will not be pulled down because it is not in the calling app process.

    onerror will not be called because it is called when the Worker has an error, not the owning process.

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, June 20, 2012 1:58 PM
    Moderator
  • The Worker has an error though. According to the W3C specs the onerror should be called if inside the Worker an exception is thrown.

    Another thing is: calling self.close() inside the worker removes the Worker from the process, calling worker.terminate() from outside the worker does not remove it.

    Wednesday, June 20, 2012 2:03 PM
  • Sorry Phil,

    I had thought when you said: My app had an error and was "terminated" you were referring to your app code and not the worker code.

    Can you provide a sample of this for further investigation?

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, June 20, 2012 2:36 PM
    Moderator
  • worker.js

    self.onMessage = function() {
      throw "error";
    }

    default.js

    var worker = new Worker("worker.js");
    worker.onerror = function() {
    };
    worker.postMessage();


    Wednesday, June 20, 2012 2:45 PM