My working javascript web pages die silently in random places. How can I debug this?

The web worker just stops, no errors or anything else. The code is completely deterministic, but it will die at different points in the code.

Edit: The problem was that I did not maintain references to my workers, and therefore they seemed to die by accident when they collected garbage.

+2
javascript debugging web-worker
source share
3 answers

The problem was that I did not maintain references to my workers, and therefore they seemed to die by accident when they collected garbage.

+1
source share

I found a similar situation in Firefox where my worker seemed to be silent after a random number of postMessage calls. After more digging, I found a real problem. Apparently, these were the worker calls in Firebug. Firebug dealt with a service in Firefox chrome JS (privileged code space), due to which the worker was interrupted intermittently, you can see the patch here: https://bugzilla.mozilla.org/show_bug.cgi?id=651980

As long as you do everything according to the specification of the worker, you should not see this problem. As for the Firebug / Fx fix, it should appear in Firefox 5 at the end of June. Hope this helps you!

+1
source share

The same thing happens with a web worker that doesn't work in firefox, but not in chrome. Used arborjs.org is named like this:

buildVisualization = function() { var sys = arbor.ParticleSystem(200, 200, 0.9); // create the system with sensible repulsion/stiffness/friction sys.parameters({gravity:true}); // use center-gravity to make the graph settle nicely (ymmv) sys.renderer = Renderer("#viewport"); // our newly created renderer will have its .init() method called shortly by sys... } 

Where the gazebo is an object using a web artist.

I added the line window.sys = sys; , and now it works like a charm in both firefox and chrome.

 buildVisualization = function() { var sys = arbor.ParticleSystem(200, 200, 0.9); // create the system with sensible repulsion/stiffness/friction window.sys = sys; sys.parameters({gravity:true}); // use center-gravity to make the graph settle nicely (ymmv) sys.renderer = Renderer("#viewport"); // our newly created renderer will have its .init() method called shortly by sys... } 
0
source share

All Articles