-
Notifications
You must be signed in to change notification settings - Fork 87
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
Changed file IDs in Groupfolders #1468
Comments
@juliushaertl @icewind1991 Are the file ids meant to stay unchanged? If yes, this is a bug. If no there should be something in the docs that informs users about this. Personally I think it is a bug? What's your point of view? |
Yes, file ids should remain unchanged and I haven't encountered such a behavior until now. Please fill out the issue template and it would be especially interesting if there is any groupfolder related errors in the logs. Might also be worth to check if there was any suspicious action like a delete or move during the time this occured in the access logs of the webserver. |
Hi @juliushaertl there was nothing in the logs either about group folders or anything else. The problem faced by @gzoritchak has arrived at night, with little or no activity at all. After investigation, at the SQL dump from 3h26am (nightly backup) & production at 13h43 the same day, we could obseve an ID 2281 and an ID 6208 for the same file, exposing this ID increment, respectivelly (this is an example, all files were affected). There was nothing unusual in the webserver, database, php or nextcloud logs. Only things related to #1381 and #1472 essentially. |
@juliushaertl when we encountered this, there was a bulk file ownership change on the server. The file ownerships were adjusted to match the ones used by the Nextcloud Docker image. Some files were previously owned by the root user and group. |
Also experienced the same issue, we did a files:scan for manually imported files, and some file ids have changed in other group folders, maybe this has something to do with the ids changing |
we have the same problem after moving the data directory.... Have anyone a solution for this problem? example: (same path but different fileid)
|
When moving the data directory to a different path this is expected as the existing filecache entries are not longer valid for the new location. For a possible workaround for that see https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170 however this is not a supported approach. Note that execution of the scan command could cause creation of new filecache entries if Nextcloud is not able to map the existing entries to the path. |
after this instruction I have actually also proceeded... I have just not updated the oc_storage table... should be no longer necessary from version 13.1 I thought... |
Has anyone ever found the reason for this issue (besides moving the data folder)? |
Still happening with our nextcloud installation on the currently latest version. |
When reading related code I might have a guess where this could potentially go wrong. I prepared a patch that could provide some logging in this case for the Nextcloud server itself. index 3d5a2f098b2..2dadfe66d50 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -894,6 +894,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
public function getDirectoryContent($directory): \Traversable {
$dh = $this->opendir($directory);
+ if ($dh === false) {
+ throw new \Exception('opendir failed, not yielding any results');
+ }
if (is_resource($dh)) {
$basePath = rtrim($directory, '/');
while (($file = readdir($dh)) !== false) { If anyone who encounters this regularly could apply this patch to their instance and share the log results to see if this part is logged with a trace, this would be much appreciated. More context for further debugging: When a scan runs for some reason this could lead to no results which then causes the scanner to diff and remove those entries, the next scan probably readds it again with new file ids: https://github.com/nextcloud/server/blob/ea06cf2f39c5c4e7f1ea20d075c01e3ba0cc6dd0/lib/private/Files/Cache/Scanner.php#L427 The same might happen with scanFile where getMetaData/stat call could return false which is not considered an error case, but can lead to a remove from cache. |
Ok, opendir should still log an error already unless E_WARNING is suppressed via PHP config. |
I managed to reproduce the new fileids with some fairly simple steps:
If this behavior persists I suspect that scans with a missing groupfolder are causing this bug. We can prevent this by checking if the __groupfolders folder is present before running any scan. Otherwise the scan should err out. We can also check if the folder for the groupfolder ( __groupfolders/123 ) in question is still present before performing a scan. If it's not we should inform the admin rather than dropping all the file cache entries. So far I reproduced this on Nextcloud 23. I will try current master next. |
Has anyone encountered this since nextcloud/server#43787? So basically that PR is in Server >=v28.0.4. |
Thanks for bringing this up here @joshtrichards - I remember that PR fixed the scenario I used to reproduce the behavior. So I think we could close this bug - but happy to wait to see if your question yields some response. |
Let's close this, we can reopen if anyone reports this still being an issue. |
We experienced the same issue mentioned here:
https://help.nextcloud.com/t/changed-file-ids-in-groupfolders/91916
It's very annoying since we used a root spreadsheet to referenced a lot of internal documents. All links are now broken.
The text was updated successfully, but these errors were encountered: