Laravel-backup: CleanUp - Call to a member function delete() on null

Created on 21 May 2017  路  3Comments  路  Source: spatie/laravel-backup

I sometime got this exception

production.CRITICAL: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function delete() on null in /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php:116
Stack trace:
#0 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(118): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->removeOldBackupsUntilUsingLessThanMaximumStorage(Object(Spatie\Backup\BackupDestination\BackupCollection))
#1 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(118): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->removeOldBackupsUntilUsingLessThanMaximumStorage(Object(Spatie\Backup\BackupDestination\BackupCollection))
#2 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(118): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->removeOldBackupsUntilUsingLessThanMaximumStorage(Object(Spatie\Backup\BackupDestination\BackupCollection))
#3 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(118): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->removeOldBackupsUntilUsingLessThanMaximumStorage(Object(Spatie\Backup\BackupDestination\BackupCollection))
#4 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(39): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->removeOldBackupsUntilUsingLessThanMaximumStorage(Object(Spatie\Backup\BackupDestination\BackupCollection))
#5 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(37): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->deleteOldBackups(Object(Spatie\Backup\BackupDestination\BackupCollection))
#6 /vendor/laravel/framework/src/Illuminate/Support/Collection.php(260): Spatie\Backup\Tasks\Cleanup\CleanupJob->Spatie\Backup\Tasks\Cleanup\{closure}(Object(Spatie\Backup\BackupDestination\BackupDestination), 0)
#7 /vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(47): Illuminate\Support\Collection->each(Object(Closure))
#8 /vendor/spatie/laravel-backup/src/Commands/CleanupCommand.php(31): Spatie\Backup\Tasks\Cleanup\CleanupJob-run()
#9 [internal function]: Spatie\Backup\Commands\CleanupCommand->handle()
#10 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#11 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#13 /vendor/laravel/framework/src/Illuminate/Container/Container.php(531): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#14 /vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#15 /vendor/symfony/console/Command/Command.php(264): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#16 /vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#17 /vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(22): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /vendor/symfony/console/Application.php(835): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /vendor/symfony/console/Application.php(200): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\CleanupCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /vendor/symfony/console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

It's references to this file.

I think this is because I have set up file expiration and versioning on my amazon s3. It gets already deleted file, but can't delete it twice.

Most helpful comment

Still getting these errors every 4 days...

All 3 comments

If this happens, you're really unlucky. The package will determine first which zips there are, then do a little processing and then delete the ones the have been selected for cleanup.

That processing part does not take long. But if in the meantime the zips are being deleted by another process you get this kind of errors.

That's my theory anyway.

Could you schedule the cleanup process in such a way that the timing doesn't conflict with other processes?

Hmm, ok, I'll move cleanup for 6 hours later after backup.

Thanks.

Still getting these errors every 4 days...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n0n0n0n0 picture n0n0n0n0  路  5Comments

shez1983 picture shez1983  路  3Comments

sunnyjayjay picture sunnyjayjay  路  4Comments

KHucks picture KHucks  路  3Comments

hedii picture hedii  路  5Comments