Live Bindings intermittently stops working completely

Hi members,
We are currently running into an issue that is extremely hard to debug, I just know at some point all the live bindings in our application fail to trigger.

Has anyone run into such a case, what could make all bindings fail to trigger? What would be a starting point in trying to debug such an issue.

From what i can see is that the binding are registered properly but in this specific example the change events are not firing. i have a list of objects all with change binding and non of them are firing

Which version of canjs? Sometimes this happens when an error is thrown and breaks the observation stack.

Can you turn on “break on all errors” and recreate? Is there an error that is thrown (and likely caught elsewhere)?

Hi Justin,

the version we are using is “2.2.5”, and thanks for the suggestion currently debugging and some exceptions are thrown in jquery attempting to find elements, but still debugging and ruling out if this has any impact.

I think we possibly narrowed it down with the help of your tip and looks like our fix is working, Thanks for your time Justin.

@justinbmeyer We were calling .length method on undefined array in an edge case. I am just wondering how an uncaught exception messed up observe framework?

How to avoid such situations? We are just checking for undefined in all cases for now.

@arjunballa what is the exact situation you want to avoid?

Was the situation the following:

an error thrown that wasn’t propagated up to the console

If this is the situation, the fix is not to check for undefined everywhere.

The fix is to understand why the error was thrown that wasn’t propagated. This typically happens because promises can swallow errors if not handled properly. The fix is to make sure all errors always propagate to the console.

@justinbmeyer I am checking why exception is not shown in console. In the above case getting undefined array is a valid case and I was expecting expecting an array with at least 1 item. To avoid that I put undefined check.

I was also wondering how a unhandled exception messed up whole observe framework. Sometimes my assumption on data will be wrong and there will be unhandled undefined exceptions. In those cases I want to protect observe framework so that my whole application does not crash.

Here’s an issue describing the problem: https://github.com/canjs/can-observation/issues/27

It messes up the “compute” part of the framework (other observables will still work).

That issue mentions a “safe” form of computes.

We could also optionally have a “safe” mode.

In modern canjs, this would more or less be wrapping this line:

with a try/catch.

@justinbmeyer Thanks for the insight.