vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 659 forks source link

Fatal error when using threads #1601

Closed jaikdean closed 5 years ago

jaikdean commented 5 years ago

When we run Psalm in one thread it works as expected:

$ vendor/bin/psalm --show-info=false --threads=1
Scanning files...
Analyzing files...

------------------------------
No errors found!
------------------------------

Checks took 20.19 seconds and used 852.012MB of memory
Psalm was able to infer types for 92.7393% of the codebase

However, when running in more than one, we see fatal errors:

$ vendor/bin/psalm --show-info=false --threads=2
Scanning files...
Child terminated without returning a serialized array - response type=boolean
Child terminated without returning a serialized array - response type=boolean
Child terminated with return code 0 and signal 11
Child terminated with return code 0 and signal 11
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php on line 437 and defined in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:297
Stack trace:
#0 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(437): Psalm\IssueBuffer::addIssues(NULL)
#1 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(329): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Codebase.php(385): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(414): Psalm\Codebase->scanFiles(2)
#4 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/ in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 297

Fatal error: Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php on line 437 and defined in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:297
Stack trace:
#0 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(437): Psalm\IssueBuffer::addIssues(NULL)
#1 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(329): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Codebase.php(385): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(414): Psalm\Codebase->scanFiles(2)
#4 /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/ in /Users/jaikdean/Documents/zorro/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 297

This is a private, commercial project, so I'm unable to share the code to aid in debugging, but if there's anything else I can run to get more useful information, please let me know.

Thanks for making Psalm, it's a fantastic tool and has helped improved our code quality massively.

muglug commented 5 years ago

Do things still break if you run with --no-cache?

jaikdean commented 5 years ago

Yeah, the output is exactly the same when run with --no-cache.

muglug commented 5 years ago

Mind running with --debug to see what files it crashes on?

ylixir commented 5 years ago

I am experiencing the same issue, and am in the same boat with the closed source codebase :-/

Here is what i get from the last few lines of output with ./vendor/bin/psalm --show-info=false --threads=2 --debug

Scanning /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/CanAlias.php
Using composer to locate file for Psalm\Internal\Analyzer\ClassLikeAnalyzer
Using composer to locate file for Psalm\Internal\Analyzer\MethodAnalyzer
Using composer to locate file for Psalm\Internal\Analyzer\FunctionLikeAnalyzer
Using composer to locate file for PHPUnit\Framework\MockObject\Builder\Identity
Finished registering autoloaded files
Visiting autoload files took 2.014s
Scanning files...
Child terminated without returning a serialized array - response type=boolean
Child terminated without returning a serialized array - response type=boolean

