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

Can't delete folders while the app is enabled #1068

Closed
giou opened this issue May 27, 2023 · 25 comments · Fixed by nextcloud/server#38625
Closed

Can't delete folders while the app is enabled #1068

giou opened this issue May 27, 2023 · 25 comments · Fixed by nextcloud/server#38625

Comments

@giou
Copy link

giou commented May 27, 2023

Edit by @paulijar: Read the summary below from #1068 (comment)

The original post:

Fixed disabling the Music app.

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'cloud.org',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://cloud.org/',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'default_phone_region' => '3166-2:ES',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpport' => '465',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'mail_smtpsecure' => 'ssl',
  'updater.secret' => '',
);
[webdav] Error: TypeError: OC\Files\Cache\QuerySearchHelper::getCachesAndMountPointsForSearch(): Argument #1 ($root) must be of type OC\Files\Node\Root, OC\Files\Node\LazyRoot given, called in /var/www/nextcloud/lib/private/Files/Node/Folder.php on line 237 at <<closure>>

 0. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 237
    OC\Files\Cache\QuerySearchHelper->getCachesAndMountPointsForSearch()
 1. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 291
    OC\Files\Node\Folder->search()
 2. /var/www/nextcloud/apps/music/lib/Utility/Scanner.php line 383
    OC\Files\Node\Folder->searchByMime()
 3. /var/www/nextcloud/apps/music/lib/Hooks/FileHooks.php line 42
    OCA\Music\Utility\Scanner->deleteFolder()
 4. <<closure>>
    OCA\Music\Hooks\FileHooks::deleted()
 5. /var/www/nextcloud/lib/private/Hooks/EmitterTrait.php line 105
    call_user_func_array()
 6. /var/www/nextcloud/lib/private/Hooks/PublicEmitter.php line 40
    OC\Hooks\BasicEmitter->emit()
 7. /var/www/nextcloud/lib/private/Files/Node/Root.php line 143
    OC\Hooks\PublicEmitter->emit()
 8. <<closure>>
    OC\Files\Node\Root->emit()
 9. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 72
    call_user_func_array()
10. /var/www/nextcloud/lib/private/Files/Node/LazyFolder.php line 100
    OC\Files\Node\LazyFolder->__call()
11. /var/www/nextcloud/lib/private/Files/Node/HookConnector.php line 145
    OC\Files\Node\LazyFolder->emit()
12. /var/www/nextcloud/lib/private/legacy/OC_Hook.php line 105
    OC\Files\Node\HookConnector->delete()
13. /var/www/nextcloud/lib/private/Files/View.php line 1295
    OC_Hook::emit()
14. /var/www/nextcloud/lib/private/Files/View.php line 1165
    OC\Files\View->runHooks()
15. /var/www/nextcloud/lib/private/Files/View.php line 351
    OC\Files\View->basicOperation()
16. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 307
    OC\Files\View->rmdir()
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\DAV\Connector\Sabre\Directory->delete()
18. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
19. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
20. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
21. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
22. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
23. /var/www/nextcloud/apps/dav/lib/Server.php line 366
    Sabre\DAV\Server->exec()
24. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
25. /var/www/nextcloud/remote.php line 172
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/files/giou/Obsidiane
from IP by giou at 2023-05-26T21:05:08+00:00
@rcjcarr
Copy link

rcjcarr commented May 27, 2023

@paulijar
Copy link
Collaborator

Looks like a Nextcloud bug to me and likely caused by this commit: nextcloud/server@dbfd2f9. Maybe @blizzz could comment?

In that commit, this new function assumes the first argument to be of type Root:
https://github.com/nextcloud/server/blob/dbfd2f936aaae95aabd52ac8de03b48a813bbb8f/lib/private/Files/Cache/QuerySearchHelper.php#L202

And it's called here by passing $this->root as the first argument:
https://github.com/nextcloud/server/blob/dbfd2f936aaae95aabd52ac8de03b48a813bbb8f/lib/private/Files/Node/Folder.php#L238

But $this->root is not guaranteed to be of the type Root. From the constructor argument list, we only know that it implements the interface IRootFolder and even that is not enforced by any type declaration:
https://github.com/nextcloud/server/blob/dbfd2f936aaae95aabd52ac8de03b48a813bbb8f/lib/private/Files/Node/Node.php#L69-L75

@paulijar
Copy link
Collaborator

