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

occ groupfolders:expire command Throws exception #1724

Closed
redRolf opened this issue Nov 3, 2021 · 9 comments
Closed

occ groupfolders:expire command Throws exception #1724

redRolf opened this issue Nov 3, 2021 · 9 comments
Labels
4. to release Items that are ready for releasing bug

Comments

@redRolf
Copy link

redRolf commented Nov 3, 2021

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Run the command: occ groupfolders:expire
  2. Receive the following exception:
Expiring version in 'Finance'
An unhandled exception has been thrown:
TypeError: Unsupported operand types: int & array in /var/www/html/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php:43
Stack trace:
#0 /var/www/html/lib/private/Files/Cache/Wrapper/CacheWrapper.php(78): OC\Files\Cache\Wrapper\CachePermissionsMask->formatCacheEntry(Object(OC\Files\Cache\CacheEntry))
#1 /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php(170): OC\Files\Cache\Wrapper\CacheWrapper->get(1015836)
#2 [internal function]: OCA\GroupFolders\Versions\VersionsBackend->OCA\GroupFolders\Versions\{closure}(1015836)
#3 /var/www/html/custom_apps/groupfolders/lib/Versions/VersionsBackend.php(169): array_map(Object(Closure), Array)
#4 /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php(63): OCA\GroupFolders\Versions\VersionsBackend->getAllVersionedFiles(Array)
#5 /var/www/html/custom_apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php(57): OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder(Array)
#6 /var/www/html/custom_apps/groupfolders/lib/Command/ExpireGroupVersions.php(59): OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()
#7 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\GroupFolders\Command\ExpireGroupVersions->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\GroupFolders\Command\ExpireGroupVersions), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/console.php(99): OC\Console\Application->run()
#14 /var/www/html/occ(11): require_once('/var/www/html/c...')

Expected behaviour

  1. Correct handling of the exception
  2. Basic OCC commands to function without an error

Actual behaviour

Exception is thrown

Server configuration

Operating system: Docker image nextcloud:22.2.0-fpm Host system Ubuntu

Web server: NGINX

Database: PostgreSQL 13.4 on x86_64-pc-linux-musl

PHP version: 8.0.12

Nextcloud version: 22.2.0

Group folders version: 10.0.0

Updated from an older Nextcloud/ownCloud or fresh install: Docker, but upgraded from older versions

Where did you install Nextcloud from: Docker

Are you using external storage, if yes which one: Docker Volumes

Are you using encryption: no

Are you using an external user-backend, if yes which one: No

could be related to: nextcloud/server#25806

@redRolf redRolf added 0. Needs triage Issues that need to be triaged bug labels Nov 3, 2021
@CarlSchwan
Copy link
Member

This indeed seems to be caused by https://wiki.php.net/rfc/arithmetic_operator_type_checks, I'm still doing most of my dev work on PHP 7.4, maybe I should switch to PHP 8 and see if I can reproduce :)

@CarlSchwan
Copy link
Member

Hi,

Could you try changing $folder['groups'] to ``31 in

$mount = $this->mountProvider->getMount($folder['id'], '/dummyuser/files/' . $folder['mount_point'], $folder['groups'], $folder['quota']);
and report back if this works?

It seems like before we were passing an array instead of a value here and PHP8 now throw an error.

@CarlSchwan CarlSchwan added 2. developing Items that are currently under development and removed 0. Needs triage Issues that need to be triaged labels Nov 3, 2021
@redRolf
Copy link
Author

redRolf commented Nov 4, 2021

@CarlSchwan Good morning, after changing $folder['groups'] to 31 I am no longer able to reproduce the issue. The command occ groupfolders:expire completed successfully and I was able to recover about 120 GB of disk space 🤩

For completes the line 159 in groupfolders/lib/Versions/VersionsBackend.php now looks like this:

$mount = $this->mountProvider->getMount($folder['id'], '/dummyuser/files/' . $folder['mount_point'], 31, $folder['quota']);

@CarlSchwan
Copy link
Member

I created https://github.com/nextcloud/groupfolders/pull/1725/files with this fix and a bunch of additional type hinting so that this issue is less likely to happen again in the future :)

@redRolf
Copy link
Author

redRolf commented Nov 4, 2021

Cool 😎 thank you so much.

@CarlSchwan CarlSchwan added 4. to release Items that are ready for releasing and removed 2. developing Items that are currently under development labels Nov 4, 2021
@CarlSchwan
Copy link
Member

This was merged, I need to backport it to older versions and this should be available in the next nextcloud minor version :)

@redRolf
Copy link
Author

redRolf commented Nov 4, 2021

@CarlSchwan awesome work, thank you so much for awsome and very quick fix 🙏

@level420
Copy link

@CarlSchwan ist this fix already published in the nextcloud app store?

@level420
Copy link

@CarlSchwan I'd need the fix for nextcloud 22. Are there any plans to release version 10.0.x containing this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Items that are ready for releasing bug
Projects
None yet
Development

No branches or pull requests

3 participants