core icon indicating copy to clipboard operation
core copied to clipboard

oC 9.1 no results when searching common surenames with large LDAPs

Open kiu-ball opened this issue 9 years ago • 13 comments

Steps to reproduce

  1. Have a large LDAP directory with more than 15.000 users and more than 25.000 groups
  2. Search for a common surename (e.g. Mueller, Meier, Schmidt)

Expected behaviour

Search should give a correct list of matching users and groups in any case.

Actual behaviour

Search gives no list at all if a common surename is searched. DB Backend does a lot of queries for every match (and all the groups that these matches have). Browser console shows a 504 Timeout after a period of time while the search in background is still running.

So I've got two questions:

  • Where is this search UI timeout defined in code so I can try to set a higher value?
  • Why is the user search so complex? I can see no real reason checking every group a search match has if the 'share with group members only' feature isn't used.

Server configuration

Operating system: OpenSUSE

Web server: Apache 2.4.16

Database: PostgreSQL 9.4

PHP version: 5.6.9

ownCloud version: (see ownCloud admin page) 9.1.3

Updated from an older ownCloud or fresh install: updated

Where did you install ownCloud from: Enterprise Tarball

Signing status (ownCloud 9.0 and above):

List of activated apps:

Enabled:
  - activity: 2.3.2
  - admin_audit: 0.7
  - comments: 0.3.0
  - dav: 0.2.7
  - enterprise_key: 0.1.0
  - federatedfilesharing: 0.3.0
  - federation: 0.1.0
  - files: 1.5.1
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.10.0
  - files_texteditor: 2.1
  - files_trashbin: 0.9.0
  - files_versions: 1.3.0
  - files_videoplayer: 0.9.8
  - firewall: 2.4.0
  - firstrunwizard: 1.1
  - gallery: 15.0.0
  - notifications: 0.3.0
  - provisioning_api: 0.5.0
  - templateeditor: 0.1
  - updatenotification: 0.2.1
  - user_ldap: 0.9.0
  - user_shibboleth: 2.0
Disabled:
  - announcementcenter
  - encryption
  - external
  - files_antivirus
  - files_drop
  - files_external
  - files_ldap_home
  - objectstore
  - password_policy
  - sharepoint
  - systemtags
  - systemtags_management
  - user_external
  - windows_network_drive
  - workflow

The content of config/config.php:

<?php
$CONFIG = array (
  'supportedDatabases' => 
  array (
    0 => 'mysql',
    1 => 'pgsql',
    2 => 'oci',
  ),
  'license-key' => '### removed ###',
  'instanceid' => 'abc12345678',
  'passwordsalt' => '### removed ###',
  'secret' => '### removed ###',
  'datadirectory' => '/mnt/owncloud/data/',
  'filesystem_check_changes' => 0,
  'overwrite.cli.url' => 'https://oc.example.org',
  'overwritehost' => 'oc.example.org',
  'overwritewebroot' => '/',
  'dbtype' => 'pgsql',
  'version' => '9.1.3.1',
  'dbname' => 'owncloud',
  'dbhost' => 'oc-db.example.org',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => '### removed ###',
  'ldapIgnoreNamingRules' => false,
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => 'owncloud',
  'mail_domain' => 'oc.example.org',
  'mail_smtphost' => 'mail.example.org',
  'mail_smtpport' => '465',
  'loglevel' => 0,
  'debug' => '0',
  'logtimezone' => 'Europe/Berlin',
  'log_rotate_size' => 104857600,
  'trusted_proxies' => 
  array (
    0 => '192.168.123.100',
    1 => '192.168.123.101',
  ),
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_X_FORWARDED_FOR',
  ),
  'trashbin_retention_obligation' => '30, 31, auto',
  'activity_expire_days' => '90',
  'theme' => 'mytheme',
  'skeletondirectory' => '/srv/www/htdocs/owncloud/themes/mytheme/skeleton',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis.example.org',
    'port' => 6379,
    'timeout' => 0,
    'password' => '### removed ###',
  ),
  'trusted_domains' => 
  array (
    0 => 'oc.example.org',
    1 => 'oc1.example.org',
    2 => 'oc2.example.org,
  ),
  'firewall.rules' => '[{"name":"Block specific Filetypes","rules":[{"id":"filetype","field":"filetype","type":"string","input":"text","operator":"equal","value":"message\\/rfc822"}]}]',
  'updatechecker' => false,
  'mail_smtpsecure' => 'ssl',
  'maintenance' => false,
);

