files_fulltextsearch icon indicating copy to clipboard operation
files_fulltextsearch copied to clipboard

`occ fulltextsearch:index` throws NULL Pointer on `isGlobal`

Open bronnertm opened this issue 4 years ago • 20 comments

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

bronnertm avatar May 17 '21 21:05 bronnertm

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.

tarradmac avatar May 18 '21 13:05 tarradmac

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.

jurgenhaas avatar May 19 '21 07:05 jurgenhaas

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

ShinjiLE avatar May 19 '21 14:05 ShinjiLE

I have the same problem.

g-d-d-h avatar Jun 02 '21 04:06 g-d-d-h

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

thomasgg23 avatar Jun 04 '21 08:06 thomasgg23

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

redRolf avatar Jun 15 '21 20:06 redRolf

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...')

Omaha2002 avatar Jun 20 '21 09:06 Omaha2002

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!!

tarradmac avatar Jun 21 '21 06:06 tarradmac

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

escribana avatar Jun 29 '21 14:06 escribana

this app is not alive, isn't it?

skynick11 avatar Jul 04 '21 14:07 skynick11

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();
 	}
 
 	/**

buzz-tee avatar Jul 11 '21 12:07 buzz-tee

That diff fixes it for me!

teambvd avatar Jul 15 '21 23:07 teambvd

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?

D3nnis3n avatar Jul 18 '21 06:07 D3nnis3n

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 👍

teambvd avatar Jul 18 '21 15:07 teambvd

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?

tofuSCHNITZEL avatar Jul 24 '21 16:07 tofuSCHNITZEL

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.

JanBartels avatar Aug 06 '21 19:08 JanBartels

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.

Omaha2002 avatar Aug 15 '21 17:08 Omaha2002

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.

danielmanser avatar Aug 15 '21 19:08 danielmanser

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

solracsf avatar Sep 13 '21 12:09 solracsf

@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.

JanBartels avatar Sep 14 '21 17:09 JanBartels