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

Error indexing getUID() null #697

Closed
martadinata666 opened this issue May 6, 2022 · 21 comments · Fixed by nextcloud/files_fulltextsearch#170
Closed

Error indexing getUID() null #697

martadinata666 opened this issue May 6, 2022 · 21 comments · Fixed by nextcloud/files_fulltextsearch#170

Comments

@martadinata666
Copy link

martadinata666 commented May 6, 2022

Nextcloud 24 , PHP 8.0, fulltextsearch 24.0.0, already do migration occ fulltextsearch:migration:24

Error: Call to a member function getUID() on null in /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php:449
  1. Run occ fulltextsearch:index
  2. Progress running
  3. fulltextsearch thrown error
An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php:449
Stack trace:
#0 /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php(324): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromFile('dedyms', Object(OC\Files\Node\File))
#1 /var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php(269): OCA\Files_FullTextSearch\Service\FilesService->getFilesFromUser('dedyms', '/Photos/0110201...')
#2 /var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php(183): OCA\Files_FullTextSearch\Provider\FilesProvider->generateIndexableDocuments('dedyms', '/Photos/0110201...')
#3 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(416): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser(Object(OCA\FullTextSearch_Elasticsearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), 'dedyms', Object(OCA\FullTextSearch\Model\IndexOptions))
#4 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(279): OCA\FullTextSearch\Command\Index->indexProvider(Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Object(OCA\FullTextSearch\Model\IndexOptions))
#5 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /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))
#7 /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))
#8 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Index), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /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))
#10 /var/www/html/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/console.php(99): OC\Console\Application->run()
#12 /var/www/html/occ(11): require_once('/var/www/html/c...')

  1. Run fulltextsearch:index again, show index already running
  2. Stop index, run index again, throw same error on different files.

Should it stop index or just let it run,i assume it keep run in background?

Edit:

  1. Reseted the index not solving it.
@XueSheng-GIT
Copy link

I'm facing the same issue with NC24, fulltextsearch 24 and php7.4.

Not sure whether following info might be relevant:
Index was recently rebuilt (reset+index) on NC23. "live" service was running without issues for weeks now.
Waited to upgrade to NC24 until fulltextsearch was marked compatible. Upgrade (webinterface) failed during app upgrade of fulltextsearch. Fulltextsearch didn't run afterwards until "migration:24" was done manually (not sure whether this is normally done during app upgrade).

@XueSheng-GIT
Copy link

While testing I tried to focus on the path which thows the mentioned "getUID() on null" error. For example:
./occ fulltextsearch:index "{\"user\": \"XXX\", \"providers\":[\"files\"], \"path\": \"/Documents\"}"

Doing this, I don't get an error msg, but the index keeps running in background, even though the indexing seems to be finished:
In RunningService.php line 86: Index is already running

Doing the same for a path which is not affected by this issue, index does not keep running in background after it was finished.

Any chance that this issue was triggered during "migration:24"? Rebuilding the index took a week last time. I'm afraid that a reset of the index won't fix the issue and that I'm stuck without a working index.
Any hints how to dig deeper?

@nigriF
Copy link

nigriF commented May 9, 2022

Same here with updated NC24, fulltextsearch 24, nginx and php8.0. Resetting the index did not work for me, nor did reinstalling elasticsearch.

@priiduonu
Copy link

I was able to rebuild the index after changing the line https://github.com/nextcloud/files_fulltextsearch/blob/40254a35e8e2650d010f96c88d6bb96ed8df16e5/lib/Service/FilesService.php#L449

original:

		$document->setAccess(new DocumentAccess($file->getOwner()->getUID()));

modified:

 		$document->setAccess(new DocumentAccess());

@XueSheng-GIT
Copy link

original:

		$document->setAccess(new DocumentAccess($file->getOwner()->getUID()));

On the first view this was introduced with nextcloud/files_fulltextsearch#146
@ArtificialOwl can you comment on this? Is it safe modify this line as mentioned by @priiduonu?

@nigriF
Copy link

nigriF commented May 13, 2022

@priiduonu 's solution seems to work for me. many thanks!

@ArtificialOwl
Copy link
Member

DocumentAccess contains view's right on each indexed document. Those values are needed during the search to filter documents based on the access of the user that initiated the request. This will index your documents but document won't be available during the search.

I am not able to reproduce the issue, do you have any details on the files that is generating this issue ? is the filesystem local ? is it a specific type of file ?

were you able to catch the file_id and run: `./occ fulltextsearch:document:provider <user_id> files <file_id> ?

@priiduonu
Copy link

My filesystem is external, mounted via SFTP. But I also disabled indexing external files and group folders, the results were the same as the OP described.

I'm not sure if it was a specific type or certain file, too late for that :-)

@XueSheng-GIT
Copy link

am not able to reproduce the issue, do you have any details on the files that is generating this issue ? is the filesystem local ? is it a specific type of file ?

I'm using a local filesystem, groupfolders (indexing enabled) and external (smb, indexing path only).
So far this issue only appeared on the local filesystem.

were you able to catch the file_id and run: `./occ fulltextsearch:document:provider <user_id> files <file_id> ?

As previously mentioned. I created the initial index on NC23. Now it fails after updating to NC24.
For example index fails on folder "Fotos MX" (which includes 5 jpg files).

indexing:

./occ fulltextsearch:index "{\"user\": \"hidden_user_id\", \"providers\":[\"files\"]}"
┌─ Indexing  ────
│ Action: compareWithCurrentIndex
│ Provider: Files                Account: hidden_user_id
│ Document: 67916
│ Info: /hidden_user_id/files/photos/Fotos MX
│ Title: 
│ Content size: 
│ Chunk:    604/1414
│ Progress:      0/1
└──
┌─ Results ────
│ Result:      6/6
│ Index: files:67916
│ Status: ok
│ Message: {"_index":"nextcloud","_type":"_doc","_id":"files:67916","_version":1,"result":"noop","_shards":{"total":0,"successful":0,"failed":0},"_seq_no":53660,"_primary_term":2}
│ 
│ 
└──

document info:

./occ fulltextsearch:document:provider hidden_user_id files 155596
Document: 
{
    "id": "155596",
    "providerId": "files",
    "access": {
        "ownerId": "hidden_user_id",
        "viewerId": "",
        "users": [],
        "groups": [],
        "circles": [],
        "links": []
    },
    "modifiedTime": 1434734576,
    "title": "photos\/Fotos MX",
    "link": "https:\/\/cloud.domain.de\/index.php\/f\/155596",
    "index": {
        "ownerId": "hidden_user_id",
        "providerId": "files",
        "collection": "",
        "source": "files_local",
        "documentId": "155596",
        "lastIndex": 0,
        "errors": [],
        "errorCount": 0,
        "status": 28,
        "options": []
    },
    "source": "files_local",
    "info": {
        "share_names": {
            "hidden_user_id": "photos\/Fotos MX"
        }
    },
    "hash": "",
    "contentSize": 0,
    "tags": [],
    "metatags": [
        "files_local"
    ],
    "subtags": [],
    "more": {
        "creationTime": 1636743669,
        "accessedTime": 1649684151
    },
    "excerpts": [],
    "score": ""
}

error message:

An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php:449
Stack trace:
#0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(421): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromFile()
#1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(318): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromParent()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(269): OCA\Files_FullTextSearch\Service\FilesService->getFilesFromUser()
#3 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(183): OCA\Files_FullTextSearch\Provider\FilesProvider->generateIndexableDocuments()
#4 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(416): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#5 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(279): OCA\FullTextSearch\Command\Index->indexProvider()
#6 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#7 /var/www/nextcloud/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run()
#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#11 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#12 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#13 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

@ArtificialOwl just let me know which additional info you need!

@cbachmann987
Copy link

Same here with Nextcloud 24.0.0 in the official docker container. Would be glad to see a fix.. or at least understand what causes the problem.

