-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 5.7 fails with exit code 139 #9340
Comments
To anyone who also has this issuePlease react with heart (:heart:) to the issue itself, so that we can gauge the impact.
This exit code usually indicates a segmentation fault, meaning the problem is in PHP (or one of its extensions), and Psalm just triggers it somehow. Compiling PHP with debug symbols (or installing them with your package manager), getting the core dump and analyzing it with Alternatively, you may try to disable all non-essential extensions. The extensions Psalm requires are listed here: psalm/src/Psalm/Internal/CliUtils.php Lines 521 to 536 in d934875
|
Another thing you may try is stopping Psalm from enabling JIT by running it with |
Another update, this happens when I run Psalm inside docker container - if I run that same with host machine it works as expected. PHP extenstions on that docker machine: dev@php-fpm /app (chore(deps)/dependency-update)> php -m
[PHP Modules]
apcu
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
igbinary
intl
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcache
dev@php-fpm /app (chore(deps)/dependency-update)> And PHP extensions on my host machine: tle@morko-virtualbox:~$ php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gettext
hash
iconv
intl
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
random
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
tle@morko-virtualbox:~$ Hmm with that
It seems to work as expected dev@php-fpm /app (chore(deps)/dependency-update)> PSALM_ALLOW_XDEBUG=1 ./vendor/bin/psalm src/Controller/IndexController.php
Install the opcache extension to make use of JIT on PHP 8.0+ for a 20%+ performance boost!
Target PHP version: 8.2 (inferred from current PHP version) Enabled extensions: pdo.
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
------------------------------
No errors found!
------------------------------
Checks took 9.89 seconds and used 318.176MB of memory
Psalm was able to infer types for 100% of the codebase
dev@php-fpm /app (chore(deps)/dependency-update)> What might be the cause that this worked without that |
Try commenting out these lines: psalm/src/Psalm/Internal/Fork/PsalmRestarter.php Lines 98 to 100 in d934875
and running without |
Yeah it works when I commented out those lines. |
@danog any ideas? |
If you find a way to reproduce the issue consistently with a subset of your code (or link to it if it's FOSS), please open an issue @ https://github.com/php/php-src/issues, or otherwise send the code that triggers the segfault here (or try making a https://psalm.dev reproducer) so we can open an issue with proper gdb backtraces ourselves. This would really be of great help to the PHP developers :) |
And it looks like that following cases works:
So if all of those three options are set then this happen. |
This one is of particular interest. Disabling any of the others just disables the JIT. |
@tarlepp Could you try reproducing the crash on psalm.dev, or at least send the contents of Edit: nevermind psalm.dev doesn't have JIT enabled, can you just try creating a Dockerfile that reproduces the issue? |
It doesn't matter which file I try to analyze with Psalm, but the contents of that <?php
declare(strict_types = 1);
namespace App\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Attribute\AsController;
use Symfony\Component\Routing\Annotation\Route;
#[AsController]
class IndexController
{
#[Route(
path: '/',
methods: [Request::METHOD_GET],
)]
public function __invoke(): JsonResponse
{
return new JsonResponse();
}
} |
Could you try running with --debug-by-line, and what version of PHP are you using? |
That didn't change the results
8.2.3
I created example repository where this can reproduced - https://github.com/tarlepp/psalm-issue |
Does JIT work for you at all? I.e. what does the following command produce? php -dopcache.enable_cli=true -dopcache.jit_buffer_size=512M -dopcache.jit=1205 -r 'var_dump(opcache_get_status()["jit"]); ' |
If I run that command in that example repository I get following:
|
And what if you disable Xdebug in your php.ini? |
If Xdebug is disabled Psalm runs as expected. That is quite easy to test with that example repository, just edit that |
No, I mean |
Oh, sorry - that output is:
|
Strangely enough, it doesn't seem to be related to xdebug, but just to opcache. Runnning psalm with this php.ini causes a segfault:
Command:
Xdebug is disabled. |
It seems like |
The funny thing is, PHP manages to enter the body of a foreach that iterates over an empty array here: Lines 1002 to 1004 in d934875
The dump shown below added to that loop var_dump(
'array is empty' , $deprecated_elements === [],
'array' , $deprecated_elements,
'element of that array' , $deprecated_element,
'---------------'
); prints
|
Always use 0x7FFEBFFF opcache optimization level (fixes #9340)
With version
5.6
I get this:And with version
5.7
I get this:And in the version
5.7
the exit code is 139, so there is something fishy going on.Also tried to run with
--threads=1
option and the end results is the same.The text was updated successfully, but these errors were encountered: