phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

503 error - PHP CLI works fine #419

Closed trasek closed 2 years ago

trasek commented 5 years ago

Hey i've got problem - i successfully compile v8 and v8js (v8 version 7.5.289) and v8js 2.1.1 but the website have problem and i recive 503 error.

Error logs:

[Wed Jul 03 14:10:26.139495 2019] [proxy_fcgi:error] [pid 31554:tid 140312839788288] [client ip:39057] AH01067: Failed to read FastCGI header
[Wed Jul 03 14:10:26.139548 2019] [proxy_fcgi:error] [pid 31554:tid 140312839788288] (104)Connection reset by peer: [client ip:39057] AH01075: Error dispatching request to : 

In PHP CLI the same file works fine - i'am trying to test in single simple file:

var_dump(extension_loaded('v8js'));

$v8 = new V8Js();

$v8->executeString('print("V8Js");');

P.S. i've got before version 7.2.29 of php but when i update it with directadmin it's stop working - i try to recompile v8js with newest version, with old version etc.. Nothing help.. Everything on server work fine except this.

P.S.2. PHP properly see extension - i mean it's loaded to PHP and should work fine.

P.S.3. i'am try to test and compile 2.1.0 with v8 6.5 and 6.4 and some other version. I'am trying everything from last two days.. With compile it to PHP 7.3 (second PHP on the server) but no results.

trasek commented 5 years ago

Downgrade to PHP 7.2.29 resolved the problem...

Reforced commented 5 years ago

If it works fine in the CLI, the extension seems to work.. I'm not familiar with FastCGI, but make sure the timeout of the proxy is bigger than the timeout defined in PHP. There was a bug in Apache in the past (fixed at 30 seconds), upgrading Apache might help too. Looking around a bit further to help you out, some extensions might also be causing trouble. Seeing you've also posted this message on directadmin and serverfault, you've already found this probably, but to be sure you could try tinkering with opcache. Common suggestions for this problem are setting opcache.fast_shutdown to disabled, or setting opcache.max_accelerated_files to a high number of like 20000.

stesie commented 5 years ago

You're on GNU/Linux right? Have you looked into dmesg output (or captured in syslog), where it reports segfaults of those php processes? I would think so. Can you collect and provide a backtrace of the crash?

Generally there's one difference of e.g. PHP FPM SAPI compared to PHP CLI SAPI: it runs multiple requests (subsequently) within the same process. If it fails to shut down cleanly it might cause the next request to crash (... and you won't be able to reproduce this with CLI SAPI)

trasek commented 5 years ago

Hey the problem is with new PHP version. We cannot find any error but downgrade of PHP do the job. I don't know why.

@Reforced the problem is that, the PHP is setup as FPM.

@stesie dmseg don't output anything.. The normall PHP pages works fine, problem was only with pages with v8js.