psalm: Fatal error when using threads
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.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (2 by maintainers)
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
inphp.ini
resolves the problem for now.@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