Loading ...
Sorry, an error occurred while loading the content.

Yahoo UI 0.11.2 asyncRequest - Reproducible Infinite Loop Bug - With Test Case

Expand Messages
  • cosmicrealms
    So I have ran into a reproducible infinite loop bug in the asyncRequest method of the Yahoo UI 0.11.2 connection.js The basics are: 1. Send two requests with
    Message 1 of 3 , Jul 31, 2006
    • 0 Attachment
      So I have ran into a reproducible infinite loop bug in the
      asyncRequest method of the Yahoo UI 0.11.2 connection.js

      The basics are:

      1. Send two requests with the same callback success handler function.
      2. In the success handler function cause a javascript error
      3. The success handler will now be called by the Yahoo UI in an
      infinite loop flooding the browser with errors

      If you do not cause an error in the success handler function then no
      infinite loop takes place.

      If you send only one request, yet still produce an error, no infinite
      loop takes place.

      Here is an example URL with this problem:
      http://www.cosmicrealms.com/yahoo_async_infinite_test_case/index.html

      In the index.html there is javascript that will retrieve 'javascript'
      code via a GET request that will be 'eval'ed in the success handler
      function.

      If you push the 'Send 2 Good Requests' then valid javascript will be
      returned, the eval in the success handler function will not error, and
      the results correctly are appended to the output box.

      However if you push the 'Send 2 Bad Request' then invalid javascript
      will be returned (unterminated string), the eval in the success
      handler function will error out, and you will see in the error log
      that the success handler is now called over and over and over again in
      an infinite loop.


      I thought I'd bring this up to warn everyone to be careful about this
      if your using the same success handler to handle multiple requests.

      I haven't tried putting the 'bad eval' into a try/catch block, however
      I'd guess this probably will fix it.

      Although I still think the cause of the infinite calling inside
      connection.js should be located and fixed in a future release of the
      Yahoo UI.
    • Thomas S. Sha
      ... I ve confirmed your report in FF1.x. In this browser, JS errors in the callback seems to result in handleReadyState becoming reentrant. In the interim,
      Message 2 of 3 , Aug 2, 2006
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "cosmicrealms" <robert@...> wrote:
        >
        > So I have ran into a reproducible infinite loop bug in the
        > asyncRequest method of the Yahoo UI 0.11.2 connection.js
        >
        > The basics are:
        >
        > 1. Send two requests with the same callback success handler function.
        > 2. In the success handler function cause a javascript error
        > 3. The success handler will now be called by the Yahoo UI in an
        > infinite loop flooding the browser with errors
        >
        > If you do not cause an error in the success handler function then no
        > infinite loop takes place.
        >
        > If you send only one request, yet still produce an error, no infinite
        > loop takes place.
        >
        > Here is an example URL with this problem:
        > http://www.cosmicrealms.com/yahoo_async_infinite_test_case/index.html
        >
        > In the index.html there is javascript that will retrieve 'javascript'
        > code via a GET request that will be 'eval'ed in the success handler
        > function.
        >
        > If you push the 'Send 2 Good Requests' then valid javascript will be
        > returned, the eval in the success handler function will not error, and
        > the results correctly are appended to the output box.
        >
        > However if you push the 'Send 2 Bad Request' then invalid javascript
        > will be returned (unterminated string), the eval in the success
        > handler function will error out, and you will see in the error log
        > that the success handler is now called over and over and over again in
        > an infinite loop.
        >
        >
        > I thought I'd bring this up to warn everyone to be careful about this
        > if your using the same success handler to handle multiple requests.
        >
        > I haven't tried putting the 'bad eval' into a try/catch block, however
        > I'd guess this probably will fix it.
        >
        > Although I still think the cause of the infinite calling inside
        > connection.js should be located and fixed in a future release of the
        > Yahoo UI.

        I've confirmed your report in FF1.x. In this browser, JS errors in
        the callback seems to result in handleReadyState becoming reentrant.
        In the interim, your suggested workaround should suffice.

        Regards,
        Thomas
      • cosmicrealms
        ... I wanted to thank you and the Yahoo UI team for being so great! I noticed that this problem has been fixed in the 0.11.3 release according to the README:
        Message 3 of 3 , Aug 29, 2006
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "Thomas S. Sha" <tsha@...> wrote:
          >
          > --- In ydn-javascript@yahoogroups.com, "cosmicrealms" <robert@> wrote:
          > >
          > > So I have ran into a reproducible infinite loop bug in the
          > > asyncRequest method of the Yahoo UI 0.11.2 connection.js
          > >
          > > The basics are:
          > >
          > > 1. Send two requests with the same callback success handler function.
          > > 2. In the success handler function cause a javascript error
          > > 3. The success handler will now be called by the Yahoo UI in an
          > > infinite loop flooding the browser with errors
          > >
          > > If you do not cause an error in the success handler function then no
          > > infinite loop takes place.
          > >
          > > If you send only one request, yet still produce an error, no infinite
          > > loop takes place.
          > >
          > > Here is an example URL with this problem:
          > > http://www.cosmicrealms.com/yahoo_async_infinite_test_case/index.html
          > >
          > > In the index.html there is javascript that will retrieve 'javascript'
          > > code via a GET request that will be 'eval'ed in the success handler
          > > function.
          > >
          > > If you push the 'Send 2 Good Requests' then valid javascript will be
          > > returned, the eval in the success handler function will not error, and
          > > the results correctly are appended to the output box.
          > >
          > > However if you push the 'Send 2 Bad Request' then invalid javascript
          > > will be returned (unterminated string), the eval in the success
          > > handler function will error out, and you will see in the error log
          > > that the success handler is now called over and over and over again in
          > > an infinite loop.
          > >
          > >
          > > I thought I'd bring this up to warn everyone to be careful about this
          > > if your using the same success handler to handle multiple requests.
          > >
          > > I haven't tried putting the 'bad eval' into a try/catch block, however
          > > I'd guess this probably will fix it.
          > >
          > > Although I still think the cause of the infinite calling inside
          > > connection.js should be located and fixed in a future release of the
          > > Yahoo UI.
          >
          > I've confirmed your report in FF1.x. In this browser, JS errors in
          > the callback seems to result in handleReadyState becoming reentrant.
          > In the interim, your suggested workaround should suffice.
          >
          > Regards,
          > Thomas
          >

          I wanted to thank you and the Yahoo UI team for being so great!
          I noticed that this problem has been fixed in the 0.11.3 release
          according to the README:
          "* Modified polling mechanism in handleReadyState() and
          handleTransactionResponse() to prevent infinite polling if JavaScript
          errors occur in the user-defined callback."

          So once again, keep up the great work!
        Your message has been successfully submitted and would be delivered to recipients shortly.