5

I'm experiencing a weird issue in Google-Chrome that when one tab is open with a long-running script, a different tab is in 'pending' state until the first tab finishes. I've create a small fiddle to reproduce this issue and am also including here results from the run on Safari. When this fiddle is added a ?q=a and ?q=b it resolves this issue. However, when I'm calling two different smart urls ( http://domain.com/a/v1 http://domain.com/a/v2 or even http://dev.domain.com/a/v6 or http://dev.domain.com/b/v8) they are also causing this 'pending' behavior.

The fiddle:

<?php
echo time();
echo '<br>Now:       '. date('h:m:s');

sleep(10);

echo time();
echo '<br>Now:       '. date('h:m:s');

?>

When opening two concurrent tabs with it in Google Chrome, output: 1:

Now: 11:01:12
1357117332
Now: 11:01:22
1357117342

2:

Now: 11:01:22
1357117342
Now: 11:01:32
1357117352

As you can see, although I started them both almost at the same time, the second one waiting for the first to finish before it began.

Same thing when running on Safari: 1:

Now: 10:01:36
1357116336
Now: 10:01:46
1357116346

2:

Now: 10:01:37
1357116337
Now: 10:01:47
1357116347

As you can notice, in Chrome the second script started only after the first finished, while in Safari, they worked together. What can cause this weird behavior? What information should I look for to help debug the cause?

UPDATE: The answer that adding ?q=a and ?q=b resolves this is correct. Now I'm trying to figure out why in the first place I'm running in this issue although I'm calling two different urls. I'm using smart url, urls look domain.com/dir/var1 and domain.com/dir/var2 and even dev.domain.com/var6 all cause the same effect. What can cause this?

Noam
  • 3,341
  • 4
  • 35
  • 64
  • It looks like Firefox and IE have similar behaviors. We were having an obscure issue that took forever to hunt down that came down to this. – dsollen Jul 28 '15 at 23:03

1 Answers1

6

It's a Chrome behaviour.

If you perform a GET request to exactly the same url - it will wait until the first ends. Just change urls by appending some different parameters like ?q=a and see they will execute simultaneously.

zerkms
  • 249,484
  • 69
  • 436
  • 539
  • Changed the urls and it worked. Now I'm trying to figure out why in the first place I'm running in this issue although I'm calling two different urls. I'm using smart url, urls look http://domain.com/dir/var1 and http://domain.com/dir/var2 and even http://dev.domain.com/var6 all cause the same effect. Why? – Noam Jan 02 '13 at 09:43
  • @Noam: I only experienced it when the urls matched exactly – zerkms Jan 02 '13 at 10:00
  • @zerkms please use millisecond at the end of the URL it will work forever because time can only change the url request generic way. – black_pottery_beauty Jan 12 '17 at 06:26