Closed mbomb007 closed 5 months ago
comment was moved into issue summary above
After trying a couple more things, I found that either removing --parallel
from the PHPCS command, or setting its value to 1
, will fix issue on the newer images. This also makes sense with the verbosity flags since, I assume, when verbose is enabled at a high level then sniffing cannot be parallelized.
My guess the difference is Alpine version and maybe phpcs depended on some packages that were missing or updated in 3.19. Could you try 4.52.0
where we added a few missing imagemagick-
packages
I tried just now and the newer stability tag didn't fix the problem.
The only dependencies PHPCS needs are:
"require": {
"php": ">=5.4.0",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*"
},
I found the cause of the issue. https://github.com/grpc/grpc/issues/20250#issuecomment-531321945
# Check php.ini values.
test=$(php -r "echo ini_get('pcre.jit');")
echo "pcre.jit: $test"
# Can PCRE JIT be disabled? PHPCS does this in its code.
test=$(php -r "ini_set('pcre.jit', false);echo ini_get('pcre.jit');")
echo "pcre.jit: $test"
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"
# Will it work if grpc values are set properly?
echo "grpc.enable_fork_support = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-grpc.ini
echo "grpc.poll_strategy = epoll1" >> /usr/local/etc/php/conf.d/docker-php-ext-grpc.ini
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"
pcre.jit: 1
pcre.jit:
grpc.enable_fork_support: 0
grpc.poll_strategy:
grpc.enable_fork_support: 1
grpc.poll_strategy: epoll1
From my tests, PHPCS should be able to disable pcre.jit
properly. So that part is fine.
If the gRPC extension is enabled, then these options must be set for parallel to work:
grpc.enable_fork_support = 1
grpc.poll_strategy = epoll1
They aren't set, though. The initial/default values are as follows, which causes the parallel execution to fail:
grpc.enable_fork_support = 0
grpc.poll_strategy =
Further explanation of why it causes it to fail is here.
Setting them to the necessary values from Bash prior to running PHPCS led the commands to succeed again.
Could these values be set in the Dockerfile, similar to what was done here?
While I have an issue open for PHPCS to hopefully set the ini values in its code, it would still be ideal if they could be set in the Dockerfile for this project (or wodby/php upstream) as well.
Hi, please try 4.53.0, it now has env vars to configure GRPC extension and updated default values (fork support and poll strategy) https://github.com/wodby/php/blob/master/8/templates/docker-php-ext-grpc.ini.tmpl
Yes, that fixed it. Thanks.
For some reason, using
wodby/drupal-php:8.2-dev-4.49.0
works, but images withwodby/drupal-php:8.2-dev-4.50.0
or newer cause PHPCS to hang, but only if PHPCS is run without verbose flag, or with the single-level verbosity-v
. If PHPCS is run with-vv
or-vvv
, PHPCS runs successfully. The same problem occurs if I use PHP 8.3 instead of 8.2 and use the newest image and stability tag.Further debugging revealed that this is because extra-verbose output means that sniffs cannot be run in parallel. Removing the
--parallel
option or setting--parallel=1
will also fix the hanging issue. Using a new image along with the--parallel
option greater than1
is what causes execution to hang.My goal is to be able to use 4.51.0 or higher, since PHP 8.3 support was added.
Debugging Details and Steps to Reproduce
Click to view
The PHPCS command: ```bash vendor/bin/phpcs -p -w --colors --parallel=2 --standard=custom_ruleset.xml --extensions=engine,inc,install,module,php,profile,test,theme,yaml,yml --ignore=*/features/* ../web/modules/custom ``` **custom_ruleset.xml** ```xmlDebugging Update & Workaround
After trying a couple more things, I found that either removing
--parallel
from the PHPCS command, or setting its value to1
, will fix issue on the newer images. This also makes sense with the verbosity flags since, I assume, when verbose is enabled at a high level then sniffing cannot be parallelized.So, this means that the newer images break parallel execution of sniffs for some reason. Removing the
--parallel
option isn't ideal, obviously, as this increases the execution time. So hopefully this information can point towards the cause of the issue and a fix to follow.