php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70795 Opcache causes segfaults when Constant Arrays are used under some concurrency
Submitted: 2015-10-26 16:42 UTC Modified: 2015-10-28 09:49 UTC
From: bastiaan at mollie dot com Assigned:
Status: Closed Package: opcache
PHP Version: 5.6.14 OS: Linux debian wheezy
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bastiaan at mollie dot com
New email:
PHP Version: OS:

 

 [2015-10-26 16:42 UTC] bastiaan at mollie dot com
Description:
------------
Call the script foo.bar, host it with apache2 on localhost and use ab to call the script concurrently:

ab -c 20 -n 10000 'http://127.0.0.1/foo.php'

Tail the output of /var/log/apache2/*.log



Test script:
---------------
<?php

class Bar
{
    const FOO = [
        'foo' => 'bar',
    ];

    public function foo($bar)
    {
        return self::FOO[$bar];
    }
}

$foo = new Bar;
usleep(rand(1,1000000));
$bar = $foo->foo('foo');

Expected result:
----------------
status 200 / no segfaults

Actual result:
--------------
A segfault and segfaults to any subsequent requests to the same script.

[Mon Oct 26 17:07:39 2015] [error] [client 127.0.0.1] PHP Fatal error:  Out of memory (allocated 262144) (tried to allocate 139794773411952 bytes) in Unknown on line 0
[Mon Oct 26 17:07:39 2015] [notice] child pid 7385 exit signal Segmentation fault (11)
[Mon Oct 26 17:07:39 2015] [notice] child pid 7386 exit signal Segmentation fault (11)
[Mon Oct 26 17:07:39 2015] [notice] child pid 7390 exit signal Segmentation fault (11)
[Mon Oct 26 17:07:39 2015] [notice] child pid 7391 exit signal Segmentation fault (11)
[Mon Oct 26 17:07:39 2015] [notice] child pid 7392 exit signal Segmentation fault (11)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-26 21:12 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2015-10-26 21:12 UTC] nikic@php.net
This is likely the same issue as https://bugs.php.net/bug.php?id=70601. Could you check if 5.6.15RC1 (or 5.6-dev) fixes this issue?
 [2015-10-28 09:49 UTC] bastiaan at mollie dot com
-Status: Feedback +Status: Closed
 [2015-10-28 09:49 UTC] bastiaan at mollie dot com
I can confirm that php-5.6.15RC1 indeed fixes this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC