stefanzweifel / laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.
https://stefanzweifel.dev/posts/2023/06/15/introducing-laravel-backup-restore
MIT License
165 stars 15 forks source link

Backup restore timeout #54

Closed phadaphunk closed 10 months ago

phadaphunk commented 10 months ago

My backup is pretty huge and I have get a Illuminate\Process\Exceptions\ProcessTimedOutException since the Process used to restore doesn't seem to have a set timeout other than the default one. (after only 60 seconds)

Is it a known limitation or is there a way around that?

stefanzweifel commented 10 months ago

@phadaphunk Can you share a bit more about this issue?

A project at work also has a "huge" (2 GB) backup which I regularly restore on my local machine. That restore process takes ~10-15 minutes and I never ran into this issue.

We can disable the timeout completely by calling forever() in the DbImporter-class, but I don't know if this would solve your problem.

You could update your local installation like so.

https://github.com/stefanzweifel/laravel-backup-restore/blob/main/src/Databases/DbImporter.php#L37

-$process = Process::run($this->getImportCommand($dumpFile, $connection));
+$process = Process::forever()->run($this->getImportCommand($dumpFile, $connection));
stefanzweifel commented 10 months ago

I've prepared a fix in https://github.com/stefanzweifel/laravel-backup-restore/pull/55, but would like to know, if this would fix your issue, or if the problem lies somewhere else.

Mabye your database of choice itself has a problem importing the dump?

phadaphunk commented 10 months ago

@stefanzweifel I will let you know if the forever call fixes my issue.

phadaphunk commented 10 months ago

I started a recovery process. In the meantime, here are a few more details :

I feel this "should" fix it as there is a default timeout for Processes in Laravel. Or maybe the error is hiding another error, I will look into my container to see if I can add logs if it crashes again.

stefanzweifel commented 10 months ago

I've merge the PR and a new release has been created. Thanks again for reporting this.