Fatal error: Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebas
e/Scanner.php on line 438 and defined in /********line/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:252
Stack trace:
#0 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(438): Psalm\IssueBuffer::addIssues(NULL)
#1 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(330): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /********line/vendor/vimeo/psalm/src/Psalm/Codebase.php(376): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(368): Psalm\Codebase->scanFiles(2)
#4 /********lin in /********line/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 252

Interestingly, the last letter is missing from the path to my codebase in number 4

ylixir commented 5 years ago

The last one was for version 3.2.2. With version 3.2.10 and using ./vendor/bin/psalm --show-info=false --threads=2 --debug --no-cache I get

Parsing /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
Scanning /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
Parsing /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/MethodAnalyzer.php
Scanning /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/MethodAnalyzer.php
Parsing /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Scanning /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Parsing /********line/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php
Scanning /********line/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php
Finished registering autoloaded files
Visiting autoload files took 6.795s
Scanning files...
Child terminated without returning a serialized array - response type=boolean
Child terminated without returning a serialized array - response type=boolean
Child terminated with return code 0 and signal 11
Child terminated with return code 0 and signal 11

Fatal error: Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php on line 437 and de
fined in /********line/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:297
Stack trace:
#0 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(437): Psalm\IssueBuffer::addIssues(NULL)
#1 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(329): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /********line/vendor/vimeo/psalm/src/Psalm/Codebase.php(385): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /********line/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(414): Psalm\Codebase->scanFiles(2)
#4 /********lin in /********line/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 297

and for completeness

$ ./vendor/bin/phpunit --version
PHPUnit 7.5.7 by Sebastian Bergmann and contributors.
weirdan commented 5 years ago

Signal 11 is SIGSEGV, so Psalm managed to crash PHP somehow. Inspecting core dump might help, you can find instructions on how to make php dump core here: https://bugs.php.net/bugs-generating-backtrace.php There's a bunch of useful gdb macros available in php-src repo: https://github.com/php/php-src/blob/master/.gdbinit

muglug commented 5 years ago

I've just added some extra debugging for the scanning step to latest master.

What platform are you running on?

ylixir commented 5 years ago

Mac OS with PHP version 7.2.17 from Nix. Happens with or without Xdebug Upgrading to 7.3.4 or downgrading to 7.1.28 causes the same issue.

I don't see any core dumps in my home directory or my project folder. I'll poke around later and see if I can get a proper core dump.

muglug commented 5 years ago

What do you see when you use latest master with debug flag turned on?

muglug commented 5 years ago

Also what extensions are enabled?

jaikdean commented 5 years ago

I'm on macOs 10.14.4 with PHP 7.3.5 installed via Homebrew.

$ php -v
PHP 7.3.5 (cli) (built: May  2 2019 12:40:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies

$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
ldap
libxml
mbstring
mongodb
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

I've tried with the latest Psalm master branch and still see the issue. I've included a dump of a run with --debug enabled.

$ ./vendor/bin/psalm --show-info=false --threads=2 --debug --no-cache
Registering autoloaded files
Parsing /*****/vendor/symfony/polyfill-ctype/bootstrap.php
Deep scanning /*****/vendor/symfony/polyfill-ctype/bootstrap.php
Parsing /*****/vendor/symfony/phpunit-bridge/bootstrap.php
Deep scanning /*****/vendor/symfony/phpunit-bridge/bootstrap.php
Parsing /*****/vendor/symfony/var-dumper/Resources/functions/dump.php
Deep scanning /*****/vendor/symfony/var-dumper/Resources/functions/dump.php
Parsing /*****/vendor/amphp/amp/lib/functions.php
Deep scanning /*****/vendor/amphp/amp/lib/functions.php
Parsing /*****/vendor/amphp/amp/lib/Internal/functions.php
Deep scanning /*****/vendor/amphp/amp/lib/Internal/functions.php
Parsing /*****/vendor/amphp/byte-stream/lib/functions.php
Deep scanning /*****/vendor/amphp/byte-stream/lib/functions.php
Parsing /*****/vendor/ralouphie/getallheaders/src/getallheaders.php
Deep scanning /*****/vendor/ralouphie/getallheaders/src/getallheaders.php
Parsing /*****/vendor/guzzlehttp/psr7/src/functions_include.php
Deep scanning /*****/vendor/guzzlehttp/psr7/src/functions_include.php
Parsing /*****/vendor/guzzlehttp/promises/src/functions_include.php
Deep scanning /*****/vendor/guzzlehttp/promises/src/functions_include.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/functions_include.php
Deep scanning /*****/vendor/guzzlehttp/guzzle/src/functions_include.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/normalize_server.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/normalize_server.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php
Deep scanning /*****/vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php
Parsing /*****/vendor/clue/stream-filter/src/functions_include.php
Deep scanning /*****/vendor/clue/stream-filter/src/functions_include.php
Parsing /*****/vendor/php-http/message/src/filters.php
Deep scanning /*****/vendor/php-http/message/src/filters.php
Parsing /*****/vendor/mtdowling/jmespath.php/src/JmesPath.php
Deep scanning /*****/vendor/mtdowling/jmespath.php/src/JmesPath.php
Parsing /*****/vendor/symfony/polyfill-intl-idn/bootstrap.php
Deep scanning /*****/vendor/symfony/polyfill-intl-idn/bootstrap.php
Parsing /*****/vendor/aws/aws-sdk-php/src/functions.php
Deep scanning /*****/vendor/aws/aws-sdk-php/src/functions.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/swift_required.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/swift_required.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/functions.php
Deep scanning /*****/vendor/beberlei/assert/lib/Assert/functions.php
Parsing /*****/vendor/paragonie/sodium_compat/autoload.php
Deep scanning /*****/vendor/paragonie/sodium_compat/autoload.php
Parsing /*****/vendor/sonata-project/block-bundle/src/Resources/stubs/symfony2.php
Deep scanning /*****/vendor/sonata-project/block-bundle/src/Resources/stubs/symfony2.php
Parsing /*****/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php
Deep scanning /*****/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php
Parsing /*****/vendor/league/csv/src/functions_include.php
Deep scanning /*****/vendor/league/csv/src/functions_include.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/Mixpanel.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/Mixpanel.php
Parsing /*****/vendor/guzzlehttp/psr7/src/functions.php
Deep scanning /*****/vendor/guzzlehttp/psr7/src/functions.php
Parsing /*****/vendor/guzzlehttp/promises/src/functions.php
Deep scanning /*****/vendor/guzzlehttp/promises/src/functions.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/functions.php
Deep scanning /*****/vendor/guzzlehttp/guzzle/src/functions.php
Parsing /*****/vendor/clue/stream-filter/src/functions.php
Deep scanning /*****/vendor/clue/stream-filter/src/functions.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/message_deps.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/message_deps.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/preferences.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/preferences.php
Parsing /*****/vendor/paragonie/sodium_compat/src/SodiumException.php
Deep scanning /*****/vendor/paragonie/sodium_compat/src/SodiumException.php
Parsing /*****/vendor/paragonie/sodium_compat/lib/namespaced.php
Deep scanning /*****/vendor/paragonie/sodium_compat/lib/namespaced.php
Parsing /*****/vendor/paragonie/sodium_compat/lib/sodium_compat.php
Deep scanning /*****/vendor/paragonie/sodium_compat/lib/sodium_compat.php
Parsing /*****/vendor/paragonie/sodium_compat/lib/php72compat.php
Deep scanning /*****/vendor/paragonie/sodium_compat/lib/php72compat.php
Parsing /*****/vendor/league/csv/src/functions.php
Deep scanning /*****/vendor/league/csv/src/functions.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/Base/MixpanelBase.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/Base/MixpanelBase.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelPeople.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelPeople.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelEvents.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelEvents.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/mime_types.php
Deep scanning /*****/vendor/swiftmailer/swiftmailer/lib/mime_types.php
Parsing /*****/vendor/paragonie/sodium_compat/lib/constants.php
Deep scanning /*****/vendor/paragonie/sodium_compat/lib/constants.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelBaseProducer.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/Producers/MixpanelBaseProducer.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/CurlConsumer.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/CurlConsumer.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/FileConsumer.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/FileConsumer.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/SocketConsumer.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/SocketConsumer.php
Parsing /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/AbstractConsumer.php
Deep scanning /*****/vendor/mixpanel/mixpanel-php/lib/ConsumerStrategies/AbstractConsumer.php
Using composer to locate file for Symfony\Bridge\PhpUnit\DeprecationErrorHandler
Using composer to locate file for Doctrine\Common\Annotations\AnnotationRegistry
Using composer to locate file for Symfony\Component\VarDumper\VarDumper
Using composer to locate file for Amp\Promise
Using reflection to get metadata for Closure
Using reflection to get metadata for Throwable
Using composer to locate file for Amp\Failure
Using reflection to get metadata for Generator
Using composer to locate file for Amp\Coroutine
Using reflection to locate file for React\Promise\PromiseInterface
Using composer to locate file for Amp\Success
Using composer to locate file for Amp\Loop
Using reflection to get metadata for Error
Using composer to locate file for Amp\Deferred
Using composer to locate file for Amp\TimeoutException
Using reflection to get metadata for Countable
Using composer to locate file for Amp\MultiReasonException
Using composer to locate file for Amp\Iterator
Using reflection to get metadata for Traversable
Using composer to locate file for Amp\Producer
Using composer to locate file for Amp\Delayed
Using composer to locate file for Amp\Emitter
Using reflection to get metadata for TypeError
Using composer to locate file for Amp\ByteStream\InputStream
Using composer to locate file for Amp\ByteStream\OutputStream
Using composer to locate file for Amp\ByteStream\ResourceInputStream
Using composer to locate file for Amp\ByteStream\ResourceOutputStream
Using composer to locate file for Zend\Diactoros\UploadedFile
Using reflection to get metadata for InvalidArgumentException
Using reflection to get metadata for ArrayObject
Using reflection to get metadata for UnexpectedValueException
Using composer to locate file for Zend\Diactoros\Uri
Using composer to locate file for Psr\Http\Message\UploadedFileInterface
Using composer to locate file for JmesPath\Env
Using composer to locate file for GuzzleHttp\ClientInterface
Using composer to locate file for Aws\Handler\GuzzleV5\GuzzleHandler
Using composer to locate file for Aws\Handler\GuzzleV6\GuzzleHandler
Using reflection to get metadata for RuntimeException
Using composer to locate file for GuzzleHttp\Client
Using composer to locate file for Aws\CommandInterface
Using composer to locate file for Psr\Http\Message\RequestInterface
Using composer to locate file for GuzzleHttp\Promise\FulfilledPromise
Using composer to locate file for Aws\Result
Using composer to locate file for Assert\AssertionChain
Using composer to locate file for Assert\Assert
Using composer to locate file for Assert\LazyAssertion
Using reflection to locate file for MixpanelPeople
Using composer to locate file for Psr\Http\Message\MessageInterface
Using composer to locate file for Psr\Http\Message\ResponseInterface
Using composer to locate file for Psr\Http\Message\UriInterface
Using composer to locate file for GuzzleHttp\Psr7\Uri
Using composer to locate file for Psr\Http\Message\StreamInterface
Using reflection to get metadata for Iterator
Using composer to locate file for GuzzleHttp\Psr7\Stream
Using composer to locate file for GuzzleHttp\Psr7\PumpStream
Using composer to locate file for Psr\Http\Message\ServerRequestInterface
Using composer to locate file for GuzzleHttp\Psr7\ServerRequest
Using composer to locate file for GuzzleHttp\Psr7\Request
Using reflection to get metadata for HashContext
Using composer to locate file for GuzzleHttp\Psr7\Response
Using composer to locate file for GuzzleHttp\Psr7\Rfc7230
Using composer to locate file for GuzzleHttp\Promise\TaskQueueInterface
Using composer to locate file for GuzzleHttp\Promise\TaskQueue
Using composer to locate file for GuzzleHttp\Promise\PromiseInterface
Using composer to locate file for GuzzleHttp\Promise\Promise
Using reflection to get metadata for Exception
Using composer to locate file for GuzzleHttp\Promise\RejectedPromise
Using composer to locate file for GuzzleHttp\Promise\RejectionException
Using reflection to get metadata for ArrayIterator
Using composer to locate file for GuzzleHttp\Promise\AggregateException
Using composer to locate file for GuzzleHttp\Promise\EachPromise
Using composer to locate file for GuzzleHttp\Promise\Coroutine
Using composer to locate file for GuzzleHttp\UriTemplate
Using composer to locate file for GuzzleHttp\Handler\Proxy
Using composer to locate file for GuzzleHttp\Handler\CurlMultiHandler
Using composer to locate file for GuzzleHttp\Handler\CurlHandler
Using composer to locate file for GuzzleHttp\Handler\StreamHandler
Using reflection to locate file for Swift_DependencyContainer
Using reflection to locate file for Swift_Preferences
Using reflection to get metadata for SodiumException
Using reflection to locate file for ParagonIE_Sodium_Compat
Using reflection to locate file for Sodium\Error
Using reflection to locate file for Sodium\Exception
Using reflection to get metadata for ReflectionClass
Using composer to locate file for League\Csv\ByteSequence
Using composer to locate file for League\Csv\Reader
Using composer to locate file for League\Csv\Statement
Parsing /*****/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php
Scanning /*****/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php
Parsing /*****/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
Scanning /*****/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
Parsing /*****/vendor/symfony/var-dumper/VarDumper.php
Scanning /*****/vendor/symfony/var-dumper/VarDumper.php
Parsing /*****/vendor/amphp/amp/lib/Promise.php
Scanning /*****/vendor/amphp/amp/lib/Promise.php
Parsing /*****/vendor/amphp/amp/lib/Failure.php
Scanning /*****/vendor/amphp/amp/lib/Failure.php
Parsing /*****/vendor/amphp/amp/lib/Coroutine.php
Scanning /*****/vendor/amphp/amp/lib/Coroutine.php
Parsing /*****/vendor/amphp/amp/lib/Success.php
Scanning /*****/vendor/amphp/amp/lib/Success.php
Parsing /*****/vendor/amphp/amp/lib/Loop.php
Scanning /*****/vendor/amphp/amp/lib/Loop.php
Parsing /*****/vendor/amphp/amp/lib/Deferred.php
Scanning /*****/vendor/amphp/amp/lib/Deferred.php
Parsing /*****/vendor/amphp/amp/lib/TimeoutException.php
Scanning /*****/vendor/amphp/amp/lib/TimeoutException.php
Parsing /*****/vendor/amphp/amp/lib/MultiReasonException.php
Scanning /*****/vendor/amphp/amp/lib/MultiReasonException.php
Parsing /*****/vendor/amphp/amp/lib/Iterator.php
Scanning /*****/vendor/amphp/amp/lib/Iterator.php
Parsing /*****/vendor/amphp/amp/lib/Producer.php
Scanning /*****/vendor/amphp/amp/lib/Producer.php
Parsing /*****/vendor/amphp/amp/lib/Delayed.php
Scanning /*****/vendor/amphp/amp/lib/Delayed.php
Parsing /*****/vendor/amphp/amp/lib/Emitter.php
Scanning /*****/vendor/amphp/amp/lib/Emitter.php
Parsing /*****/vendor/amphp/byte-stream/lib/InputStream.php
Scanning /*****/vendor/amphp/byte-stream/lib/InputStream.php
Parsing /*****/vendor/amphp/byte-stream/lib/OutputStream.php
Scanning /*****/vendor/amphp/byte-stream/lib/OutputStream.php
Parsing /*****/vendor/amphp/byte-stream/lib/ResourceInputStream.php
Scanning /*****/vendor/amphp/byte-stream/lib/ResourceInputStream.php
Parsing /*****/vendor/amphp/byte-stream/lib/ResourceOutputStream.php
Scanning /*****/vendor/amphp/byte-stream/lib/ResourceOutputStream.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/UploadedFile.php
Scanning /*****/vendor/zendframework/zend-diactoros/src/UploadedFile.php
Parsing /*****/vendor/zendframework/zend-diactoros/src/Uri.php
Scanning /*****/vendor/zendframework/zend-diactoros/src/Uri.php
Parsing /*****/vendor/psr/http-message/src/UploadedFileInterface.php
Scanning /*****/vendor/psr/http-message/src/UploadedFileInterface.php
Parsing /*****/vendor/mtdowling/jmespath.php/src/Env.php
Scanning /*****/vendor/mtdowling/jmespath.php/src/Env.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/ClientInterface.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/ClientInterface.php
Parsing /*****/vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleHandler.php
Scanning /*****/vendor/aws/aws-sdk-php/src/Handler/GuzzleV5/GuzzleHandler.php
Parsing /*****/vendor/aws/aws-sdk-php/src/Handler/GuzzleV6/GuzzleHandler.php
Scanning /*****/vendor/aws/aws-sdk-php/src/Handler/GuzzleV6/GuzzleHandler.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Client.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Client.php
Parsing /*****/vendor/aws/aws-sdk-php/src/CommandInterface.php
Scanning /*****/vendor/aws/aws-sdk-php/src/CommandInterface.php
Parsing /*****/vendor/psr/http-message/src/RequestInterface.php
Scanning /*****/vendor/psr/http-message/src/RequestInterface.php
Parsing /*****/vendor/guzzlehttp/promises/src/FulfilledPromise.php
Scanning /*****/vendor/guzzlehttp/promises/src/FulfilledPromise.php
Parsing /*****/vendor/aws/aws-sdk-php/src/Result.php
Scanning /*****/vendor/aws/aws-sdk-php/src/Result.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/AssertionChain.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/AssertionChain.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/Assert.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/Assert.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/LazyAssertion.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/LazyAssertion.php
Parsing /*****/vendor/psr/http-message/src/MessageInterface.php
Scanning /*****/vendor/psr/http-message/src/MessageInterface.php
Parsing /*****/vendor/psr/http-message/src/ResponseInterface.php
Scanning /*****/vendor/psr/http-message/src/ResponseInterface.php
Parsing /*****/vendor/psr/http-message/src/UriInterface.php
Scanning /*****/vendor/psr/http-message/src/UriInterface.php
Parsing /*****/vendor/guzzlehttp/psr7/src/Uri.php
Scanning /*****/vendor/guzzlehttp/psr7/src/Uri.php
Parsing /*****/vendor/psr/http-message/src/StreamInterface.php
Scanning /*****/vendor/psr/http-message/src/StreamInterface.php
Parsing /*****/vendor/guzzlehttp/psr7/src/Stream.php
Scanning /*****/vendor/guzzlehttp/psr7/src/Stream.php
Parsing /*****/vendor/guzzlehttp/psr7/src/PumpStream.php
Scanning /*****/vendor/guzzlehttp/psr7/src/PumpStream.php
Parsing /*****/vendor/psr/http-message/src/ServerRequestInterface.php
Scanning /*****/vendor/psr/http-message/src/ServerRequestInterface.php
Parsing /*****/vendor/guzzlehttp/psr7/src/ServerRequest.php
Scanning /*****/vendor/guzzlehttp/psr7/src/ServerRequest.php
Parsing /*****/vendor/guzzlehttp/psr7/src/Request.php
Scanning /*****/vendor/guzzlehttp/psr7/src/Request.php
Parsing /*****/vendor/guzzlehttp/psr7/src/Response.php
Scanning /*****/vendor/guzzlehttp/psr7/src/Response.php
Parsing /*****/vendor/guzzlehttp/psr7/src/Rfc7230.php
Scanning /*****/vendor/guzzlehttp/psr7/src/Rfc7230.php
Parsing /*****/vendor/guzzlehttp/promises/src/TaskQueueInterface.php
Scanning /*****/vendor/guzzlehttp/promises/src/TaskQueueInterface.php
Parsing /*****/vendor/guzzlehttp/promises/src/TaskQueue.php
Scanning /*****/vendor/guzzlehttp/promises/src/TaskQueue.php
Parsing /*****/vendor/guzzlehttp/promises/src/PromiseInterface.php
Scanning /*****/vendor/guzzlehttp/promises/src/PromiseInterface.php
Parsing /*****/vendor/guzzlehttp/promises/src/Promise.php
Scanning /*****/vendor/guzzlehttp/promises/src/Promise.php
Parsing /*****/vendor/guzzlehttp/promises/src/RejectedPromise.php
Scanning /*****/vendor/guzzlehttp/promises/src/RejectedPromise.php
Parsing /*****/vendor/guzzlehttp/promises/src/RejectionException.php
Scanning /*****/vendor/guzzlehttp/promises/src/RejectionException.php
Parsing /*****/vendor/guzzlehttp/promises/src/AggregateException.php
Scanning /*****/vendor/guzzlehttp/promises/src/AggregateException.php
Parsing /*****/vendor/guzzlehttp/promises/src/EachPromise.php
Scanning /*****/vendor/guzzlehttp/promises/src/EachPromise.php
Parsing /*****/vendor/guzzlehttp/promises/src/Coroutine.php
Scanning /*****/vendor/guzzlehttp/promises/src/Coroutine.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/UriTemplate.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/UriTemplate.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php
Scanning /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php
Parsing /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php
Scanning /*****/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php
Parsing /*****/vendor/paragonie/sodium_compat/src/Compat.php
Scanning /*****/vendor/paragonie/sodium_compat/src/Compat.php
Parsing /*****/vendor/league/csv/src/ByteSequence.php
Scanning /*****/vendor/league/csv/src/ByteSequence.php
Parsing /*****/vendor/league/csv/src/Reader.php
Scanning /*****/vendor/league/csv/src/Reader.php
Parsing /*****/vendor/league/csv/src/Statement.php
Scanning /*****/vendor/league/csv/src/Statement.php
Using reflection to get metadata for ReflectionMethod
Using reflection to get metadata for ReflectionProperty
Using reflection to get metadata for ReflectionClassConstant
Using reflection to get metadata for ReflectionExtension
Using composer to locate file for Amp\Internal\Placeholder
Using composer to locate file for Amp\Loop\Driver
Using composer to locate file for Amp\Loop\DriverFactory
Using composer to locate file for Amp\CallableMaker
Using composer to locate file for Amp\Internal\Producer
Using reflection to get metadata for SplQueue
Using reflection to locate file for GuzzleHttp\Message\ResponseInterface
Using reflection to get metadata for ArrayAccess
Using reflection to get metadata for IteratorAggregate
Using composer to locate file for Aws\HandlerList
Using composer to locate file for Aws\ResultInterface
Using composer to locate file for Aws\MonitoringEventsInterface
Using composer to locate file for Aws\HasDataTrait
Using composer to locate file for Aws\HasMonitoringEventsTrait
Using composer to locate file for Assert\Assertion
Using composer to locate file for Assert\LazyAssertionException
Using composer to locate file for GuzzleHttp\Psr7\BufferStream
Using composer to locate file for GuzzleHttp\Psr7\MessageTrait
Using composer to locate file for GuzzleHttp\Promise\PromisorInterface
Using composer to locate file for GuzzleHttp\Handler\CurlFactoryInterface
Using composer to locate file for League\Csv\AbstractCsv
Using reflection to get metadata for JsonSerializable
Using reflection to locate file for League\Csv\Generator
Using composer to locate file for League\Csv\ResultSet
Using reflection to get metadata for CallbackFilterIterator
Parsing /*****/vendor/amphp/amp/lib/Internal/Placeholder.php
Scanning /*****/vendor/amphp/amp/lib/Internal/Placeholder.php
Parsing /*****/vendor/amphp/amp/lib/Loop/Driver.php
Scanning /*****/vendor/amphp/amp/lib/Loop/Driver.php
Parsing /*****/vendor/amphp/amp/lib/Loop/DriverFactory.php
Scanning /*****/vendor/amphp/amp/lib/Loop/DriverFactory.php
Parsing /*****/vendor/amphp/amp/lib/CallableMaker.php
Scanning /*****/vendor/amphp/amp/lib/CallableMaker.php
Parsing /*****/vendor/amphp/amp/lib/Internal/Producer.php
Scanning /*****/vendor/amphp/amp/lib/Internal/Producer.php
Parsing /*****/vendor/aws/aws-sdk-php/src/HandlerList.php
Scanning /*****/vendor/aws/aws-sdk-php/src/HandlerList.php
Parsing /*****/vendor/aws/aws-sdk-php/src/ResultInterface.php
Scanning /*****/vendor/aws/aws-sdk-php/src/ResultInterface.php
Parsing /*****/vendor/aws/aws-sdk-php/src/MonitoringEventsInterface.php
Scanning /*****/vendor/aws/aws-sdk-php/src/MonitoringEventsInterface.php
Parsing /*****/vendor/aws/aws-sdk-php/src/HasDataTrait.php
Scanning /*****/vendor/aws/aws-sdk-php/src/HasDataTrait.php
Parsing /*****/vendor/aws/aws-sdk-php/src/HasMonitoringEventsTrait.php
Scanning /*****/vendor/aws/aws-sdk-php/src/HasMonitoringEventsTrait.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/Assertion.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/Assertion.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/LazyAssertionException.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/LazyAssertionException.php
Parsing /*****/vendor/guzzlehttp/psr7/src/BufferStream.php
Scanning /*****/vendor/guzzlehttp/psr7/src/BufferStream.php
Parsing /*****/vendor/guzzlehttp/psr7/src/MessageTrait.php
Scanning /*****/vendor/guzzlehttp/psr7/src/MessageTrait.php
Parsing /*****/vendor/guzzlehttp/promises/src/PromisorInterface.php
Scanning /*****/vendor/guzzlehttp/promises/src/PromisorInterface.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php
Parsing /*****/vendor/league/csv/src/AbstractCsv.php
Scanning /*****/vendor/league/csv/src/AbstractCsv.php
Parsing /*****/vendor/league/csv/src/ResultSet.php
Scanning /*****/vendor/league/csv/src/ResultSet.php
Using reflection to get metadata for ReflectionParameter
Using reflection to get metadata for ReflectionType
Using reflection to get metadata for ReflectionFunction
Using composer to locate file for Amp\Internal\ResolutionQueue
Using composer to locate file for Amp\Loop\Watcher
Using reflection to locate file for Assert\Countable
Using reflection to locate file for Assert\ResourceBundle
Using reflection to locate file for Assert\SimpleXMLElement
Using composer to locate file for Assert\InvalidArgumentException
Using reflection to get metadata for ResourceBundle
Using reflection to get metadata for SimpleXMLElement
Using composer to locate file for GuzzleHttp\Handler\EasyHandle
Using reflection to get metadata for SplFileObject
Using composer to locate file for League\Csv\Stream
Parsing /*****/vendor/amphp/amp/lib/Internal/ResolutionQueue.php
Scanning /*****/vendor/amphp/amp/lib/Internal/ResolutionQueue.php
Parsing /*****/vendor/amphp/amp/lib/Loop/Watcher.php
Scanning /*****/vendor/amphp/amp/lib/Loop/Watcher.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/InvalidArgumentException.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/InvalidArgumentException.php
Parsing /*****/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
Scanning /*****/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
Parsing /*****/vendor/league/csv/src/Stream.php
Scanning /*****/vendor/league/csv/src/Stream.php
Using reflection to get metadata for ReflectionFunctionAbstract
Using reflection to get metadata for SplFileInfo
Using reflection to get metadata for RecursiveIterator
Using composer to locate file for Amp\Struct
Using composer to locate file for Assert\AssertionFailedException
Using reflection to get metadata for SeekableIterator
Parsing /*****/vendor/amphp/amp/lib/Struct.php
Scanning /*****/vendor/amphp/amp/lib/Struct.php
Parsing /*****/vendor/beberlei/assert/lib/Assert/AssertionFailedException.php
Scanning /*****/vendor/beberlei/assert/lib/Assert/AssertionFailedException.php
Finished registering autoloaded files
Visiting autoload files took 1.060s
Scanning files...
Forking process for scanning
Initialising forked process for scanning
Initialising forked process for scanning
Have initialised forked process for scanning
Have initialised forked process for scanning
Child terminated without returning a serialized array - response type=boolean
Child terminated without returning a serialized array - response type=boolean
Child terminated with return code 0 and signal 11
Child terminated with return code 0 and signal 11
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php on line 452 and defined in /*****/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:173
Stack trace:
#0 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(452): Psalm\IssueBuffer::addIssues(NULL)
#1 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(329): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /*****/vendor/vimeo/psalm/src/Psalm/Codebase.php(385): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(414): Psalm\Codebase->scanFiles(2)
#4 /*****/vendor/vimeo/psalm/ in /*****/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 173

