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 loading contacts menu #9402

Closed
hoellen opened this issue May 5, 2018 · 11 comments
Closed

Error loading contacts menu #9402

hoellen opened this issue May 5, 2018 · 11 comments

Comments

@hoellen
Copy link
Contributor

hoellen commented May 5, 2018

Steps to reproduce

  1. Enable "restrict users to only share with users in their group" (admin panel -> Sharing)
  2. Go to any user and open contacts menu (right top corner)

Expected behaviour

Show users from groups and contacts

Actual behaviour

"Error while loading contacts" (see nextcloud.log)

grafik

Searching in the contacts menu works and shows contacts.

Server configuration

Operating system: CentOS Linux release 7.4.1708 (Core)

Web server: nginx/1.13.12

Database: MariaDB-10.2.14

PHP version: php-fpm 7.2.5

Nextcloud version: 13.0.2

Where did you install Nextcloud from: Docker

Signing status: All checks passed.

Are you using external storage, if yes which one: no
Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 59.0.2

Operating system: ArchLinux

Logs

Nextcloud log
TypeError: Argument 1 passed to OC\Group\Manager::getUserGroupIds() must implement interface OCP\IUser, null given, called in /nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php on line 160
/nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php - line 160: OC\Group\Manager->getUserGroupIds(NULL)
[internal function] OC\Contacts\ContactsMenu\ContactsStore->OC\Contacts\ContactsMenu\{closure}(*** sensitive parameters replaced ***)
/nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php - line 168: array_filter(Array, Object(Closure))
/nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php - line 87: OC\Contacts\ContactsMenu\ContactsStore->filterContacts(Object(OC\User\User), Array, NULL)
/nextcloud/lib/private/Contacts/ContactsMenu/Manager.php - line 59: OC\Contacts\ContactsMenu\ContactsStore->getContacts(Object(OC\User\User), NULL)
/nextcloud/core/Controller/ContactsMenuController.php - line 61: OC\Contacts\ContactsMenu\Manager->getEntries(Object(OC\User\User), NULL)
[internal function] OC\Core\Controller\ContactsMenuController->index(NULL)
/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 161: call_user_func_array(Array, Array)
/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 91: OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Core\Controller\ContactsMenuController), 'index')
/nextcloud/lib/private/AppFramework/App.php - line 115: OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Core\Controller\ContactsMenuController), 'index')
/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('OC\\Core\\Control...', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/nextcloud/li```b/private/Route/Router.php - line 297: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/nextcloud/lib/base.php - line 999: OC\Route\Router->match('/contactsmenu/c...')
/nextcloud/index.php - line 37: OC handleRequest()
{main}
Browser log
There was an error loading your contacts{
  "readyState": 4,
  "responseText": "HTML WITH HTTP 500 ERROR MESSAGE",
  "status": 500,
  "statusText": "Internal Server Error"
}
@MorrisJobke
Copy link
Member

@ChristophWurst
Copy link
Member

There is a null check missing at

$contactGroups = $this->groupManager->getUserGroupIds($this->userManager->get($entry->getProperty('UID')));
. Basically the user manager is asked for a user of the given UID which seems to be invalid (for whatever reason) and therefore null is returned and passed into the group manager.

@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jul 5, 2018
@hoellen
Copy link
Contributor Author

hoellen commented Jul 9, 2018

Can I help you with it? Do you need some more information?

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Jul 9, 2018
@ChristophWurst
Copy link
Member

@hoellen are you able to attach a debugger to your instance or add some logging statements to get the value of $entry->getProperty('UID')?

@hoellen
Copy link
Contributor Author

hoellen commented Jul 23, 2018

I used the following lines to get the value:

$tmp = $entry->getProperty('UID');
if ($this->userManager->get($tmp) == null) {
    throw new \Exception("DEBUGGING: $tmp");
} 

It returns "testuser124" . This is a testuser I had long time ago. He was deleted.
I looked up the value "testuser124" in my database and it occurs in the following tables:

  • oc_accounts
  • oc_addressbookchanges
  • oc_calendarchanges
  • oc_cards
  • oc_cards_properties (cause of oc_cards)
  • oc_filecache (only avatar)

I deleted the "testuser124" line in oc_accounts. But it doesn't changed anything.

As a workaround I added the following lines in the file ContactsStore.php. Since then the Contactsmenu works.

if ( $entry->getProperty('UID') == "testuser124") {
    return false;
}

But: Where does the value come from?

@ChristophWurst
Copy link
Member

Awesome findings, @hoellen. Thanks a lot!

But: Where does the value come from?

I assume it's coming from the system address, book. So that should be oc_cards, I assume. cc @rullzer @nickvergessen who might know a bit more about this. To me, this sounds like a bug.

@MorrisJobke
Copy link
Member

Seems to be fixed with #10296

@ChristophWurst
Copy link
Member

Yes, seems that's exactly the same issue. Hence, I'm closing this ticket.

@hoellen
Copy link
Contributor Author

hoellen commented Jul 24, 2018

Yep, this is the fix. Thanks!
Maybe there should be something in occ maintenance:repair to get the addressbook and usermanager in sync again?

@ChristophWurst
Copy link
Member

Maybe there should be something in occ maintenance:repair to get the addressbook and usermanager in sync again?

Sounds sane. However, I'd rather try to track down why we have some dead UIDs in our database and make sure there are no leftovers in the first place.

@hoellen
Copy link
Contributor Author

hoellen commented Jul 27, 2018

I just want to let you know (maybe another has this issue too), that there is the command dav:sync-system-addressbook and after that the contacts menu appear even without the fix.
Furthermore the user "testuser124" is not anymore in the oc_cards table.

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

4 participants