logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: PHP + FCGID + JIT problem
Author
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Tue 23 Nov '21 12:58    Post subject: PHP + FCGID + JIT problem Reply with quote

My system:
Apache version 2.4.51
PHP 8.1.0RC6
Windows 10 21H2

I have a problem when I try to apply JIT. I use simple settings like
Code:
opcache.jit=tracing
opcache.jit_buffer_size=128M


Apache runs with FCGID from Apache Lounge, version 2.3.10. I use 2 different PHP-versions, so Apache module is no option. Older version is 7.4 (no JIT), and newer version is 8.1.0, for now RC6.

With JIT disabled all is fine with 8.1.0.

With JIT enabled errors start appearing to Apache log.
    [2021-11-23 12:50:04.499402] [fcgid:warn] [pid 12064:tid 4700] (OS 109)Pipe has been ended. : [client 192.168.0.254:51486] [mod_fcgid: get overlap result error] [referer xxxxx]
    [2021-11-23 12:50:04.500335] [core:error] [pid 12064:tid 4700] [client 192.168.0.254:51486] [End of script output before headers: _url.php] [referer xxxxx]


Errors do not appear on the first run of the php-script, it usually takes a few screen refreshes for the errors to appear.

In windows event viewer I can see the following:
Viallisen sovelluksen nimi: php-cgi.exe, versio: 8.1.0.0, aikaleima: 0x618b971b
Viallisen moduulin nimi: php_opcache.dll, versio: 8.1.0.0, aikaleima: 0x618b9bdb
Poikkeuskoodi: 0xc0000005
Virhepoikkeama: 0x000000000008bbb1
Viallisen prosessin tunnus: 0x2e90
Viallisen sovelluksen käynnistysaika: 0x01d7e057bac9093a
Viallisen sovelluksen polku: C:\php\php-cgi.exe
Viallisen moduulin polku: C:\PHP\ext\php_opcache.dll
Raportin tunnus: d01e89e3-56e9-4055-bdc7-f2a1b6504b79
Viallisen paketin koko nimi:
Viallisen paketin suhteellinen sovellustunnus:

Has anybody had similar problems with FCGID & JIT?

I have reported this earlier to bugs.php.net, that was with PHP 8.0.3RC1. No cure. https://bugs.php.net/bug.php?id=80768
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 23 Nov '21 15:56    Post subject: Reply with quote

0xc0000005 is an access violation. It might be the case that the user from your apache service is not allowed to allocate the memory. I had that often with apache internal cache. in this case you may create a local user and change the user the apache service runs.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Tue 23 Nov '21 16:57    Post subject: Reply with quote

I have used both Local System Account, and also created another user with admin priviledges, but that had no effect.

What you said about access violation made me think, and I disabled opcache.file_cache, I had forgotten to do that.¨
For what I understand, it is useless with JIT and I thought that it would be ignored automatically when JIT is enabled.

Up till now, 1 hour without errors. That's 59 minutes longer than ever before.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 23 Nov '21 22:52    Post subject: Reply with quote

My finnish language skills are zero, but I guess Raportin tunnus: d01e89e3-56e9-4055-bdc7-f2a1b6504b79 should refer to something in the windows event log. I think it it worth to look for it.

Did you set a path for the cache file? If not it may uses C:\Windows\Temp and that often leads to access violations. However it is better and faster to use memory (RAM) only for opcache.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 24 Nov '21 11:15    Post subject: Reply with quote

Today I tried the current PHP 8.1.0
I didn't get it working with 8.0.10

Code:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.jit_buffer_size=100M
opcache.jit=tracing
opcache.save_comments=1


That is the currently best working option. Maybe you can increase the "100M" if you need to.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Wed 24 Nov '21 15:41    Post subject: Reply with quote

Exception Analysis related to errors in first post

Microsoft (R) Windows Debugger Version 10.0.22473.1005 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\Users\Timo\AppData\Local\CrashDumps\php-cgi.exe.1964.dmp]
User Mini Dump File: Only registers, stack and portions of memory are available