Fatal error: Uncaught TypeError: Argument 1 passed to Psalm\IssueBuffer::addIssues() must be of the type array, null given, called in /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php on line 452 and defined in /*****/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php:173
Stack trace:
#0 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(452): Psalm\IssueBuffer::addIssues(NULL)
#1 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Scanner.php(329): Psalm\Internal\Codebase\Scanner->scanFilePaths(2)
#2 /*****/vendor/vimeo/psalm/src/Psalm/Codebase.php(385): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 2)
#3 /*****/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(414): Psalm\Codebase->scanFiles(2)
#4 /*****/vendor/vimeo/psalm/ in /*****/vendor/vimeo/psalm/src/Psalm/IssueBuffer.php on line 173
andrew-demb commented 5 years ago

@muglug error log triggered, error flag toggled, but return type doesn't match specified in phpdoc

https://github.com/vimeo/psalm/blob/d7ee952084e84416004a86b1bf6f9749b15ee270/src/Psalm/Internal/Fork/Pool.php#L225-L249

muglug commented 5 years ago

@jaikdean I'm sorry this is happening - would you be able to add some var_dumps in Scanner::scanFile to try to narrow down where the segfault is happening?

@andrew-demb are you getting a crash too? Or are you just looking at the code?

ylixir commented 5 years ago

I don't have the bandwidth fiddle with master today. I will turn multithreading on in circle-ci and see if I can reproduce in Linux while i'm working today. If so I'll give you the name of the docker image we are using.

Here are my modules. It's a very slightly shorter list:

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
andrew-demb commented 5 years ago

@andrew-demb are you getting a crash too? Or are you just looking at the code? Just looking.

I met similar errors (not sure about core dumps) about two months ago and just not using threads. Now I cannot reproduce a problem in my projects.

jaikdean commented 5 years ago

After much digging, I've tracked this down to an issue with PHP 7.3's PCRE2 and appears to be related to this issue with Homebrew's installation of PHP, with some more detail here.

Setting pcre.jit=0 in php.ini resolves the problem for now.

muglug commented 5 years ago

After much digging, I've tracked this down to an issue with PHP 7.3's PCRE2 and appears to be related to this issue with Homebrew's installation of PHP, with some more detail here.

Thanks!

Psalm now prevents threaded execution if pcre.jit=1 is detected on macs running PHP >7.3.

albert200000 commented 2 years ago

Had the same issue on Linux with php 7.4

orklah commented 2 years ago

Please create a new issue with your exact error message