During initial backup, paths are always null
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 272
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
I've just installed the app recently, and have been unable to take a backup so far.
I run the standard Nextcloud image inside a Docker container. I have both stages of the backup pointed to an NFS mount in the container. Double checked that the permissions are correct, but it's not even able to get to the point of actually storing anything.
It can't even read files because it keeps pulling up the path of whatever file it's trying to look at as null. This causes an error with one of the functions that is expecting a path string. I don't really know PHP so this has been difficult for me to try to debug, but I'm pretty sure it is deriving the user session as null in /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php. I added some logging to getPathForNode, and the $user and $owner variables both come up null. As a result, the function returns null, and that value is plugged into OC\Files\View->file_exists(), which is not expecting a null value. Full log:
An unhandled exception has been thrown:
TypeError: OC\Files\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528 and defined in /var/www/html/lib/private/Files/View.php:1128
Stack trace:
#0 /var/www/html/lib/private/Files/View.php(528): OC\Files\View->basicOperation('file_exists', NULL)
#1 /var/www/html/lib/private/Files/Filesystem.php(545): OC\Files\View->file_exists(NULL)
#2 /var/www/html/apps/files_versions/lib/Storage.php(189): OC\Files\Filesystem::file_exists(NULL)
#3 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(196): OCA\Files_Versions\Storage::store(NULL)
#4 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(102): OCA\Files_Versions\Listener\FileEventsListener->write_hook(Object(OC\Files\Node\File))
#5 /var/www/html/lib/private/EventDispatcher/ServiceEventListener.php(86): OCA\Files_Versions\Listener\FileEventsListener->handle(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#6 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(230): OC\EventDispatcher\ServiceEventListener->__invoke(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#7 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(59): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#8 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(94): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...')
#9 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(106): OC\EventDispatcher\EventDispatcher->dispatch('OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#10 /var/www/html/lib/private/Files/Node/HookConnector.php(100): OC\EventDispatcher\EventDispatcher->dispatchTyped(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#11 /var/www/html/lib/private/legacy/OC_Hook.php(105): OC\Files\Node\HookConnector->write(Array)
#12 /var/www/html/lib/private/Files/View.php(1270): OC_Hook::emit('OC_Filesystem', 'write', Array)
#13 /var/www/html/lib/private/Files/View.php(1144): OC\Files\View->runHooks(Array, '/backup/staging...')
#14 /var/www/html/lib/private/Files/View.php(680): OC\Files\View->basicOperation('file_put_conten...', '/adam/files/bac...', Array, '')
#15 /var/www/html/lib/private/Files/Node/Folder.php(188): OC\Files\View->file_put_contents('/adam/files/bac...', '')
#16 /var/www/html/lib/private/Files/SimpleFS/SimpleFolder.php(89): OC\Files\Node\Folder->newFile('.nobackup', '')
#17 /var/www/html/custom_apps/backup/lib/Service/PointService.php(796): OC\Files\SimpleFS\SimpleFolder->newFile('.nobackup', '')
#18 /var/www/html/custom_apps/backup/lib/Service/PointService.php(642): OCA\Backup\Service\PointService->initBackupFS()
#19 /var/www/html/custom_apps/backup/lib/Command/PointScan.php(129): OCA\Backup\Service\PointService->scanFoldersFromAppData()
#20 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OCA\Backup\Command\PointScan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Backup\Command\PointScan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/console.php(100): OC\Console\Application->run()
#27 /var/www/html/occ(11): require_once('/var/www/html/c...')
#28 {main}%
I'm kind of not sure where to go from there. I'm not sure where this user session is coming from, and I don't have experience debugging PHP. Some help would be immensely appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with custom_apps/backup/lib/Service/PointService.php, especially initBackupFS() and scanFoldersFromAppData(), then trace the BeforeNodeWrittenEvent into apps/files_versions/lib/Listener/FileEventsListener.php and getPathForNode. Use the supplied stack trace to reproduce the initial backup failure. Done means the backup path is no longer passed as null and the initial backup can proceed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100