Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome treating smart url and causing concurrent requests pend for each other

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?

like image 289
Noam Avatar asked Jan 02 '13 09:01

Noam


1 Answers

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.

like image 183
zerkms Avatar answered Oct 20 '22 16:10

zerkms