php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78103 Allocating ~2TB memory after PHP_FCGI_CHILDREN-th request
Submitted: 2019-06-04 12:07 UTC Modified: 2019-06-13 08:23 UTC
Votes:12
Avg. Score:4.8 ± 0.4
Reproduced:12 of 12 (100.0%)
Same Version:10 (83.3%)
Same OS:6 (50.0%)
From: hardaqa at gmail dot com Assigned:
Status: Open Package: CGI/CLI related
PHP Version: 7.2.19 OS: Windows 10 v1809 64bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-06-04 12:07 UTC] hardaqa at gmail dot com
Description:
------------
Using Apache 2.4 via mod_proxy to connect to php.
PHP's using PHP_FCGI_CHILDREN to manage workers pool, opcache enabled.

After n-th request (n = PHP_FCGI_CHILDREN) to test.php script, php throws "Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 2052604301400 bytes)"

Does not occur with either opcache disabled, PHP_FCGI_CHILDREN=0 or 7.2.18 and other versions of php.


Test script:
---------------
# run.cmd
SET PHP_FCGI_CHILDREN=4
php-cgi.exe -b 127.0.0.1:9000

# test.php
<?php
$i = 1;
define('test' . $i, 'frewgfrwfrwfg43gt53hgt5ege5wqh4g5q4w');



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-05 20:29 UTC] davesw dot z dot phpbug at spamgourmet dot com
I ran into the same issue, but using IIS with FastCGI. A few requests would work, and then all would fail with trying to allocate 7813304906544536728 bytes!

Disabling opcache didn't help, reverting to 7.1.30 did (my ISP didn't offer 7.2.18 as an option to revert to).
 [2019-06-12 15:57 UTC] mario dot bandeira at cronobandeira dot com
Seams somehow related to the bug I am experiencing: https://bugs.php.net/bug.php?id=78147
---
After n-th request (n = PHP_FCGI_CHILDREN) to test.php script, php throws "Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 2052604301400 bytes)"
---

Never less, on my case it occurs with or without opcache enable.
 [2019-06-12 19:53 UTC] cmb@php.net
Have you double-checked (e.g. via phpinfo()) that Opcache is
indeed disabled?
 [2019-06-13 08:23 UTC] nikic@php.net
I can't reproduce this on Linux, with or without opcache. Possibly Windows-only?
 [2019-06-14 09:57 UTC] mario dot bandeira at cronobandeira dot com
Yes, I have double check with phpinfo() that opcache was disable.
As I am not an expert on web systems, here the complete system config for your evaluation: Windows server 2016, IIS, plesk Onyx 17.8.11 update#55, php7.2.19 (with php7.1.30 works ok), testing subdomain.
 [2019-06-19 00:59 UTC] jbrady at sbccd dot edu
This happened for us on IIS using FastCGI with both Windows 2008 R2 & Windows 2012 R2. It can be fixed by going back to 7.2.18 or explicitly disabling opcache (opcache.enabled=0).

This was verified in phpinfo and by explicitly changing the php.ini.
 [2019-07-03 22:21 UTC] hardaqa at gmail dot com
This does not happen anymore in 7.2.20 for me.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Aug 24 23:01:26 2019 UTC