PHP 4.0 Bug #7046: shm_put_var wont put the given var into memory
| From: | FaVo at FaVo dot li | Date: | Thu, 05 Oct 2000 23:31:29 +0000 |
| Subject: | PHP 4.0 Bug #7046: shm_put_var wont put the given var into memory | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34307@lists.php.net to get a copy of this message | ||
From: FaVo@FaVo.li
Operating system: Linux version 2.2.13 (SuSE)
PHP version: 4.0.2
PHP Bug Type: Semaphore related
Bug description: shm_put_var wont put the given var into memory
I was working with shared memory segments on PHP 4.0.2, it works fine.
But sometimes (ca. 5% of the calls) it wont put my array into the memory, after a second try
sometimes third try with a timeout of 1ms it worked.
Example Code:
while (!$check_mem) {
shm_remove($shm_id);
$uid = shm_attach($shm_id, $global[ARRAY_SIZE]);
$tstamp = time();
$user_data = array (
"nick" => $cur_identity->username,
"channel" => $channel,
"input" => "",
"query" => "",
"query_stat" => "",
"cybernode" => $cur_identity->cybernode_key,
"timestamp" => $tstamp,
"color" => 2,
"channel_info" => 1,
"voice" => 1,
"level" => $user_level
);
$check_mem = shm_put_var($uid, $shm_id, $user_data);
if (!$check_mem) echo "*";
usleep(1);
}
I needed the while-loop and usleep to check if it was successfull.
When i removed the usleep i had about 80 stars (*) sometimes, but worked after that many tries. With
the usleep it just needs 2 sometimes 3 tries.
But its only at about 5% of the calls (tried this one with about 700 script calls after i saw it).