error on long lasting ajax calls

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
schulzki
Posts: 4
Joined: April 11th, 2015, 1:48 am

error on long lasting ajax calls

Post by schulzki »

Hi,

since FF V35, long lasting ajax requests are canceled with an error after a random amount of time.
The error is a status 404 but not a reply from the server.
With a processing delay of 100 Secs the error happens with >95% of the requests, with a high variance
(somtetimes after 10 secs, sometimes after 70 secs).

I tested ajax requests without lib support as well as jQuery.
I also checked different appserver versions (Jetty 6, 8, 9)

No error on FF <= Version 34 (also no error on other browsers).

Can sb. please verify this?

thx, schulzki
User avatar
LoudNoise
New Member
Posts: 39900
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Re: error on long lasting ajax calls

Post by LoudNoise »

Moving to Web Development to give those folks a look at this. Can you provide a link to something showing the problem?
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: error on long lasting ajax calls

Post by trolly »

To my knowledge 404 is a server side error.
http://en.wikipedia.org/wiki/HTTP_404
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: error on long lasting ajax calls

Post by jscher2000 »

I think if a high percentage of AJAX calls were randomly cancelled in Firefox 35-37, there would be a large volume of posts about it on Mozilla-related forums and on sites like StackOverflow. I can't recall seeing that.

Could it be something Jetty-specific?
User avatar
LoudNoise
New Member
Posts: 39900
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Re: error on long lasting ajax calls

Post by LoudNoise »

As noted, a link to the problem would be welcomed.
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."
schulzki
Posts: 4
Joined: April 11th, 2015, 1:48 am

Re: error on long lasting ajax calls

Post by schulzki »

ok, here is some more info:

  • I can reproduce it with apache/PHP so it is not jetty.
  • The 404 is the status delivered in the ajax callback, however, the status reported on firebug network table is "aborted"
  • I don't have a link illustrating the problem in production (only integration), but it is very easy to reproduce if you have apache/PHP installed. I provide some code beneath

To reproduce the problem, you only need these 2 files.
The index.html provides a button that simply triggers an ajax request loading info.php, which delays the answer for 100sec.

index.html

Code: Select all

<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Ping WS</title>
    <script type="text/javascript">
   function debug(text){
      document.getElementById("debug").innerHTML = text;
   }
   
    function callAjax(url, success, error){
      var xmlhttp;
      xmlhttp = new XMLHttpRequest();
      xmlhttp.onreadystatechange = function(){
         if (xmlhttp.readyState == XMLHttpRequest.DONE ){
            if( xmlhttp.status == 200){
               success(xmlhttp.responseText);
            } else {
               error(xmlhttp.responseText);
            }
         }
      }
      xmlhttp.open("GET", url, true);
      xmlhttp.send();
   }

      function longping(){
            start = new Date().getTime();
         debug("long call...")
            callAjax(
                window.location.origin + "/info.php",
                function(){
               var dur = new Date().getTime() - start;
               debug("ok: " + dur);
            },
            function(e){
               var dur = new Date().getTime() - start;
               debug("ko: "  + dur);
            });
        };


    </script>
</head>
<body>
<button onclick="longping()">fire</button>
<div id="debug">debug</div>
</body>
</html>


info.php

Code: Select all

<?php

echo "waiting\n";

usleep(100000000);
?>
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: error on long lasting ajax calls

Post by jscher2000 »

Test page: http://jeffersonscher.com/res/ajax100.html

I got normal results on my regular profile. I got one out of four abnormal results on a clean profile; I don't have an explanation for that.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: error on long lasting ajax calls

Post by trolly »

10 times, 10 times ok ...

Network issue?? Wireshark log available maybe?
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
schulzki
Posts: 4
Joined: April 11th, 2015, 1:48 am

Re: error on long lasting ajax calls

Post by schulzki »

trolly wrote:10 times, 10 times ok ...

Network issue?? Wireshark log available maybe?


I can reproduce the issue running client and server on the same machine, so most prob. no network problem.

I found this issue when I detected loads of logfile entries for a productive client (It uses a framework with long polling ajax requests for comet push), so it is reproducible in different environments.

But strange that it is not fully reproducible on all FFV35+.....
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: error on long lasting ajax calls

Post by trolly »

BTW: I got this result:

GET XHR http://jeffersonscher.com/res/info.php [HTTP/1.1 200 OK 100359ms]
GET XHR http://jeffersonscher.com/res/info.php [HTTP/1.1 200 OK 6ms]
GET XHR http://jeffersonscher.com/res/info.php [HTTP/1.1 200 OK 100345ms]

The middle one had a response time of only 6 ms.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
schulzki
Posts: 4
Joined: April 11th, 2015, 1:48 am

Re: error on long lasting ajax calls

Post by schulzki »

just realized I never mentioned I use FF on windows (win7 64 bit), what is your OS?
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: error on long lasting ajax calls

Post by trolly »

Firefox Nightly 40 x64 on WXP and W7/64.

BTW We knew. Your user agent at least gave away your OS.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Post Reply