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

Update to NC 19.0.1: Internal server error after login #21885

Closed
dh-connect opened this issue Jul 17, 2020 · 27 comments
Closed

Update to NC 19.0.1: Internal server error after login #21885

dh-connect opened this issue Jul 17, 2020 · 27 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@dh-connect
Copy link

Steps to reproduce

  1. Updated from NC 19.0.0 to 19.0.1 without problem using web installer
  2. After update login screen shows up
  3. Try to login, after successful login it switches to page with internal server error

Expected behaviour

after successful login switch to files

Actual behaviour

internal server error

Server configuration

Operating system: linux debian 10 buster

Web server: Apache 2.4.38

Database: MariaDB 10.3.22

PHP version: 7.4.8

Nextcloud version: 19.0.1

Updated from an older Nextcloud/ownCloud or fresh install: update from 19.0.0

Where did you install Nextcloud from: web installer

Signing status:

Signing status
cannot get to this page due to internal server error

List of activated apps:

App list
Enabled:
  - accessibility: 1.5.0
  - activity: 2.12.0
  - admin_audit: 1.9.0
  - calendar: 2.0.3
  - cloud_federation_api: 1.2.0
  - comments: 1.9.0
  - contacts: 3.3.0
  - contactsinteraction: 1.0.0
  - dav: 1.15.0
  - encryption: 2.7.0
  - federatedfilesharing: 1.9.0
  - federation: 1.9.0
  - files: 1.14.0
  - files_external: 1.10.0
  - files_pdfviewer: 1.8.0
  - files_rightclick: 0.16.0
  - files_sharing: 1.11.0
  - files_trashbin: 1.9.0
  - files_versions: 1.12.0
  - files_videoplayer: 1.8.0
  - logreader: 2.4.0
  - lookup_server_connector: 1.7.0
  - mail: 1.4.1
  - news: 14.1.11
  - nextcloud_announcements: 1.8.0
  - notes: 3.6.0
  - notifications: 2.7.0
  - oauth2: 1.7.0
  - ocsms: 2.1.8
  - password_policy: 1.9.1
  - photos: 1.1.0
  - privacy: 1.3.0
  - provisioning_api: 1.9.0
  - qownnotesapi: 20.1.0
  - recommendations: 0.7.0
  - serverinfo: 1.9.0
  - settings: 1.1.0
  - sharebymail: 1.9.0
  - spreed: 9.0.1
  - support: 1.2.1
  - systemtags: 1.9.0
  - tasks: 0.13.2
  - text: 3.0.1
  - theming: 1.10.0
  - twofactor_backupcodes: 1.8.0
  - twofactor_totp: 4.1.3
  - updatenotification: 1.9.0
  - viewer: 1.3.0
  - workflowengine: 2.1.0
Disabled:
  - firstrunwizard
  - survey_client
  - user_ldap



Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.0.0.10"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "log_type": "owncloud",
        "logfile": "\/var\/log\/nextcloud.log",
        "loglevel": 2,
        "log_rotate_size": 104857600,
        "dbtype": "mysql",
        "version": "19.0.1.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtpsecure": "tls",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "appstoreenabled": true,
        "appstore.experimental.enabled": true,
        "theme": "",
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "cache_path": "\/data\/ownclouddata\/ocd\/cache",
        "mail_smtpport": "587",
        "app.mail.server-side-cache.enabled": true,
        "htaccess.RewriteBase": "\/owncloud",
        "updater.release.channel": "stable",
        "mysql.utf8mb4": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "filelocking.enabled": true,
        "activity_expire_days": 14,
        "auth.bruteforce.protection.enabled": true,
        "blacklisted_files": [
            ".htaccess",
            "Thumbs.db",
            "thumbs.db",
            "DS_Store"
        ],
        "cron_log": true,
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "preview_max_x": 1024,
        "preview_max_y": 768,
        "preview_max_scale_factor": 1,
        "filesystem_check_changes": 0,
        "integrity.check.disabled": false,
        "knowledgebaseenabled": false,
        "overwriteprotocol": "https",
        "quota_include_external_storage": false,
        "trashbin_retention_obligation": "auto, 7",
        "app_install_overwrite": [
            "ocsms",
            "contacts",
            "qownnotesapi"
        ],
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: smb

Are you using encryption: no

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

LDAP configuration (delete this part if not used)

LDAP config
no LDAP

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log
no error in apache2/error.log

Nextcloud log (data/nextcloud.log)

Nextcloud log
same error over and over again

"Exception":"TypeError: Return value of OC\\Group\\Database::getDisplayName() must be of the type string, null returned at /data/ownclouddata/www/owncloud/lib/private/Group/Database.php#444"

Browser log

Browser log
no browser log
@dh-connect dh-connect added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jul 17, 2020
@dh-connect
Copy link
Author

Info: downgraded back to NC 19.0.0.12, and NC works again without internal server error.

@danieljkemp
Copy link

Same issue;

"Exception":"TypeError: Return value of OC\Group\Database::getDisplayName() must be of the type string, null returned at /data/ownclouddata/www/owncloud/lib/private/Group/Database.php#444"

That code block was added in 5ebb535; commenting it out seems to be a workaround. I am able to browse groups, in the admin UI once I've logged in, so I am not sure why the error is thrown on login.

@dh-connect
Copy link
Author

thank you so much, workaround worked.

@rolandixor
Copy link

rolandixor commented Jul 21, 2020

Is it specifically line 444 that you commented out? I tried this and it didn't seem to work for me.

It would be helpful if you could be more specific about what you commented out, as there are multiple things listed in the commit.

@danieljkemp
Copy link

danieljkemp commented Jul 21, 2020 via email

@robinelfrink
Copy link

Same issue here, upgrading from 18.0.8 to 19.0.2. Commenting the three lines in getDisplayName as a workaround does the trick.

@dh-connect
Copy link
Author

instead of commenting it out, you can also handle the null value of displayname like this:

      public function getDisplayName(string $gid): string {

            if (isset($this->groupCache[$gid])) {

                    $displayName = $this->groupCache[$gid]['displayname'];

                        if (!isset($displayName) || trim($displayName) === '') {
                     $displayName = '';

                    return $displayName;
            }
      }

@cnaumer
Copy link

cnaumer commented Sep 8, 2020

We have the same Problem. NC 19.0.2 and LDAP backend. However, until now I only got one user not working the rest (~100) have not complained. As we are using an AD as LDAP backend and there are no displaynames set on any groups I am not sure what makes this user different.
I am waiting for feedback if the comment from dh-connect works as a fix.

@kbzowski
Copy link

kbzowski commented Sep 10, 2020

I can confirm that problem still exists in 19.0.2 (pure local user storage).
My solution: comment lines 455-457 (if condition) in /var/www/html/lib/private/Group/Database.php. Browse list of users in nextcloud (this will populate cache), and uncommnent previously commented code. After that operation it works fine. I believed something is wrong with not populated properly cache.

@cnaumer
Copy link

cnaumer commented Sep 11, 2020

I can also confirm that the Problem still exists in 19.0.3 and the comment from dh-connect works as a fix with that version also.

@vascowhite
Copy link

vascowhite commented Sep 13, 2020

I have three instances of NC running, all on Debian/Apache. This is happening on just one of the instances. I'm trying to upgrade to 19.03 from 18.9. Success on two instances, but failed with this error on one.

I have noticed that error message below gives the args as onboard, but the group name is actually Onboard. So maybe the issue is elsewhere?

Here's the error formatted for easier reading.

{
  "reqId": "j786idl9YWVSr1YOvjUR",
  "level": 3,
  "time": "2020-09-13T11:15:39+00:00",
  "remoteAddr": "172.18.74.176",
  "user": "paul",
  "app": "index",
  "method": "GET",
  "url": "/",
  "message": {
    "Exception": "TypeError",
    "Message": "Return value of OC\\Group\\Database::getDisplayName() must be of the type string, null returned",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Group/Database.php",
        "line": 474,
        "function": "getDisplayName",
        "class": "OC\\Group\\Database",
        "type": "->",
        "args": [
          "onboard"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Group/Manager.php",
        "line": 187,
        "function": "getGroupDetails",
        "class": "OC\\Group\\Database",
        "type": "->",
        "args": [
          "onboard"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Group/Manager.php",
        "line": 175,
        "function": "getGroupObject",
        "class": "OC\\Group\\Manager",
        "type": "->",
        "args": [
          "onboard"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Group/Manager.php",
        "line": 287,
        "function": "get",
        "class": "OC\\Group\\Manager",
        "type": "->",
        "args": [
          "onboard"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Group/Manager.php",
        "line": 271,
        "function": "getUserIdGroups",
        "class": "OC\\Group\\Manager",
        "type": "->",
        "args": [
          "paul"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Group/Manager.php",
        "line": 335,
        "function": "getUserGroups",
        "class": "OC\\Group\\Manager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Folder/FolderManager.php",
        "line": 442,
        "function": "getUserGroupIds",
        "class": "OC\\Group\\Manager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
        "line": 80,
        "function": "getFoldersForUser",
        "class": "OCA\\GroupFolders\\Folder\\FolderManager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          62
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
        "line": 84,
        "function": "getFoldersForUser",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php",
        "line": 105,
        "function": "getMountsForUser",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          {
            "__class__": "OC\\Files\\Storage\\StorageFactory"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Filesystem.php",
        "line": 451,
        "function": "addMountForUser",
        "class": "OC\\Files\\Config\\MountProviderCollection",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          {
            "__class__": "OC\\Files\\Mount\\Manager"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Filesystem.php",
        "line": 376,
        "function": "initMountPoints",
        "class": "OC\\Files\\Filesystem",
        "type": "::",
        "args": [
          "paul"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Util.php",
        "line": 308,
        "function": "init",
        "class": "OC\\Files\\Filesystem",
        "type": "::",
        "args": [
          "paul",
          "/paul/files"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1011,
        "function": "setupFS",
        "class": "OC_Util",
        "type": "::",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Group/Database.php",
    "Line": 456,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0",
  "version": "19.0.3.1"
}
{
  "reqId": "j786idl9YWVSr1YOvjUR",
  "level": 3,
  "time": "2020-09-13T11:15:40+00:00",
  "remoteAddr": "172.18.74.176",
  "user": "paul",
  "app": "PHP",
  "method": "GET",
  "url": "/",
  "message": "TypeError: Return value of OC\\Group\\Database::getDisplayName() must be of the type string, null returned at /var/www/nextcloud/lib/private/Group/Database.php#456",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0",
  "version": "19.0.3.1"
}

@vascowhite
Copy link

No further movement on fixing this?

TomG736 added a commit to TomG736/server that referenced this issue Sep 27, 2020
Signed-off-by: tgrant <tom.grant760@gmail.com>
@danieljkemp
Copy link

Still ended up with this issue in 20.0.0

@cremfert
Copy link

cremfert commented Oct 18, 2020

Same here, I had to go back to NC 18 as I got the Internal Server Error message, even after patching the getDisplayName() function.

@cnaumer
Copy link

cnaumer commented Nov 27, 2020

Just updated to 19.0.5. Still the same problem.

@dh-connect
Copy link
Author

Updated to 20.0.4 - still same issue, now internal error appears when switching to user settings, wonder why this is still not being fixed.

@rolandixor
Copy link

I stopped trying to upgrade because of this. Instead, I'm going to try to backup and migrate when I get the chance. That may be the only solution. As for support, IMHO, forget about it.

@freumichCH
Copy link

Hello all. We upgraded our infrastructure on sunday from 18.0.12 to 19.0.6 with the same error. Following fix has solved the issue:

instead of commenting it out, you can also handle the null value of displayname like this:

      public function getDisplayName(string $gid): string {

            if (isset($this->groupCache[$gid])) {

                    $displayName = $this->groupCache[$gid]['displayname'];

                        if (!isset($displayName) || trim($displayName) === '') {
                     $displayName = '';

                    return $displayName;
            }
      }

Is there any update on this?

@pfy
Copy link

pfy commented Dec 22, 2020

We have found a workaround (this may help triage the problem):
The SQL table oc_ldap_group_mapping contained a entry, where the
cnof the ldap_dn was NOT the owncloud_name.
By changing the ```owncloud_name`` to the cn of the ldap entry, the problem went away.

@antondollmaier
Copy link

Issue is still present in 20.0.4. Haven't yet searched how the groupcache is wrongly populated.

@thoro
Copy link

thoro commented Jan 21, 2021

Also with 20.0.5 ... maybe someone cares about checking that?

the oc_ldap_group_mapping table has the owncloud_name the same as the CN, but cn is all lower case, and owncloud_name is correctly typed (i.e. mixed case)

For me it seems to always affect only a single user at a time so far.

@soerpoers
Copy link

soerpoers commented Feb 1, 2021

Seems that it's also the same with 20.0.6
I don't use ldap so there isn't a table of that there.
All users except admins have this problem.

@soerpoers
Copy link

So I just solved the problem for me by deleting some records of users in the oc_group_user table, whose groups I had actually deleted in the frontend some time ago. But the records of the users associated with the groups were still there in the database and thus probably triggered the problem after each update.

@dh-connect
Copy link
Author

thank you for the hint, I did the same, had users assigned to a group GID "users", but in table oc_groups is no GID "users", tried it out without the fix and it works now, so guess the issue was a GID used that's not in the oc_groups table

@robinelfrink
Copy link

List user/group combinations with non-existing group:

SELECT oc_group_user.* FROM oc_group_user LEFT JOIN oc_groups ON oc_group_user.gid=oc_groups.gid WHERE oc_groups.gid IS NULL;

Remove user/group combinations with non-existing group:

DELETE oc_group_user FROM oc_group_user LEFT JOIN oc_groups ON oc_group_user.gid=oc_groups.gid WHERE oc_groups.gid IS NULL;

@vascowhite
Copy link

@robinelfrink @soerpoers
Thank you, that worked perfectly.

@MorrisJobke MorrisJobke mentioned this issue May 20, 2021
MorrisJobke pushed a commit that referenced this issue May 25, 2021
Signed-off-by: tgrant <tom.grant760@gmail.com>
MorrisJobke added a commit that referenced this issue May 25, 2021
Fix null displayname crash as described in #21885
@MorrisJobke MorrisJobke mentioned this issue May 26, 2021
98 tasks
@szaimen
Copy link
Contributor

szaimen commented Jun 23, 2021

Looks like this was fixed with #23065

@szaimen szaimen closed this as completed Jun 23, 2021
backportbot-nextcloud bot pushed a commit that referenced this issue Sep 10, 2021
Signed-off-by: tgrant <tom.grant760@gmail.com>
backportbot-nextcloud bot pushed a commit that referenced this issue Sep 10, 2021
Signed-off-by: tgrant <tom.grant760@gmail.com>
This was referenced Sep 23, 2021
blizzz added a commit that referenced this issue Sep 23, 2021
[stable20] Fix null displayname crash as described in #21885
blizzz added a commit that referenced this issue Sep 23, 2021
[stable21] Fix null displayname crash as described in #21885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

No branches or pull requests