Edit report at https://bugs.php.net/bug.php?id=74015&edit=1
ID: 74015
Updated by: [email protected]
Reported by: uli dot hecht at gmail dot com
Summary: ReflectionClass::getInterfaceNames wrong entry with
random memory location
-Status: Verified
+Status: Feedback
Type: Bug
Package: Reflection related
Operating System: Windows
PHP Version: 7.1.1
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
I was asking explicitly about master,something like here http://windows.php.net/downloads/snaps/master/r5096a42/ . Please note, that latest were also to fetch from the windows.php.net page. We've recently switched to vc15, so you should be aware to fetch some of the previous vc14 master snap after the date i've asked 2017-03-08.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2017-03-27 05:42:19] uli dot hecht at gmail dot com
I tried with the snapshot of March, 14th (7.1.4-dev) and can still reproduce this. I'm also using Apache benchmark now, thanks Jeffrey for the great hint - didn't even know about this tool.
------------------------------------------------------------------------
[2017-03-23 19:11:26] jeffrey dot haley at gmail dot com
Was able to reproduce this issue running under 7.0.17 with Windows 7 and the latest 7.0 snapshot master as of today 3/23/17 (php-7.0-ts-windows-vc14-x64-r1517fdb.
Environment
- Windows 7 x64
- Apache 2.4.23 win64 VC14 (from apachelounge.com)
- php-7.0.17-Win32-VC14-x64 (also tried 7.0-ts-windows-vc14-x64-r1517fdb)
------------------------------------------------------------------
test.php
------------------------------------------------------------------
// Test data
class DUMMY implements \Serializable, \IteratorAggregate, \Countable, \ArrayAccess {
public function serialize() {}
public function unserialize($serialized) {}
public function getIterator() {}
public function offsetExists($offset) {}
public function offsetGet($offset) {}
public function offsetSet($offset, $value) {}
public function offsetUnset($offset) {}
public function count() {}
}
// Provoke error
$cls = new \ReflectionClass('\DUMMY');
foreach ($cls->getInterfaceNames() as $interfaceName)
{
class_implements($interfaceName); // Failure here
}
Occurs under load as described, I simulated this with the Apache benchmark tool:
ab -c 100 -n 10000 "http://localhost/test.php"
Following error occurs in the error log:
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 8318823012549873016 bytes) in D:\development\test.php on line 23
------------------------------------------------------------------------
[2017-03-08 17:45:19] [email protected]
Could you please check the latest master snapshots?
Thanks.
------------------------------------------------------------------------
[2017-02-02 10:31:25] uli dot hecht at gmail dot com
Today I reproduced the error with opcache disabled. Therefore I changed the package to "Reflection related".
Because of that I disabled all extensions, and against expectations the error still appears*.
The strange thing is that today it already appears after less than 10 browser refreshs, while I had to refresh consistently for at least a minute yesterday. No matter, if opcache is enabled or not. I didn't even restart my system (it was in standby mode, though).
*I had to replace the openssl_random_pseudo_bytes() call in the test script by uniqid().
------------------------------------------------------------------------
[2017-02-01 14:38:44] uli dot hecht at gmail dot com
Finally I could reproduce the problem without Symfony. The actual problem is simultaneous HTTP / PHP requests, that's why the error occured when loading assets generated by PHP.
Here is a little test script to reproduce the error: http://pastebin.com/vrguZM92
File name is "test1.php". It has to be invoked by a web browser via Apache2.
You have to reload this script in the browser again and again for about 1 minute. I suggest the Firefox addon "ReloadEvery".
I noticed that it takes much longer for the error to appear, when using this test script, compared to my full Symfony application. But the error with getInterfaceNames() is the same.
It looks like some non-thread-safe code is causing this, because I couldn't reproduce the error with non-concurrent requests at all.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=74015
--
Edit this bug report at https://bugs.php.net/bug.php?id=74015&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.