Note that there are some explanatory texts on larger screens.

plurals
  1. POServer allowing only one request per session
    text
    copied!<p><b>Scenario:</b></p> <p>All pages of xyz.com use sessions to check if I am logged in and display customized content. I am logged into xyz.com using Firefox on my iMac. Now, when I try to visit, xyz.com/page1.php and xyz.com/page2.php at the same time, until page1 loads page2 is not processed.</p> <p><b>Code Samples</b></p> <p>xyz.com/contains (links): <br/></p> <pre><code>/* session check code here */ <a href="http://xyz.com/page1.php" rel="nofollow noreferrer">Page1</a> <a href="http://xyz.com/page2.php" rel="nofollow noreferrer">Page2</a> </code></pre> <p>xyz.com/page1.php contains: <br/></p> <pre><code>/* session check code here */ echo "Hello"; flush(); sleep(5); echo "done";</code></pre> <p>xyz.com/page2.php contains: <br/></p> <pre><code>/* session check code here */ echo "Second Page"; /* {insert code} to log time() to log.txt */ </code></pre> <p><b>Testing</b></p> <p>Here's what I do. I login to shell and keep this command running:</p> <pre><code>user@xyz.com [~/public_html]# tail -f log.txt</code></pre> <p>From my browser (Firefox), (on xyz.com), I open multiple instances of page1 and page2 in tabs. If you can see, page1 will at least take 5 seconds to load. Now, until page 1 loads, request to page2 is pending. It's not at all processed. How do I know that? The code at the end of page2 logs access time to a file which I am monitoring. Let's consider the following case:</p> <p>Requests fired to (in order) 1. page1.php 2. page2.php 3. page2.php 4. page1.php 5. page1.php 6. page2.php</p> <p><b>Result (approx)</b></p> <p>1237961919 &lt;-- #2<BR> 1237961920 &lt;-- #3<BR> 1237961931 &lt;-- #6<BR></p> <p><b>What was expected (approx)</b></p> <p>1237961915 &lt;-- #2<BR> 1237961915 &lt;-- #3<BR> 1237961915 &lt;-- #6<BR></p> <p>^Assuming that all calls were fired at the same time</p> <p><b>Observation</b></p> <p>While the calls are being processed, I am obviously not able to visit xyz.com as well (being another request). However, if I open it in another browser (Safari), it works well. That's because it's another session?</p> <p><b>Possible Causes</b></p> <ol> <li><p>The server has some security in place?</p> <blockquote> <p>I am more of a coder but if someone can give pointers, I can check the server (VPS) to see if apache/php is misconfigured.</p> </blockquote></li> <li><p>I am not handling sessions correctly?</p> <blockquote> <p>Does it matter? Shouldn't the second request be processed as a different thread?</p> </blockquote></li> <li><p>Aliens are controlling my VPS. </p> <blockquote> <p>Ok, kidding. I am just tired of tracing this issue. Would really appreciate if anyone has any clue what could be going wrong here.</p> </blockquote></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload