php / php/php-src

opcache used_memory reports negative value

Open
#16,927 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: opcache SAPI: fpm Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

<?php
                var_dump(opcache_get_status()['memory_usage']);
?>

Reports a negative value for used_memory.

used_memory
Image is from a VDS system with opcache.memory_consumption=1GB and several sites.

But issue was reproduced within the following environment:

  • PHP 8.3
  • shared hosting server with PHP-FPM
  • two sites with individual opcache.memory_consumption settings
  • first site: 128M
  • second site: 256M
  • global settings in plesk: 256M

Second site reports correct values, but first site, with lower settings reports negative value for "used_memory"

Changing both sites to dedicated PHP-FPM fixes the issue, but in the default config it fails.

C.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing opcache_get_status()['memory_usage'] on PHP 8.3 with shared PHP-FPM pools and different opcache.memory_consumption settings; compare the reported values with dedicated PHP-FPM. Done means used_memory remains valid and non-negative in the shared configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.