PHP 4.0 Bug #8985: shm_put_var wont put the given var into memory
| From: | fuf at mobil dot cz | Date: | Mon, 29 Jan 2001 17:27:07 +0000 |
| Subject: | PHP 4.0 Bug #8985: shm_put_var wont put the given var into memory | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45241@lists.php.net to get a copy of this message | ||
From: fuf@mobil.cz
Operating system: linux-2.2.18
PHP version: 4.0.4pl1
PHP Bug Type: Semaphore related
Bug description: shm_put_var wont put the given var into memory
hello,
this is the same bug as described in #7046. a call to shm_put_var() returns true all the time, but
checking whether the variable has been _really_ stored reveals that it hasn't.
this doesn't happen on my 1 cpu box (i can't reproduce it however much i try), but on a
loaded server with 4 cpus it happens pretty often. of course i call sem_acquire() before writing the
variable into the shared memory, so it should be safe.
i can supply the whole source in which this happens (445 lines) but basically it's just list
this:
$semid = sem_get($sem_key, 1);
sem_acquire($semid);
$var = shm_get_var($shmid, $var_key); // $var is an array
// some change to $var, $var is still an array
shm_put_var($shmid, $var_key, $var);
if(!is_array(shm_get_var($shmid, $var_key)))
echo "failed to write \$var :(\n";
sem_release($semid);
could the problem be caused by the true multitasking on the 4 cpu server?
thanks for any help with this,
Michal Vitecek
--
Edit Bug report at: http://bugs.php.net/?id=8985&edit=1