Are you using external storage, if yes which one: local/smb/sftp/... NFS

Are you using encryption: yes/no No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... LDAP, Shibboleth

LDAP configuration (delete this part if not used)

+-------------------------------+--------------------------------------------------------------+
| Configuration                 |                                                              |
+-------------------------------+--------------------------------------------------------------+
| hasMemberOfFilterSupport      | 1                                                            |
| hasPagedResultSupport         |                                                              |
| homeFolderNamingRule          |                                                              |
| lastJpegPhotoLookup           | 0                                                            |
| ldapAgentName                 | cn=ldap-proxy-user,ou=proxy,o=service                        |
| ldapAgentPassword             | ***                                                          |
| ldapAttributesForGroupSearch  |                                                              |
| ldapAttributesForUserSearch   | mail;sn;cn                                                   |
| ldapBackupHost                |                                                              |
| ldapBackupPort                |                                                              |
| ldapBase                      | o=example,c=org                                              |
| ldapBaseGroups                | ou=oc_groups,ou=services,ou=group,o=example,c=org            |
| ldapBaseUsers                 | ou=user,o=example,c=org                                      |
| ldapCacheTTL                  | 60                                                           |
| ldapConfigurationActive       | 1                                                            |
| ldapDynamicGroupMemberURL     |                                                              |
| ldapEmailAttribute            | mail                                                         |
| ldapExperiencedAdmin          | 1                                                            |
| ldapExpertUUIDGroupAttr       |                                                              |
| ldapExpertUUIDUserAttr        |                                                              |
| ldapExpertUsernameAttr        | cn                                                           |
| ldapGroupDisplayName          | description                                                  |
| ldapGroupFilter               | (&(|(objectclass=groupOfNames)))                             |
| ldapGroupFilterGroups         |                                                              |
| ldapGroupFilterMode           | 0                                                            |
| ldapGroupFilterObjectclass    |                                                              |
| ldapGroupMemberAssocAttr      | uniqueMember                                                 |
| ldapHost                      | ldaps://ldap.example.org                                     |
| ldapIgnoreNamingRules         |                                                              |
| ldapLoginFilter               | (&                                                           |
|                               |     (|                                                       |
|                               |         (&                                                   |
|                               |             (PrimaryRoleType=Gast)                           |
|                               |             (Geschlecht=S)                                   |
|                               |         )                                                    |
|                               |         (PrimaryRoleType=StudHK)                             |
|                               |         (PrimaryRoleType=Student)                            |
|                               |         (PrimaryRoleType=Promovierende)                      |
|                               |         (PrimaryRoleType=Lehrbeauftragter)                   |
|                               |         (PrimaryRoleType=Mitarbeiter)                        |
|                               |         (PrimaryRoleType=Professor)                          |
|                               |     )                                                        |
|                               |     (loginDisabled=FALSE)                                    |
|                               |     (|                                                       |
|                               |         (cn=%uid)                                            |
|                               |         (mail=%uid)                                          |
|                               |     )                                                        |
|                               | )                                                            |
| ldapLoginFilterAttributes     |                                                              |
| ldapLoginFilterEmail          | 1                                                            |
| ldapLoginFilterMode           | 1                                                            |
| ldapLoginFilterUsername       | 1                                                            |
| ldapNestedGroups              | 0                                                            |
| ldapOverrideMainServer        |                                                              |
| ldapPagingSize                | 500                                                          |
| ldapPort                      | 636                                                          |
| ldapQuotaAttribute            | SANQuota                                                     |
| ldapQuotaDefault              | 26843545600                                                  |
| ldapTLS                       | 0                                                            |
| ldapUserDisplayName           | fullName                                                     |
| ldapUserDisplayName2          | mail                                                         |
| ldapUserFilter                | (|                                                           |
|                               |     (&                                                       |
|                               |         (PrimaryRoleType=Gast)                               |
|                               |         (Geschlecht=S)                                       |
|                               |     )                                                        |
|                               |     (PrimaryRoleType=StudHK)                                 |
|                               |     (PrimaryRoleType=Student)                                |
|                               |     (PrimaryRoleType=Promovierende)                          |
|                               |     (PrimaryRoleType=Lehrbeauftragter)                       |
|                               |     (PrimaryRoleType=Mitarbeiter)                            |
|                               |     (PrimaryRoleType=Professor)                              |
|                               | )                                                            |
| ldapUserFilterGroups          |                                                              |
| ldapUserFilterMode            | 0                                                            |
| ldapUserFilterObjectclass     | inetOrgPerson                                                |
| ldapUuidGroupAttribute        | auto                                                         |
| ldapUuidUserAttribute         | auto                                                         |
| turnOffCertCheck              | 1                                                            |
| useMemberOfToDetectMembership | 1                                                            |
+-------------------------------+--------------------------------------------------------------+

Client configuration

Browser: Chrome 56

Operating system: OS X 10.11

Logs

Web server error log

ownCloud log (data/owncloud.log)

Browser log

GET https://oc.example.org/ocs/v1.php/apps/files_sharing/api/v1/sharees?format=json&search=m%C3%BCller&perPage=200&itemType=folder 504 (Gateway Time-out)

kiu-ball avatar Mar 03 '17 10:03 kiu-ball

@kiu-ball search where? in the sharing drop down or in the users list?

butonic avatar Mar 03 '17 13:03 butonic

@butonic In sharing.

kiu-ball avatar Mar 03 '17 14:03 kiu-ball

00006606

cdamken avatar Mar 07 '17 17:03 cdamken

| ldapGroupMemberAssocAttr      | uniqueMember                                                 |

Is this correct? I think it should be "member" because the "groupOfNames" objectClass is what it's expecting. I'm not sure if it's causing issues.

jvillafanez avatar Mar 07 '17 17:03 jvillafanez

@jvillafanez Both is possible as you can see under 'Alternative Namen'.

bildschirmfoto 2017-03-08 um 11 12 13

kiu-ball avatar Mar 08 '17 10:03 kiu-ball

I have recently discovered that a higher ldapCacheTTL lets the search work normally after a first faulty run. This is clearly a timeout issue. A second search for 'Müller' from cache takes approximately 34 seconds until the result appears.

kiu-ball avatar Mar 10 '17 16:03 kiu-ball

Any Ideas? For me oC 9.1 generally seems to have extremely bad LDAP performance. oC 8.2.9 in our production environment needs only 2 instead of 34 seconds for the same search (from cache)...

kiu-ball avatar Mar 27 '17 13:03 kiu-ball

@jvillafanez IMO the implementation from oC10 will help with the performance, am I right?

cdamken avatar Apr 21 '17 19:04 cdamken

There are no changes in LDAP regarding performance, but it's expected core to handle things better.

jvillafanez avatar Apr 25 '17 10:04 jvillafanez

in 10 ldap is only used for login and for the occ user:sync command. all search queries will be handled by the db.

butonic avatar May 19 '17 09:05 butonic

@kiu-ball I will close this case after the email you just sent me, is that fine?

cdamken avatar Aug 24 '17 18:08 cdamken

Yes, with oC10 this problem seems to be fixed. Thanks.

kiu-ball avatar Aug 25 '17 07:08 kiu-ball

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Aug 01 '19 04:08 lock[bot]