uwescience / myria-web

Web frontend for Myria
https://demo.myria.cs.washington.edu
Other
11 stars 14 forks source link

non-deterministic bug loading profiler (think it's a race condition) #250

Closed dhalperi closed 9 years ago

dhalperi commented 9 years ago

@domoritz thoughts appreciated.

I occasionally see this log in the Javascript console: Uncaught TypeError: Cannot read property 'numTuples' of undefined graph.js:775

Tracking this code down, it seems that the linkOrigins dict is populated (comes from the query plan), but the linkAttr dict is not.

linkAttr is populated during loadCosts, which is called very early -- upon Graph creation.

The main thing I see is that loadCosts populates linkAttr using d3.csv, which is an asynchronous call. So it seems that if this call takes a little while, linkAttr may not be ready when we get to the code that fails.

One solution is to switch to jQuery for loading this data and force synchronous loading (and conversion from CSV). This change would make loadCosts a blocking function and add a critical section to the entire page.

Opinion and alternate suggestions?

dhalperi commented 9 years ago

dependency management is hard :P.

domoritz commented 9 years ago

Oh yeah, callback hell and asynchronous IO bites again. I thought this was resolved by https://github.com/uwescience/myria-web/blob/master/appengine/js/graph.js#L7 Draw should not be called until the call finishes. The callback is only called after the request is completed. This is odd.

dhalperi commented 9 years ago

You are obviously right, and I've realized the bug is completely something else. Thanks for the explanation though!!

dhalperi commented 9 years ago

In other news, my claim that this is non-deterministic was also false. I am just wrong today...