php / php/php-src

opcache crashes on high volume IIS servers (Windows)

Open
#12,010 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug OS: Windows Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.2k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

There is no way to reproduce the bug with code.
The sneakiest thing is that everything works as it should, but opcache fails when the server load increases beyond a certain threshold.
I assume, but of course I'm not sure, because of the shared memory. This assumption derives from the fact that when it happens all the PHP (cgi) instances close unexpectedly (opcache's shared memory should be the only thing connecting them). I also tried to change the opcache memory model, but nothing changes.
Furthermore, in 99% of the cases no error is visible on the Windows events, but obviously on the IIS user side it shows a 500 error.

The only way I've found to reproduce the bug is to overload a test server (with the same configuration as the production server), after some time (usually a few minutes), all PHP instances close and occasionally I see an error similar to this:

Faulting application name: php-cgi.exe, version: 8.0.28.0, time stamp: 0x63eb7b04
Faulting module name: php_opcache.dll, version: 8.0.28.0, time stamp: 0x63eb7e4f
Exception code: 0xc0000005
Fault offset: 0x0000000000168011
Faulting process id: 0x1f2c
Faulting application start time: 0x01d9d3b2249e086e
Faulting application path: /path/to/php-cgi.exe
Faulting module path: /path/to/php_opcache.dll
Report Id: de8f6365-8a29-4f20-b3cf-d2d160d39508
Faulting package full name: 
Faulting package-relative application ID: 

I got proof that the cause is linked to opcache overloading the same server after disabling opcache. The server becomes (obviously) very slow, but no PHP instances crash even after 1 hour.

PHP Version

Both TS and NTS, PHP 8.0.28 + PHP 8.0.29 + (PHP 8.0.?)

Operating System

Windows Server 2022 Datacenter

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

Start by reproducing the crash under sustained load on IIS with Windows Server 2022 and PHP 8.0.28 or 8.0.29, comparing TS and NTS configurations. Check the Windows fault report for php-cgi.exe and php_opcache.dll, then compare behavior with OPcache disabled. Done means the failure cause is isolated and the same workload no longer crashes PHP instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, operating-systems, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.