spatie / laravel-backup

A package to backup your Laravel app
https://spatie.be/docs/laravel-backup
MIT License
5.68k stars 762 forks source link

ZipArchive::close(): Write error: No space left on device on scheduled backups only #644

Closed dvlpp closed 6 years ago

dvlpp commented 6 years ago

I'm feeling sorry to post this here, since I think this is not a Laravel Backup bug, but I tried all other ways I can think of without any success and I'm hoping that someone saw this before.

Here's the issue: since a few days (after months without trouble), backups are failing when building the ZIP with a "no space left" message. But there is space left on the disk (9Go, backup are ~1.4Go), and I'm not running out of inodes.

One odd thing is that only scheduled backups are failing: no issue when I launch it manually...

I'm using the 5.4.1 package version, on Ubuntu 16.04.1 LTS.

Here the beginning of the exception stack:

ZipArchive::close(): Write error: No space left on device

#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'ZipArchive::clo...', '/home/forge/amb...', 82, Array) 
#1 [path]/vendor/spatie/laravel-backup/src/Tasks/Backup/Zip.php(82): ZipArchive->close() 
#2 [path]/vendor/spatie/laravel-backup/src/Tasks/Backup/Zip.php(29): Spatie\Backup\Tasks\Backup\Zip->close()

Does someone has any clue on what's going on?

Thanks for this package, and for many other.

dvlpp commented 6 years ago

I'm still struggling with this. 2 nights ago, for the first time since this issue came up suddenly (8 days ago) the backup succeeded. But failed the night after. I know this has to do with some server configuration in relation with the package, but I can't found where... Nobody saw this before?

Thanks again.

kapersoft commented 6 years ago

What files do you backup? I had problems with zipping files that were in use by the system. Try excluding directories one-by-one to pinpoint which set of files cannot be zipped.

freekmurze commented 6 years ago

Closing due to inactivity.

bahamagician commented 5 years ago

I'm now having this exact same issue. @dvlpp did you ever figure out what was going on?

bahamagician commented 5 years ago

Here's the stack trace I'm getting:

Exception trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'ZipArchive::clo...', '/home/forge/hea...', 82, Array) #1 /home/forge/heatwave242.com/vendor/spatie/laravel-backup/src/Tasks/Backup/Zip.php(82): ZipArchive->close() #2 /home/forge/heatwave242.com/vendor/spatie/laravel-backup/src/Tasks/Backup/Zip.php(29): Spatie\Backup\Tasks\Backup\Zip->close() #3 /home/forge/heatwave242.com/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(191): Spatie\Backup\Tasks\Backup\Zip::createForManifest(Object(Spatie\Backup\Tasks\Backup\Manifest), '/home/forge/hea...') #4 /home/forge/heatwave242.com/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(135): Spatie\Backup\Tasks\Backup\BackupJob->createZipContainingEveryFileInManifest(Object(Spatie\Backup\Tasks\Backup\Manifest)) #5 /home/forge/heatwave242.com/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(49): Spatie\Backup\Tasks\Backup\BackupJob->run() #6 [internal function]: Spatie\Backup\Commands\BackupCommand->handle() #7 /home/forge/heatwave242.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) #8 /home/forge/heatwave242.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container{closure}() #9 /home/forge/heatwave242.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #10 /home/forge/heatwave242.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #11 /home/forge/heatwave242.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array) #12 /home/forge/heatwave242.com/vendor/symfony/console/Command/Command.php(264): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #13 /home/forge/heatwave242.com/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)) #14 /home/forge/heatwave242.com/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)) #15 /home/forge/heatwave242.com/vendor/symfony/console/Application.php(869): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /home/forge/heatwave242.com/vendor/symfony/console/Application.php(223): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\BackupCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /home/forge/heatwave242.com/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #18 /home/forge/heatwave242.com/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)) #19 /home/forge/heatwave242.com/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #20 {main}
dvlpp commented 5 years ago

@bahamagician I changed the server, no idea what was going on... Sorry!

ligne13 commented 4 years ago

Hi, I'm having the same issue. There IS space left on my server, so I do not understand this message and failure. Does anyone have an explanation ?

ligne13 commented 4 years ago

Same issue here. Again.

DmitryLanda commented 3 years ago

@ligne13 did you find the reason? I am getting same error and have no idea where it came from.. I have couple GB of space on my storage, but getting this issue reported

nathan-io commented 2 years ago

I experienced this also. It actually ate 100% of the disk space and took down a production server. It happened after the scheduled backup job ran for the first time.

Nearly all of the disk usage was coming from the backup storage folder, which contained several massive zip files. I was able to clean out the folder and reboot the server to get back online. Since then I've had the scheduled job disabled.

I think the issue is related to handling of the storage symlink in cases where the application name contains spaces.

Whenever possible I'll clone this server to try and replicate the issue.

iKlsR commented 7 months ago

@nathan-io Experienced a similar issue, did you replicate?

nathan-io commented 7 months ago

Unfortunately I never ended up working on this any further, and haven't tried this package in any recent projects.

If you're seeing this behavior and your APP_NAME contain any spaces, see if the issue persists after removing them clearing config cache.