************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
Windows 10 Version 19044 MP (8 procs) Free x64
Product: WinNt, suite: SingleUserTS
Edition build lab: 19041.1.amd64fre.vb_release.191206-1406
Machine Name:
Debug session time: Wed Nov 24 08:33:24.000 2021 (UTC + 2:00)
System Uptime: not available
Process Uptime: 0 days 2:02:39.000
..............................................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(7ac.37c8): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
ntdll!NtWaitForMultipleObjects+0x17:
00007ffb`b91cd8c7 c3 ret
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************

*** WARNING: Unable to verify timestamp for php8.dll
*** WARNING: Unable to verify timestamp for php_opcache.dll
*** WARNING: Unable to verify timestamp for php-cgi.exe

KEY_VALUES_STRING: 1

Key : AV.Fault
Value: Execute

Key : Analysis.CPU.mSec
Value: 1656

Key : Analysis.DebugAnalysisManager
Value: Create

Key : Analysis.Elapsed.mSec
Value: 8687

Key : Analysis.Init.CPU.mSec
Value: 327

Key : Analysis.Init.Elapsed.mSec
Value: 4361

Key : Analysis.Memory.CommitPeak.Mb
Value: 78

Key : Timeline.Process.Start.DeltaSec
Value: 7359

Key : WER.OS.Branch
Value: vb_release

Key : WER.OS.Timestamp
Value: 2019-12-06T14:06:00Z

Key : WER.OS.Version
Value: 10.0.19041.1

Key : WER.Process.Version
Value: 70.1.0.0


FILE_IN_CAB: php-cgi.exe.1964.dmp

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

CONTEXT: (.ecxr)
rax=00000000000081e8 rbx=000002072c616590 rcx=000002072c616590
rdx=0000000000000002 rsi=0000000000130000 rdi=000002072c668000
rip=0000000000000000 rsp=000000c0597fbb58 rbp=0000000000000000
r8=0000000000000000 r9=000002072c578f01 r10=00000000219f2d90
r11=ffffffffffffffff r12=0000000000000001 r13=000000c0597fbcc0
r14=000002072c616590 r15=00000000219d2538
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246
00000000`00000000 ?? ???
Resetting default scope

EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 0000000000000000
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000008
Parameter[1]: 0000000000000000
Attempt to execute non-executable address 0000000000000000

PROCESS_NAME: php-cgi.exe

EXECUTE_ADDRESS: 0

FAILED_INSTRUCTION_ADDRESS:
+0
ERROR_CODE: (NTSTATUS) 0xc0000005 - K sky osoitteessa 0x%p viittasi muistiin osoitteessa 0x%p. Muisti ei voinut olla %s.
Translation: Instruction in address 0x%p referenced to memory address 0x%p. Memory could not be %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 0000000000000008

EXCEPTION_PARAMETER2: 0000000000000000

IP_ON_HEAP: 00000000280006eb
The fault address in not in any loaded module, please check your build's rebase
log at <releasedir>\bin\build_logs\timebuild\ntrebase.log for module which may
contain the address if it were loaded.

FRAME_ONE_INVALID: 1

