Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cdata opened this issue Jun 21, 2015 · 4 comments
Closed

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

cdata opened this issue Jun 21, 2015 · 4 comments
Assignees
Labels

Comments

@cdata
Copy link
Contributor

cdata commented Jun 21, 2015

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 Jun 21, 2015
@timeu
Copy link

timeu commented Jun 22, 2015

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
Copy link

Is this a dup of #1759?

@cdata
Copy link
Contributor Author

cdata commented Jun 22, 2015

@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 🍻

@cdata
Copy link
Contributor Author

cdata commented Jun 22, 2015

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 self-assigned this Jun 22, 2015
sorvell pushed a commit that referenced this issue Jun 24, 2015
Catch errors in async queue & re-start. Fixes #1933. Fixes #1759.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants