#28965 [NoF->Bgs]: Problem with shmop (cannot delete a segment)
| From: | tony2001@php.net | Date: | Sat, 15 Apr 2006 21:12:19 +0000 |
| Subject: | #28965 [NoF->Bgs]: Problem with shmop (cannot delete a segment) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95837@lists.php.net to get a copy of this message | ||
ID: 28965
Updated by: tony2001@php.net
Reported By: mauroi at digbang dot com
-Status: No Feedback
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows XP
PHP Version: 5.0.0RC3
New Comment:
See bug #33011.
Previous Comments:
------------------------------------------------------------------------
[2006-04-15 20:59:32] piotrprz at gmail dot com
I have the same problem on my windows xp + apache2/php5.1.2
The problem does not occur on Windows 2003 Server build 3790 +
iis6/php5.1.2
------------------------------------------------------------------------
[2005-05-12 02:28:14] joe at bs0 dot com
Am experiencing the same problem on windows xp with iis and apache2.
Tested in php 4.3.11 and the snapshot in the comment above, no
difference. After calling shmop_delete, memory can still be
opened/read on either the same request, or subsequent ones.(am calling
shmop_close after delete)
------------------------------------------------------------------------
[2005-03-05 01:00:06] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-02-25 11:19:29] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
------------------------------------------------------------------------
[2004-06-30 00:14:40] mauroi at digbang dot com
Description:
------------
First of all, when I call shmop_open with the "n" access mode I always
get an error ("cannot create...").
But also, when I create it with the "c" access mode it works ok. Then
(in another execution) I can read that shared memory segment and it
returns the correct data. If I try to delete the segment the function
always return true, but it does not delete it (on the next request I
can read it anyway).
Looking at the process explorer I can see that the apache process
always get a new "Section" called \BaseNamedObjects\TSRM_SHM_DESCRIPTOR
(even if my PHP script is only reading the segment or deleting the
segment, not creating one).
Thanks in advance.
PS. I get the same error on PHP 4 / Windows XP.
Reproduce code:
---------------
I execute the following script 3 times. First with the READ and DELETE
parts commented. Then with WRITE and DELETE parts commented. And
finally with the WRITE and READ parts commented.
After that if the segments exists anyway.
<?php
class Foo
{
function Foo()
{
$this->a = '43534553';
$this->b = 'jeqgfhewfg';
}
}
$foo = new Foo();
$key = CreateKey('var');
/* WRITE */
$content = serialize($foo);
$shmId = shmop_open($key, "c", 0777, strlen($content));
$written = shmop_write($shmId, $content, 0);
shmop_close($shmId);
/* READ */
$shmId = shmop_open($key, 'a', 0, 0);
$content = shmop_read($shmId, 0, shmop_size($shmId));
shmop_close($shmId);
var_dump($content);
/* DELETE */
$shmId = shmop_open($key, 'w', 0, 0);
$success = shmop_delete($shmId);
shmop_close($shmId);
function CreateKey($key)
{
$fileName = './' . $key;
if (!file_exists($fileName))
{
touch($fileName);
}
return FTOK($fileName, 'a');
}
function FTOK($pathName, $projId)
{
$stat = stat($pathName);
$key = sprintf("%u",
(($stat['ino'] & 0xffff) | (($stat['dev'] & 0xff) << 16) |
(($projId
& 0xff) << 24)));
return $key;
}
?>
Expected result:
----------------
On a fourth request I would expect an error if I execute the READ part
Actual result:
--------------
I get the foo object.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28965&edit=1