0

My application is developed in PHP and Symfony, and it's running on a standard apache2 configuration.

The problem arises when I try to leave a page while an ajax request is still executing. The script stops and returns a 500 error code. That happens with every ajax request regardless of what it does internally.

Is it the expected behavior?

I've tried out setting ignore_user_abort to true but it didn't seem to work.

j0k
  • 22,600
  • 28
  • 79
  • 90
mcubik
  • 135
  • 1
  • 6
  • What is the error from your log? – Matt Aug 28 '12 at 17:12
  • Which symfony version? The 500 error is generated as a response to the ajax request or the page you are browsing? – j0k Aug 28 '12 at 17:19
  • The 500 error comes as the response from the ajax request. I usually captures these errors and show them in an alert message (I'm trying to move to pure html notifications) so I get the error popup when leaving the page. – mcubik Aug 28 '12 at 17:30
  • There's no error in apache and symfony logs. – mcubik Aug 28 '12 at 17:47
  • Are you sure it is indeed an 500 error and not just the browser aborting the request as you're leaving the page? – Maerlyn Aug 28 '12 at 18:25

1 Answers1

1

My bad: I rushed. Not enough investigation prior to the question and not enough information in the post itself. Anyway, your comments guided me towards the solution.

I'm using YUI Connection Manager for ajax requests. As Maerly suggested, it wasn't really a 500 error but the browser aborting the request, which in Chrome console looks like the former. On page leave, YUI invokes the failure callback with status=0 and statusText="communication failure", so I fixed it by ignoring that case.

Thank you

mcubik
  • 135
  • 1
  • 6