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 fulltextsearch:index throws NULL Pointer on isGlobal #125

Open
bronnertm opened this issue May 17, 2021 · 20 comments
Open

occ fulltextsearch:index throws NULL Pointer on isGlobal #125

bronnertm opened this issue May 17, 2021 · 20 comments

Comments

@bronnertm
Copy link

Hi,

When I issue the fulltextsearch:index command I only get a NULL Pointer execption.

An unhandled exception has been thrown: TypeError: Return value of OCA\Files_FullTextSearch\Model\MountPoint::isGlobal() must be of the type bool, null returned in /var/www/html/custom_apps/files_fulltextsearch/lib/Model/MountPoint.php:103 Stack trace: #0 /var/www/html/custom_apps/files_fulltextsearch/lib/Model/MountPoint.php(175): OCA\Files_FullTextSearch\Model\MountPoint->isGlobal() #1 [internal function]: OCA\Files_FullTextSearch\Model\MountPoint->jsonSerialize() #2 /var/www/html/custom_apps/files_fulltextsearch/lib/TNC22Logger.php(193): json_encode(Array) #3 /var/www/html/custom_apps/files_fulltextsearch/lib/TNC22Logger.php(178): OCA\Files_FullTextSearch\Service\GroupFoldersService->log(0, '[debug] initGro...', false, Array) #4 /var/www/html/custom_apps/files_fulltextsearch/lib/Service/GroupFoldersService.php(133): OCA\Files_FullTextSearch\Service\GroupFoldersService->debug('[debug] initGro...', Array) #5 /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php(379): OCA\Files_FullTextSearch\Service\GroupFoldersService->initGroupSharesForUser('birte') #6 /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php(202): OCA\Files_FullTextSearch\Service\FilesService->initFileSystems('birte') #7 /var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php(249): OCA\Files_FullTextSearch\Service\FilesService->getChunksFromUser('birte', Object(OCA\FullTextSearch\Model\IndexOptions)) #8 /var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php(182): OCA\Files_FullTextSearch\Provider\FilesProvider->generateChunks('birte') #9 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(410): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser(Object(OCA\FullTextSearch_Elasticsearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), 'birte', Object(OCA\FullTextSearch\Model\IndexOptions)) #10 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(273): OCA\FullTextSearch\Command\Index->indexProvider(Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Object(OCA\FullTextSearch\Model\IndexOptions)) #11 /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)) #12 /var/www/html/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /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)) #14 /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)) #15 /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)) #16 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /var/www/html/console.php(100): OC\Console\Application->run() #18 /var/www/html/occ(11): require_once('/var/www/html/c...')

My NC version is 21.0.1
Fulltextsearch + the Eleastic Platform is on 21.0.1 and Files is on 21.0.2
Group Folders is on 9.01
My PHP version is: 7.4.19

When I disable the group folders addon in NC the index job will start without an issue. Can someone please point me in the right direction or is this a known issue, because NC 21 is not supported right now?

Thanks Matthias

@tarradmac
Copy link

tarradmac commented May 18, 2021

Hi I have the same error on NC 20.0.9 + FTS 20.0.1 + Files 20.0.3.
Try to reset all index, rescan all files but search is not working.
the test command work perfectly...
I am using group folders 8.2.1

I tried on a fresh install with the same version as I use in production, and got the same behavior. Like @bronnertm I had to disable Group Folders app to get indexing working. Disabling in fulltextsearch setting is not working.

@jurgenhaas
Copy link

Same here with NC 21.0.1 + FTS 21.0.1 + FTS Files 21.0.2
Even when I disable group folders in the settings, it's still throwing that exception.

@ShinjiLE
Copy link

ShinjiLE commented May 19, 2021

Same here .
My first quick fix is to comment out the point where the debug call to the logger appears .
In : apps/files_fulltextsearch/lib/Service/GroupFoldersService.php , Line 133

@g-d-d-h
Copy link

g-d-d-h commented Jun 2, 2021

I have the same problem.

@thomasgg23
Copy link

Same here .
My first quick fix is to comment out the point where the debug call to the logger appears .
In : apps/files_fulltextsearch/lib/Service/GroupFoldersService.php , Line 133

Thanks @ShinjiLE the quickfix seems to be working.
Will get to it when indexing is done

@redRolf
Copy link

redRolf commented Jun 15, 2021

I am experiencing the same issue at our company. Unfortunately commenting out lines, is not an option, as were are using a Docker deployment, which means changes would be non-persistent. Is anybody working on this?
I am happy to supply logs, version numbers, etc.. if needed. Here are the basics:

  • Nextcloud: 21.0.2
  • PHP Version: 7.4.20
  • Group Folders: 9.0.1
  • Full text search - Files: 21.0.2
  • Full text search - Elasticsearch Platform: 21.0.1

@Omaha2002
Copy link

Omaha2002 commented Jun 20, 2021

Comment out the point suggested by @ShinjiLE helps getting the indexing started but after indexing a lot of files and users with groupfolders enabled I get the following error:

An unhandled exception has been thrown:
Error: Call to a member function getOwner() on null in /var/www/nextcloud/lib/private/Share20/Manager.php:1651
Stack trace:
#0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/LocalFilesService.php(163): OC\Share20\Manager->getAccessList()
#1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(795): OCA\Files_FullTextSearch\Service\LocalFilesService->getShareUsersFromFile()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(725): OCA\Files_FullTextSearch\Service\FilesService->updateShareNames()
#3 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(699): OCA\Files_FullTextSearch\Service\FilesService->updateDocumentAccess()
#4 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(680): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocumentFromFile()
#5 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(571): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocument()
#6 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(288): OCA\Files_FullTextSearch\Service\FilesService->generateDocument()
#7 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(317): OCA\Files_FullTextSearch\Provider\FilesProvider->fillIndexDocument()
#8 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(204): OCA\FullTextSearch\Service\IndexService->indexDocuments()
#9 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(410): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#10 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(273): OCA\FullTextSearch\Command\Index->indexProvider()
#11 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#12 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#13 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#14 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#15 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#16 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#17 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#18 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

@tarradmac
Copy link

Comment out the point suggested by @ShinjiLE helps getting the indexing started but after indexing a lot of files and users with groupfolders enabled I get the following error:

An unhandled exception has been thrown:
Error: Call to a member function getOwner() on null in /var/www/nextcloud/lib/private/Share20/Manager.php:1651
Stack trace:
#0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/LocalFilesService.php(163): OC\Share20\Manager->getAccessList()
#1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(795): OCA\Files_FullTextSearch\Service\LocalFilesService->getShareUsersFromFile()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(725): OCA\Files_FullTextSearch\Service\FilesService->updateShareNames()
#3 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(699): OCA\Files_FullTextSearch\Service\FilesService->updateDocumentAccess()
#4 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(680): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocumentFromFile()
#5 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(571): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocument()
#6 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(288): OCA\Files_FullTextSearch\Service\FilesService->generateDocument()
#7 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(317): OCA\Files_FullTextSearch\Provider\FilesProvider->fillIndexDocument()
#8 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(204): OCA\FullTextSearch\Service\IndexService->indexDocuments()
#9 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(410): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#10 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(273): OCA\FullTextSearch\Command\Index->indexProvider()
#11 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#12 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#13 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#14 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#15 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#16 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#17 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#18 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Looks a lot like: nextcloud/server#15074

Hi,
The same here!!

@escribana
Copy link

Thanks @ShinjiLE the quickfix works here too!! Are there any news about the bug?

@skynick11
Copy link

this app is not alive, isn't it?

@buzz-tee
Copy link

buzz-tee commented Jul 11, 2021

Maybe some simple type fixing should be considered here. Otherwise the same issues might surface anywhere, not "only" during debug(x) call.

You might apply this diff to files_fulltextsearch/lib/Model/MountPoint.php:

--- MountPoint.orig.php	2021-07-11 12:14:05.690177923 +0000
+++ MountPoint.php	2021-07-11 12:13:30.439026756 +0000
@@ -100,7 +100,7 @@
 	 * @return bool
 	 */
 	public function isGlobal(): bool {
-		return $this->global;
+		return $this->global === TRUE;
 	}
 
 	/**
@@ -119,7 +119,7 @@
 	 * @return array
 	 */
 	public function getGroups(): array {
-		return $this->groups;
+		return $this->groups ? $this->groups : array();
 	}
 
 	/**
@@ -138,7 +138,7 @@
 	 * @return array
 	 */
 	public function getUsers(): array {
-		return $this->users;
+		return $this->users ? $this->users : array();
 	}
 
 	/**

@teambvd
Copy link

teambvd commented Jul 15, 2021

That diff fixes it for me!

@D3nnis3n
Copy link

D3nnis3n commented Jul 18, 2021

Comment out the point suggested by @ShinjiLE helps getting the indexing started but after indexing a lot of files and users with groupfolders enabled I get the following error:

An unhandled exception has been thrown:
Error: Call to a member function getOwner() on null in /var/www/nextcloud/lib/private/Share20/Manager.php:1651
Stack trace:
#0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/LocalFilesService.php(163): OC\Share20\Manager->getAccessList()
#1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(795): OCA\Files_FullTextSearch\Service\LocalFilesService->getShareUsersFromFile()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(725): OCA\Files_FullTextSearch\Service\FilesService->updateShareNames()
#3 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(699): OCA\Files_FullTextSearch\Service\FilesService->updateDocumentAccess()
#4 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(680): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocumentFromFile()
#5 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(571): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocument()
#6 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(288): OCA\Files_FullTextSearch\Service\FilesService->generateDocument()
#7 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(317): OCA\Files_FullTextSearch\Provider\FilesProvider->fillIndexDocument()
#8 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(204): OCA\FullTextSearch\Service\IndexService->indexDocuments()
#9 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(410): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#10 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(273): OCA\FullTextSearch\Command\Index->indexProvider()
#11 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#12 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#13 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#14 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#15 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#16 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#17 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#18 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Looks a lot like: nextcloud/server#15074

Getting the same over here, even after buzz-tees fix. Anyone got a fix for this?

@teambvd
Copy link

teambvd commented Jul 18, 2021

Group folders elasticsearch indexing is still broken, but that's a separate issue from this one imo - the null errors were returned due to files existing, but in a deleted state, which the diff handles.

Group folders is a separate permissions set, and given that, I'd probably create a new issue for it, referencing this ones fix. Thatll at least give them a good starting point ince the dev has some time to work on it 👍

@tofuSCHNITZEL
Copy link

I also get the "Call to a member function getOwner() on null in /var/www/nextcloud/lib/private/Share20/Manager.php:1651" error...
but I have group folder indexing disabled... any tipps?

@JanBartels
Copy link

In line /var/www/nextcloud/lib/private/Share20/Manager.php:1651 I've added an additional check on null on the object itself:

                        $path = array_shift($nodes);
                        if ($path === null || $path->getOwner() === null) {
                                return [];
                        }

This prevents the exception though I'm not yet sure that the indexing is correct.

@Omaha2002
Copy link

In line /var/www/nextcloud/lib/private/Share20/Manager.php:1651 I've added an additional check on null on the object itself:

                        $path = array_shift($nodes);
                        if ($path === null || $path->getOwner() === null) {
                                return [];
                        }

This prevents the exception though I'm not yet sure that the indexing is correc

I can confirm that this works.

@danielmanser
Copy link

In line /var/www/nextcloud/lib/private/Share20/Manager.php:1651 I've added an additional check on null on the object itself:

                        $path = array_shift($nodes);
                        if ($path === null || $path->getOwner() === null) {
                                return [];
                        }

This prevents the exception though I'm not yet sure that the indexing is correct.

I can also confirm this works on 21.0.4.

@solracsf
Copy link
Member

@JanBartels mind to make a PR for review on it?

@JanBartels
Copy link

@acsfer: I don't know how to make the PR correctly without loosing the link to this issue as the modified file is a part of another repo (https://github.com/nextcloud/server). Please advise.

@solracsf solracsf changed the title occ fulltextsearch:index throws NULL Pointer on isGlobal occ fulltextsearch:index throws NULL Pointer on isGlobal Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests