0

ok I do use an Apache Server and I have the following situations.

  1. I have a JScript that sends a XHR request to a long polling PHP file
  2. Now the request is long polled for 15 secs
  3. Now while the long poll is in progress I try to send another XHR request
  4. But the another XHR request timeouts and seems not to reach my Apache server

now my question is, why this happens? is this because Apache server uses only a single thread connection for a single client? or because of long polling the connection became persistent other XHR request can't be granted?

my server is a XAMPP 1.8.0 with Apache 2.4.2

Netorica
  • 18,523
  • 17
  • 73
  • 108

1 Answers1

1

found already the answer here.

I need to use the function below

session_write_close();

Long polling locking up other AJAX calls

Community
  • 1
  • 1
Netorica
  • 18,523
  • 17
  • 73
  • 108
  • Did this really fix it? I thought I had fixed this several times but it turned out to be timing sensitive. Try "Empty cache and Hard Reload" in chrome to see if you *really* fixed it. If the long poll request comes before another (important) request, and the keepalive time is 5 seconds, the important request will block for 5 seconds before it opens another connection. As far as I know, browsers don't implement HTTP pipelining, which is very unfortunate. Even server pushed events (the "new way" to do long polling) has the same issue. – doug65536 Dec 15 '13 at 12:17