STACK_TEXT:
000000c0`597fbb58 00000000`280006eb : 00000000`21252190 00007ffb`92bc0327 00000000`21259838 00000207`2c663140 : 0x0
000000c0`597fbb60 00000000`21252190 : 00007ffb`92bc0327 00000000`21259838 00000207`2c663140 00000207`2c616500 : 0x280006eb
000000c0`597fbb68 00007ffb`92bc0327 : 00000000`21259838 00000207`2c663140 00000207`2c616500 00007ffb`9c5b4695 : 0x21252190
000000c0`597fbb70 00000000`21259838 : 00000207`2c663140 00000207`2c616500 00007ffb`9c5b4695 d5492219`3ea53f6a : php8+0x10327
000000c0`597fbb78 00000207`2c663140 : 00000207`2c616500 00007ffb`9c5b4695 d5492219`3ea53f6a 00000000`00000000 : 0x21259838
000000c0`597fbb80 00000207`2c616500 : 00007ffb`9c5b4695 d5492219`3ea53f6a 00000000`00000000 000000c0`597fbcc0 : 0x00000207`2c663140
000000c0`597fbb88 00007ffb`9c5b4695 : d5492219`3ea53f6a 00000000`00000000 000000c0`597fbcc0 00000000`00000000 : 0x00000207`2c616500
000000c0`597fbb90 d5492219`3ea53f6a : 00000000`00000000 000000c0`597fbcc0 00000000`00000000 d5492219`3ea53f6a : php_opcache+0x94695
000000c0`597fbb98 00000000`00000000 : 000000c0`597fbcc0 00000000`00000000 d5492219`3ea53f6a 00007ffb`92bd142f : 0xd5492219`3ea53f6a


SYMBOL_NAME: unknown!noop+c0597fbb60

MODULE_NAME: unknown!

IMAGE_NAME: unknown.dll

STACK_COMMAND: ~0s ; .ecxr ; kb

FAILURE_BUCKET_ID: SOFTWARE_NX_FAULT_c0000005_unknown.dll!noop

OS_VERSION: 10.0.19041.1

BUILDLAB_STR: vb_release

OSPLATFORM_TYPE: x64

OSNAME: Windows 10

FAILURE_ID_HASH: {831d0811-1ea2-ade7-1bca-bc3a623ec739}

Followup: MachineOwner
---------
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 212
Location: Paris, France, EU

PostPosted: Wed 24 Nov '21 17:05    Post subject: Reply with quote

Hi,

May be:
Code:
; http://php.net/auto-globals-jit
auto_globals_jit = Off

solve the problem.

See https://bugs.php.net/bug.php?id=79751
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Wed 28 Dec '22 13:56    Post subject: Reply with quote

There is a general problem with Zend OPcache running under mod_fcgid: after a couple of hours it fails with error 487 and falls back to file cache
Quote:
Base address marks unusable memory region (fall-back to file cache)
Attempt to access invalid address.

I had Apache running mainly for 2 sites: a very old bare PHP site running under PHP 7.4. And a new site, built with Drupal 9. Drupal 9.4 still ran with PHP 7.4, but Drupal 9.5.0 requires at least PHP 8.0, but preferably PHP 8.1. Drupal 9 also requires php_opcache.dll to be loaded. So my first attempt was to load PHP 8.1.13 TS with mod_fcgid.

That seemed to work OK, but the next day there was the above error in the event log and SHM Cache was disabled. I tried a lot of settings like
opcache.mmap_base=0x20000000 or
opcache.mmap_base=0x0000700000000000
The second uses the values for a Win64 PHP. See https://github.com/php/php-src/blob/PHP-8.1.13/ext/opcache/shared_alloc_win32.c#L208-L220 with the TODO by Pierre Joye that has been there for ages.

'opcache.mmap_base=0x20000000' is the recommended fix for the error "Unable to reattach to base address". But some also recommend it as fix for "Base address marks unusable memory region". See https://www.php.net/manual/en/opcache.configuration.php#120544

For sites like a Drupal 9 site with lots of code and fairly frequent changes falling back to file cache is something you do not want. So I swapped the settings. Drupal is now running with PHP 8.1.13 TS loaded as mod_php and the barebones PHP site is running with PHP 7.4.33 TS loaded with mod_fcgid. PHP 7.4.33 has an occasional 'fall-back to file cache', but that does not worry me. If it becomes a nuisance I can even turn OPcache off in that site.

As a BTW: Apache with mod_php is quite stable. I have another Drupal 7 site with PHP 7.3.33 + OPcache running under mod_php and it has never crashed during the last couple of years.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 28 Dec '22 15:22    Post subject: Reply with quote

Did you try already the TS version instead the NTS?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Wed 28 Dec '22 15:31    Post subject: Reply with quote

James Blond wrote:
Did you try already the TS version instead the NTS?
On purpose I used TS for PHP 7.4.33 and for PHP 8.1.13. Because (1) I remembered your preference for the TS versions and (2) it made swapping mod-php - mod_fcgid a lot easier. The same PHP's could be used for both scenarios.
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 212
Location: Paris, France, EU

PostPosted: Wed 28 Dec '22 17:28    Post subject: Reply with quote

Jan-E wrote:
[...]Drupal is now running with PHP 8.1.13 TS loaded as mod_php and the barebones PHP site is running with PHP 7.4.33 TS loaded with mod_fcgid.

Hi,

Remove me from a doubt!
When you talk about "mod_php", it is indeed php loaded as an Apache module ?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Wed 28 Dec '22 17:41    Post subject: Reply with quote

Part of the conf code, after the switch:
Code:
#      PHPIniDir "/phpdev/php74.x64"
#      LoadModule php7_module "/phpdev/php74.x64/php7apache2_4.dll"
      PHPIniDir "/phpdev/php81.x64"
      LoadModule php_module "/phpdev/php81.x64/php8apache2_4.dll"

And in the fcgid part:
Code:
         FcgidInitialEnv PHPRC "/phpdev/php74.x64"
         FcgidWrapper "/phpdev/php74.x64/php-cgi.exe"
#         FcgidInitialEnv PHPRC "/phpdev/php81.x64"
#         FcgidWrapper "/phpdev/php81.x64/php-cgi.exe"
Back to top


Reply to topic   Topic: PHP + FCGID + JIT problem View previous topic :: View next topic
Post new topic   Forum Index -> Other Software