Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nette.configurator/Container_2f7bddb5fb.php.meta: Failed to open stream: No such file or directory #269

Closed
staabm opened this issue Oct 22, 2021 · 8 comments

Comments

@staabm
Copy link
Contributor

staabm commented Oct 22, 2021

Version: 3.0.5 (which is bundled within phpstan)

 php -v
PHP 8.0.10 (cli) (built: Aug 25 2021 08:46:14) ( NTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies
    with Xdebug v3.1.0, Copyright (c) 2002-2021, by Derick Rethans

running windows11x64, but have seen similar errors on windows10 before.

Bug Description

running phpstan 0.12.99 I am getting php warnings from time to time.

I am not 100% able to reproduce it every time.

the stacktrace is

file_get_conor/Container_2f7bddb5fb.php.meta): Failed to open stream: No such file or directory' (0)
> in C:\dvl\Workspace\fare\vendor\plugins\rocket\lib\Bootstrap.php:210
Stack trace:
#0 [internal function]: BootstrapKernel->{closure}()
#1 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(87): file_get_contents()
#2 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(48): _PHPStan_76800bfb5\Nette\DI\ContainerLoader->isExpired()
#3 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(34): _PHPStan_76800bfb5\Nette\DI\ContainerLoader->loadFile()
#4 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/Configurator.php(35): _PHPStan_76800bfb5\Nette\DI\ContainerLoader->load()
#5 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(160): PHPStan\DependencyInjection\Configurator->loadContainer()
#6 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php(68): _PHPStan_76800bfb5\Nette\Configurator->createContainer()
#7 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/DerivativeContainerFactory.php(51): PHPStan\DependencyInjection\ContainerFactory->create()
#8 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/PhpDoc/StubValidator.php(78): PHPStan\DependencyInjection\DerivativeContainerFactory->create()
#9 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(53): PHPStan\PhpDoc\StubValidator->validate()
#10 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php(157): PHPStan\Command\AnalyseApplication->analyse()
#11 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(228): PHPStan\Command\AnalyseCommand->execute()
#12 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856): _PHPStan_76800bfb5\Symfony\Component\Console\Command\Command->run()
#13 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(237): _PHPStan_76800bfb5\Symfony\Component\Console\Application->doRunCommand()
#14 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(138): _PHPStan_76800bfb5\Symfony\Component\Console\Application->doRun()
#15 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(82): _PHPStan_76800bfb5\Symfony\Component\Console\Application->run()
#16 phar://C:/dvl/Workspace/fare/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(83): _PHPStan_76800bfb5\{closure}()
#17 C:\dvl\Workspace\fare\vendor-bin\phpstan\vendor\phpstan\phpstan\phpstan(8): require('...')
#18 [main]

Steps To Reproduce

run phpstan on a project on a windows machine.

Expected Behavior

no warnings

Possible Solution

not sure whether the di-container is missing a is_file check before reading from disc?

@staabm staabm changed the title nette.configurator/Container_2f7bddb5fb.php.meta): Failed to open stream: No such file or directory nette.configurator/Container_2f7bddb5fb.php.meta: Failed to open stream: No such file or directory Oct 22, 2021
@staabm
Copy link
Contributor Author

staabm commented Oct 22, 2021

//cc @ondrejmirtes

@dg
Copy link
Member

dg commented Oct 22, 2021

I am getting php warnings from time to time.

If it's only occasionally, I would consider it a success on Windows :-)

@dg
Copy link
Member

dg commented Oct 26, 2021

I once solved some similar locking problem under Windows, but never actually found a satisfactory solution. It stayed with this experiment: https://github.com/nette/di/tree/lock-windows

@staabm
Copy link
Contributor Author

staabm commented Oct 26, 2021

could you elaborate why you think the reported issue is a locking problem?

@dg
Copy link
Member

dg commented Oct 26, 2021

I misunderstood. It's not about the locks. I'm looking at it now, and the line where the meta file is read has suppressed errors:

$meta = @unserialize((string) file_get_contents("$file.meta")); // @ - file may not exist

So no error can trigger there. If it does, it's a PHP (or opcache) error. So maybe disabling opcache will help.

@staabm
Copy link
Contributor Author

staabm commented Nov 4, 2021

just fyi, I see the initial reported problem also in linux based github actions

grafik

maybe the code should be changed to is_file beforehand?

@milo
Copy link
Member

milo commented Nov 4, 2021

It must not trigger error, when @ is used. I guess, some error handler, source of ParanoidErrorException, does not respect that.

@staabm
Copy link
Contributor Author

staabm commented Nov 5, 2021

good point. with your hint I was actually able to fix a problem in the error handling which made the @ errors not beeing silenced.

fixed a if (0 === error_reporting()) { with if (!(error_reporting() & $errno)) { and the error line now disappears.

@staabm staabm closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants