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

[10.x] Using the native mkdir exception in LockableFile.php #49942

Closed
wants to merge 2 commits into from

Conversation

eusonlito
Copy link
Contributor

Related with #49895

[2024-02-01T13:24:01+01:00] production.ERROR: fopen(/app/storage/framework/cache/data/e7/da/e7da1512baf3c3cf089e9ae9a65970e0b433ec82): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): fopen(/app/storage/framework/cache/data/e7/da/e7da1512baf3c3cf089e9ae9a65970e0b433ec82): Failed to open stream: No such file or directory at /app/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php:69)
[stacktrace]
#0 /app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'fopen(/app/stor...', '/app/vendor/lar...', 69)
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'fopen(/app/stor...', '/app/vendor/lar...', 69)
#2 /app/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php(69): fopen('/app/storage/fr...', 'c+')
#3 /app/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php(42): Illuminate\\Filesystem\\LockableFile->createResource('/app/storage/fr...', 'c+')
#4 /app/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php(108): Illuminate\\Filesystem\\LockableFile->__construct('/app/storage/fr...', 'c+')
#5 /app/vendor/laravel/framework/src/Illuminate/Cache/FileLock.php(14): Illuminate\\Cache\\FileStore->add('framework/sched...', 'SuAnmpSzBTNlmTR...', 5.5340232221129E+20)
#6 /app/vendor/laravel/framework/src/Illuminate/Cache/Lock.php(91): Illuminate\\Cache\\FileLock->acquire()
#7 /app/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheEventMutex.php(66): Illuminate\\Cache\\Lock->get(Object(Closure))
#8 /app/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php(713): Illuminate\\Console\\Scheduling\\CacheEventMutex->exists(Object(Illuminate\\Console\\Scheduling\\Event))
#9 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Console\\Scheduling\\Event->Illuminate\\Console\\Scheduling\\{closure}()
#10 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#11 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(81): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#12 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Object(Closure), Object(Closure))
#13 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Object(Closure), Array, NULL)
#14 /app/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php(419): Illuminate\\Container\\Container->call(Object(Closure))
#15 /app/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(122): Illuminate\\Console\\Scheduling\\Event->filtersPass(Object(Illuminate\\Foundation\\Application))
#16 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Console\\Scheduling\\ScheduleRunCommand->handle(Object(Illuminate\\Console\\Scheduling\\Schedule), Object(Illuminate\\Events\\Dispatcher), Object(Illuminate\\Cache\\Repository), Object(App\\Exceptions\\Handler))
#17 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#19 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#20 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#21 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call(Array)
#22 /app/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#23 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#24 /app/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#25 /app/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Console\\Scheduling\\ScheduleRunCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#26 /app/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#27 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#28 /app/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#29 {main}
"} 

Once the native file creation error is available, you may discover that the directory that should exist, does not exist.

By removing the error suppression on file creation we can drill down into the error.

The directory creation where the file is hosted should return an error in case of any problems, or the file cannot be created in the next step.

By checking the error at this point you will be able to find out what is the cause of not being able to create the lock file.

@taylorotwell
Copy link
Member

I dunno, feels like this introduces a race condition if multiple requests try to create the directory at roughly the same time.

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

Successfully merging this pull request may close these issues.

None yet

2 participants