PHP_CodeSniffer: PHP gRPC extension breaks use of `--parallel`
Describe the bug
A clear and concise description of what the bug is.
See https://github.com/grpc/grpc/issues/20250
To reproduce
Steps to reproduce the behavior:
- Add the grpc PHP extension
test=$(php -r "echo ini_get('grpc.enable_fork_support');")
echo "grpc.enable_fork_support: $test"
test=$(php -r "echo ini_get('grpc.poll_strategy');")
echo "grpc.poll_strategy: $test"
The defaults are
grpc.enable_fork_support = 0
grpc.poll_strategy =
- Run PHPCS using
--parallel=2. It will hang.
Expected behavior
It would be helpful if src/Runner.php would check if the extension exists and either
ini_set('grpc.enable_fork_support', true);
ini_set('grpc.poll_strategy', 'epoll1');
Or, if it detects that fork support is disabled, emit a warning and set --parallel=1.
Versions (please complete the following information)
| Operating System | [Docker wodby/drupal-php:8.3-dev-4.52.0] |
| PHP version | [8.3] |
| PHP_CodeSniffer version | [3.8.1] |
| Standard | [Drupal,DrupalPractice] |
| Install type | [Composer] |
Additional context
Add any other context about the problem here.
Related: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/10
Parent issue: https://github.com/wodby/drupal-php/issues/102
Please confirm:
- I have searched the issue list and am not opening a duplicate issue.
- I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
- I have verified the issue still exists in the
masterbranch of PHP_CodeSniffer.
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 18 (6 by maintainers)
I’ve installed the grpc extension via pecl on my mac machine (running PHP 8.1.25), and can confirm that when you run the phpcs with
paralleloption it stalls.So I went and checked what could be stalling so I played with verbosity flags, and
-vgave me:And stalled.
But running either with
-vvor-vvvworked. Not sure if those flags are maybe disregarding theparalleloption 🤷🏼♂️I certainly don’t expect PHPCS to fix gRPC, but given that you know this is causing users pain, I think a simple check and warning would be very kind and appreciated.
I’m so lucky to have stumbled across this issue. PHPCS started stalling out today for no reason I could think of, and it was only after digging through months of GitHub issues that I saw gRPC in the title of this one and the lightbulb clicked: I had installed gRPC as a requirement for an unrelated project.
I could have spent hours on this and possibly never resolved it at all without this discovery.
Those flags do indeed disregard the
paralleloption.