title: Symfony : ajax call cause server to queue next queries
body: <p>I've a problem with my application when an ajax call on the server takes too much time : it queue all the others queries from the user until it's done server side (I realized that canceling the call client side has no effect and the user still have to wait).</p>
  
  <p>Here is my test case :</p>
  
  <pre><code>&lt;script type="text/javascript" src="jquery-1.4.1.min.js"&gt;&lt;/script&gt;
  
  &lt;a href="another-page.php"&gt;Go to another page on the same server&lt;/a&gt;
  
  
  &lt;script type="text/javascript"&gt;
      url = 'http://localserver/some-very-long-complex-query';
      $.get(url);
  &lt;/script&gt;
  </code></pre>
  
  <p>So when the get is fired and then after I click on the link, the server finish serving the first call before bringing me to the other page. My problem is that I want to avoid this behavior. </p>
  
  <p>I'm on a LAMP server and I'm looking in a way to inform the server that the user aborted the query with function like connection_aborted(), do you think that's the way to go ? Also, I know that the longest part of this PHP script is a MySQL query, so even if I know that connection_aborted() can detect that the user cancel the call, I still need to check this during the MySQL query... I'm not really sure that PHP can handle this kind of "event".</p>
  
  <p>So if you have any better idea, I can't wait to hear it. </p>
  
  <p>Thank you.</p>
  
  <hr>
  
  <p><strong>Update :</strong>
  After further investigation, I found that the problem happen only with the Symfony framework (that I omitted to precise, my bad). It seems that an Ajax call lock any other future call. It maybe related to the controller or the routing system, I'm looking into it.</p>
  
  <p>Also for those interested by the problem here is my new test case :
  -new project with Symfony 1.4.3, default configuration, I just created an app and a default module.
  -jquery 1.4 for the ajax query.</p>
  
  <p>Here is my actions.class.php (in my unique module) :</p>
  
  <pre><code>class defaultActions extends sfActions
  {
    public function executeIndex(sfWebRequest $request)
    {
      //Do nothing
    }
  
    public function executeNewpage()
    {
      //Do also nothing
    }
  
    public function executeWaitingaction(){
      // Wait
      sleep(30);
      return false;
    }
  
  }
  </code></pre>
  
  <p>Here is my indexSuccess.php template file :</p>
  
  <pre><code>&lt;script type="text/javascript" src="jquery-1.4.1.min.js"&gt;&lt;/script&gt;
  
  &lt;a href="&lt;?php echo url_for('default/newpage');?&gt;"&gt;Go to another symfony action&lt;/a&gt;
  
  
  &lt;script type="text/javascript"&gt;
      url = '&lt;?php echo url_for('default/waitingaction');?&gt;';
      $.get(url);
  &lt;/script&gt;
  </code></pre>
  
  <p>For the new page template, it's not very relevant... But with this, I'm able to reproduce the lock problem I've on my real application.</p>
  
  <p>Is somebody else having the same issue ?</p>
  
  <p>Thanks.</p>