session must be synchronized. When A
writes/saves to session
B
or another A
is put on wait. Which is a must for file based session handling.
But once A
has loaded the session (but now saved its modifications) B
should also be allowed to load the same session. because loading will open the file and bring the file contents in memory and close.
Is there any reason to block all other scripts during the whole time A
loads session and A
saves the session. can't the synchronization be done only with save handler ?
So two PHP scripts can never work concurrently If they share the same session.
for example seslock.php
<?php
header('Content-Type: text/plain');
session_start();
if(isset($_GET['wait'])){
sleep(30);
echo "waiting\n";
}else{
echo "No Waiting\n";
}
?>
done
visit seslock.php
will respond immediately but seslock.php?wait
will take 30 seconds to respond. But the problem is if you request seslock.php?wait
first and only seslock.php
second. event the non-sleep
block will ask you to wait for 30 seconds too.
Why it block is not my question. I am asking why it blocks start to save
? instead of blocking only save
?