|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75738 mmap/munmap loop?
Submitted: 2017-12-27 16:11 UTC Modified: 2017-12-27 18:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: albertcasademont at gmail dot com Assigned:
Status: Open Package: CGI/CLI related
PHP Version: 7.1.12 OS: Debian Stretch
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-12-27 16:11 UTC] albertcasademont at gmail dot com

We're seeing some random neverending loops on Symfony3 CLI commands. stracing the processes we can see a series of looping calls to mmap/munmap/madvise

mmap(NULL, 4198400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe554fff000
munmap(0x7fe554fff000, 4198400)         = 0
mmap(NULL, 6291456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe554e00000
munmap(0x7fe555201000, 2093056)         = 0
madvise(0x7fe554e00000, 4198400, MADV_HUGEPAGE) = 0

Saw bug #75368 but it seems like the issue keeps repeating itself. I'm afraid I can't provide a script to reproduce it, seems to occur randomly, quite frustrating. Any ideas?



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-27 16:43 UTC]
Does the problem disappear if you set the USE_ZEND_ALLOC=0 environment variable?
 [2017-12-27 16:55 UTC] albertcasademont at gmail dot com
Hi Nikita,

Thanks, trying it now, we normally see the problem happening every 10-20 minutes, will get back asap.
 [2017-12-27 17:15 UTC] albertcasademont at gmail dot com
Hi Nikita,

Yes, the issue still happens with USE_ZEND_ALLOC=0
 [2017-12-27 17:17 UTC] albertcasademont at gmail dot com
Interestingly enough, the strace doesn't display anything at all with that flag, which is weird. Process is still in a neverending loop wasting CPU, though.
 [2017-12-27 17:22 UTC] albertcasademont at gmail dot com
I installed gdb on the production machine and did a bt on the process, this is the output. Seems like there's something wrong with a shutdown function in a Newrelic extension?

#0  0x000055d54756cce8 in zif_array_unshift ()
#1  0x000055d5476e24cd in ?? ()
#2  0x000055d54768921b in execute_ex ()
#3  0x00007f4c899af1bb in nr_php_execute_enabled () at /home/hudson/slave-workspace/workspace/php-release-agent/label/centos5-64-nrcamp/agent/php_execute.c:1191
#4  0x00007f4c899af802 in nr_php_execute () at /home/hudson/slave-workspace/workspace/php-release-agent/label/centos5-64-nrcamp/agent/php_execute.c:1301
#5  0x000055d54762f0e4 in zend_call_function ()
#6  0x000055d54762f385 in _call_user_function_ex ()
#7  0x000055d547575597 in ?? ()
#8  0x000055d5476513fa in zend_hash_apply ()
#9  0x000055d547578ae6 in php_call_shutdown_functions ()
#10 0x000055d5475da015 in php_request_shutdown ()
#11 0x000055d5476e5a60 in ?? ()
#12 0x000055d5474b6c19 in main ()

Not sure if this is still a relevant PHP bug or should i fill it with the NR guys.
 [2017-12-27 17:37 UTC]
The new relic extension is probably unconditionally hooking into function calls, so the presence of nr_php_execute does not necessarily indicate an issue with new relic.

Can you try whether the problem still reproduces with the new relic extension unloaded?
 [2017-12-27 18:34 UTC] albertcasademont at gmail dot com
Disabling the extension seems to fix the problem. Also removed the USE_ZEND_ALLOC env var. I have reported it to the NR guys, is this still something that could be related to PHP Core?
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 14:01:24 2020 UTC