Skip to content

Loading…

Polymer.Base.async "infinite loop" condition #1933

Closed
cdata opened this Issue · 4 comments

4 participants

@cdata
Owner

Please consider the following contrived usage of Polymer.Base.async:

<link rel="import" href="../polymer/polymer.html">
<script>
  function AsyncAlpha() {
    // Queue a task:
    Polymer.Base.async(function() {
      console.log('alpha');

      // Cause a second task to be queued:
      AsyncBeta();

      // Throw an exception before the first task returns:
      throw new Error('ANY ERROR');
    });
  }

  function AsyncBeta() {
    Polymer.Base.async(function() {
      console.log('beta');
    });
  }

  AsyncAlpha();
</script>

The above example will cause the first task ("alpha") to be re-called in what is effectively an infinite loop. In order to reproduce this condition, a second task ("beta") must be queued before the first task returns, and an exception must be thrown after the second task is queued but before the first task returns.

@cdata cdata added the bug label
@timeu

Yes I had the same issue, when I ported a rather complicated element from 0.5 to 1.0.
A JS error caused an infinite loop when it was thrown in an async callback.

@arthurevans
Owner

Is this a dup of #1759?

@cdata
Owner

@arthurevans yes, it's a dupe (sorry!). I looked for potential reports of this bug, but didn't notice #1759 for some reason. Thanks for noticing this :beers:

@cdata
Owner

On the other hand, the description of the conditions to produce the error in #1759 is incomplete according to my experience with the bug.

@kevinpschaaf kevinpschaaf added the p1 label
@kevinpschaaf kevinpschaaf self-assigned this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.