Perspective LinearScale can lockup user's web browser?

We hit an issue where certain Perspective views would infrequently lock up right after opening on the user's browser, with the process rendering that browser tab pegged at 100%. There was no excessive load or log messages on the server when this happened. At first we were hunting for accidental binding loops or the like, but now we think we've narrowed it down to a LinearScale component.

I'm a novice at using browser developer tools, but did manage to catch the lockup in Chromium's profiler once. While most function names in the call stack were obfuscated, the function it was stuck in during the looping was not obfuscated and was named renderTickMarks.

Based on this theory, we removed just the LinearScale component from the view and the lockup is impossible to achieve any more.

The parameters to the LinearScale are an embarassingly long chain of bindings, some off of other LinearScale parameters. My new suspicion is that sometimes that asynchronous chain of bindings temporarily results in an "unusual" set of parameters to the JavaScript that renders the component, and the JavaScript gets stuck in an infinite loop.

My first planned fix is going to be cleaning up and shortening the bindings that create the parameters to the component, but I'm left wondering:

Has anyone else ever seen LinearScale lock up a browser like this? If I can easily recreate the issue in a smaller test case I will certainly share it, but that's not my main focus right now...

(Able to create this lockup on at least on the official 8.1.22 and a nightly 8.1.25.)

And it turned out to be hilariously simple once I untangled the bindings.

If you want to lock up someone's browser, just open up a LinearScale component with one or more of the span parameters of majorTicks or minorTicks or fineTicks set to something tiny like 1, and then set the maxValue to something huge in the millions. :boom:

I'm guessing the poor JS code is trying to render millions of tick marks in a not-so-optimal manner and just grinding for what seems like forever.

Even Designer gets a little sad. This was a first for me:

3 Likes

ive seen this before on the forum... dont make that many marks :stuck_out_tongue: