phpstan: Under certain conditions in Bitbucket phpstan hangs indefinitely

Bug report

When a Bitbucket pipeline spawns another container and phpstan is run in this other container, it hangs indefinitely (I waited the maximum possible 30 minutes) unitl maximumNumberOfProcesses is set explicity.

I have tried to reproduce it locally, but my initial container seems to have more privileges than the Bitbucket one and the problem does not occur. If I had to guess, phpstan cannot determine that number on its own due to lack of privileges (I tried to run docker inspect on the current container and received an error:

+ docker inspect $(grep -m 1 cpuset /proc/self/cgroup | cut -d/ -f3)
[]
Error response from daemon: authorization denied by plugin pipelines:

this also suggests that Bitbucket has written their own plugin for docker, which might explain why I can’t reproduce it.

Code snippet that reproduces the problem

No response

Expected output

I can’t reproduce it.

Did PHPStan help you today? Did it make you happy in any way?

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

So the problem might be this library: https://github.com/theofidry/cpu-core-counter

This is how it’s used in PHPStan: https://github.com/phpstan/phpstan-src/blob/1.11.x/src/Process/CpuCoreCounter.php

Maybe we execute the library and in your BitBuckey pipeline it just hangs on something.

It’d be helpful if you wrote a simple script using this library and executed it in the image, to find out exactly what’s wrong.