As a quick-and-dirty monkey patch, you may modify the file lib/private/Files/Cache/QuerySearchHelper.php in your installation. Locate the line
public function getCachesAndMountPointsForSearch(Root $root, string $path, bool $limitToHome = false): array {
and modify it to be
public function getCachesAndMountPointsForSearch($root, string $path, bool $limitToHome = false): array {
i.e. remove the type declaration Root.

@blizzz
Copy link
Contributor

blizzz commented May 31, 2023

Thanks for the report and investigation, and pinging me. I'll try to have a look into it this week.

@AubinF
Copy link

AubinF commented Jun 2, 2023

Same issue here. Thanks @blizzz @paulijar for your responsiveness 💪
@paulijar 's quick and dirty patch works for me.

@JoshuaPettus
Copy link

Fun story, Just today I accidentally deleted a folder in the NC UI and it failed. Had no idea why but just shrugged it off and called it good luck. Now I stumbled on this!

@Kaliumhexacyanoferrat
Copy link

Can confirm disabling the music app allows to delete files in nextcloud once again.

@tryallthethings
Copy link

Can confirm this as well. Disabling the music app is a workaround.

@adripo
Copy link

adripo commented Jun 14, 2023

Same problem for me with Nextcloud 26.0.2. I had to disable the app. Please have a look at this issue as it is a production bug and should be fixed ASAP. Thanks

@JoshuaPettus
Copy link

JoshuaPettus commented Jun 14, 2023

Guys, read through the thread, it's a Nextcloud server issue that Music happens to be triggering. Blizzz has been working on a patch

@paulijar
Copy link
Collaborator

paulijar commented Jun 14, 2023

Yeah, so for those of you who don't "have time" to read the whole thread: There is a bug in Nextcloud versions 25.0.7, 26.0.2, and 27.0.0 which happens to trigger when the Music app reacts on the folder deletion. There may be other occasions too, but I'm not aware of those. There is already a PR fixing the issue but it's still waiting for some reviews before it can be merged. I hope this will be fixed in Nextcloud versions 25.0.8, 26.0.3, and 27.0.1.
Edit: The fix wasn't completed in time for 25.0.8 and 26.0.3, so it will be 25.0.9 and 26.0.4, instead.

Until then, your options are:

Commenting "me too" here doesn't help in the official fix to appear any sooner.

@JoshuaPettus
Copy link

JoshuaPettus commented Jun 14, 2023

4th option is to simply do your folder deletion on the desktop app instead of the web UI. That's the reason why I didn't notice all the way through NC25 and most of 26...

@adripo
Copy link

adripo commented Jun 16, 2023

@JoshuaPettus sorry for being abrupt and bothering you with my last message. I read the thread but didn't pay enough attention to understand that you were talking about an issue on the server. I was having different issues on my instance after the last update. For the moment I disabled Music app.

Also, thank you @paulijar for the summary

@meschg
Copy link

meschg commented Jun 18, 2023

Hello everyone,
just had the same issue on 27.0.0
I cloud not move or delete one folder and after disabling music 1.8.4 it work instantly.
This affected in browser and also the sync client. The folder was not allowed to sync and was reverted on the client.
Kind regards,

@blizzz
Copy link
Contributor

blizzz commented Jun 18, 2023

@meschg please please please read the thread before commenting. #1068 (comment)

@blizzz
Copy link
Contributor

blizzz commented Jun 18, 2023

I hope this will be fixed in Nextcloud version 25.0.8, 26.0.3, and 27.0.1. Until then, your options are:

Unfortunately it will be only 25.0.9 and 26.0.4 (and 27.0.1) :(

@gitdode
Copy link

gitdode commented Jun 25, 2023

Make an update - discover an issue - check the web - find an easy workaround - issue addressed already - release with fix coming up soon... great product & community!

@EpicJosch
Copy link

I have the same problem that i cant delete files/folders with music app enabled. Is this scheduled to be fixed in the next versions?

@paulijar
Copy link
Collaborator

paulijar commented Jul 4, 2023

@EpicJosch Please see #1068 (comment) for the summary and status of this issue. To add to that, the fix is now on track to be included in the next point releases of NC26 and NC27. NC25 apparently still needs some manual work, as the automatic backporting has failed.

@blizzz
Copy link
Contributor

blizzz commented Jul 4, 2023

Backports are at nextcloud/server#38976 and nextcloud/server#38977 and ready to review. That one for 25 will follow based on the 26 one once it is merged.

@cyberpower678
Copy link

I would comment "me too" but I did read this thread, and since I run on Docker, I was left with having to disable the music app for the time being. I can confirm this works around my problem, but look forward to the app being re-enabled soon.

@gitdode
Copy link

gitdode commented Jul 10, 2023

@cyberpower678 You could apply this workaround also in your container. Of course it won't survive a container recreation but that won't happen so frequently I guess?
I can confirm it works well for me as container.

@cyberpower678
Copy link

@cyberpower678 You could apply this workaround also in your container. Of course it won't survive a container recreation but that won't happen so frequently I guess?
I can confirm it works well for me as container.

You mean you don’t need to restart the web server? Actually now that I think about it, that wouldn’t make sense. But since the container does get redeployed more than I like, I’ll keep the app off.

@JoshuaPettus
Copy link

I can confirm it's working in 27.0.1

@paulijar
Copy link
Collaborator

As the problem has now been fixed by Nextcloud in all the affected versions (NC25, NC26, NC27), I'm closing this issue. Disclaimer: I didn't test the fixes myself, but I can see that the fix PR is included in each of the latest releases 25.0.9, 26.0.4, and 27.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.