@cbachmann987
Copy link

Not sure if that helps: I just noticed that the above error occured in my case when fulltextsearch was indexing files for the Account "bridge-bot". I had been experimenting with talk bridges and abviously that account was created than, but I never really used it. I deleted that acount manually, and now indexing sees to run.. ok stopped with another error somewhat later, but that is a different one.

@XueSheng-GIT
Copy link

I'm still trying to understand the cause of this issue. I now started to delete all files/folders which causes this issue. Finally this error still appears but I don't see a reference to an actual file!?

./occ fulltextsearch:index "{\"user\": \"hidden_user_id\", \"providers\":[\"files\"]}"
┌─ Indexing  ────
│ Action: compareWithCurrentIndex
│ Provider: Files                Account: hidden_user_id
│ Document: 67916
│ Info: httpd/unix-directory
│ Title: 
│ Content size: 0
│ Chunk:    610/1421
│ Progress:      0/1
└──
┌─ Results ────
│ Result:      1/1
│ Index: files:67916
│ Status: ok
│ Message: {"_index":"nextcloud","_type":"_doc","_id":"files:67916","_version":1,"result":"noop","_shards":{"total":0,"successful":0,"failed":0},"_seq_no":53660,"_primary_term":2}
│ 
│ 
└──

Error:

An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php:449
Stack trace:
#0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(421): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromFile()
#1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(318): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromParent()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(269): OCA\Files_FullTextSearch\Service\FilesService->getFilesFromUser()
#3 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(183): OCA\Files_FullTextSearch\Provider\FilesProvider->generateIndexableDocuments()
#4 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(416): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#5 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(279): OCA\FullTextSearch\Command\Index->indexProvider()
#6 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#7 /var/www/nextcloud/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run()
#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#11 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#12 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#13 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

@XueSheng-GIT
Copy link

I'm now able to reproduce the issue!
I'm running three instances of Nextcloud and this issue was only appearing on one of them. As explained earlier, the files which seem to be affected where no issue in the past (e.g. NC23, #697 (comment)) and deleting all affected files does not solve the issue (#697 (comment)).
Lastly I checked the files of each individual user account and noticed that all affected accounts are using an external SMB/CIFS storage! Disabling indexing for external storage does not solve the issue. Indexing also does not fail on the external storage itself (at least the output shown so far never indicates a relation to an external storage!).

After disabling the external SMB/CIFS storage, the issue did not appear again. The other way around, enabling a SMB/CIFS storage for an account which was not affected so far, does cause this issue! I was able to reproduce this behaviour on all three nextcloud instances running latest NC24.0.1.

Would be great if someone could double check if the external storage is the root cause!

@ArtificialOwl: Any idea how to prevent this error if an external storage is available?

@martadinata666
Copy link
Author

martadinata666 commented May 27, 2022

So i tried add SMB/CIFS external storage mount to new created user, the error happen. And can confirm this is related to external storage handling, the options disable external storage scan also not working? as i uncheck it but it still try to scan external storage? 🤔

Edit: i got local type external storage, this also trigger the error, so i think not only SMB/CIFS but general external storage handling. Another type maybe could be tested is FTP

@cbachmann987
Copy link

I don't have external storages, but saw the error as well.

@jacotec
Copy link

jacotec commented May 27, 2022

Good findings! I use local type external storage on all my instances and can't get around this ... so any hotfix is appreciated.

@ArtificialOwl
Copy link
Member

This should fix it, if you are willing to patch files_fulltextsearch: nextcloud/files_fulltextsearch#170

@XueSheng-GIT
Copy link

Thanks a lot!
Applying your patch does resolve the issue in my case (external smb/cifs storage).

@martadinata666
Copy link
Author

Confirmed fix on local and SMB external storage type. Should i close this?

@nigriF
Copy link

nigriF commented Jun 8, 2022

it also works on my side. many thanks!

@martadinata666
Copy link
Author

Closed, look nextcloud/files_fulltextsearch#170

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.

7 participants