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

[Bug]: After upgrade to 28.0.1 nonstop errors regarding guestName avatar #42858

Closed
5 of 8 tasks
JRGonz opened this issue Jan 16, 2024 · 8 comments · Fixed by #42860
Closed
5 of 8 tasks

[Bug]: After upgrade to 28.0.1 nonstop errors regarding guestName avatar #42858

JRGonz opened this issue Jan 16, 2024 · 8 comments · Fixed by #42860
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback bug feature: contacts menu

Comments

@JRGonz
Copy link

JRGonz commented Jan 16, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

After upgrading I noticed that the nextcloud administration status page showed errors that were constantly counting up. Looking at the logs (had to disable ad blocker to see them for some reason) It was showing the following error...

InvalidParameterException
Parameter "guestName" for route "core.GuestAvatar.getAvatar" must match "[^/]++" ("" given) to generate a corresponding URL.

I am not really sure where to look here. Maybe it is related to auth against ldap? I haven't been able to find any more information about it.

Steps to reproduce

Just run nextcloud and it will constantly log this.

Expected behavior

To not have this error.

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.domain.tld"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "US",
        "dbtype": "mysql",
        "version": "28.0.1.1",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.domain.tld",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "PLAIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\Movie",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\Image"
        ],
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "maintenance": false,
        "overwriteprotocol": "https",
        "allow_local_remote_servers": "true",
        "loglevel": 2,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "theme": "",
        "memories.exiftool": "\/var\/www\/cloud.domain.tld\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.vod.path": "\/var\/www\/cloud.domain.tld\/apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "memories.vod.disable": false,
        "skeletondirectory": "\/var\/www\/skel",
        "default_language": "en",
        "default_locale": "en_US",
        "force_locale": "en_US",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - announcementcenter: 6.7.0
  - bruteforcesettings: 2.8.0
  - calendar: 4.6.3
  - circles: 28.0.0-dev
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.1
  - dashboard: 7.8.0
  - dav: 1.29.1
  - deck: 1.12.0
  - event_update_notification: 2.3.0
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - forms: 4.0.0
  - groupfolders: 16.0.2
  - groupquota: 0.1.12
  - impersonate: 1.15.0
  - ldap_write_support: 1.10.0
  - login_notes: 1.4.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - mail: 3.5.3
  - memories: 6.2.2
  - nextcloud_announcements: 1.17.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - polls: 6.0.1
  - previewgenerator: 5.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - quota_warning: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - richdocuments: 8.3.1
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - spreed: 18.0.1
  - support: 1.11.0
  - survey_client: 1.16.0
  - suspicious_login: 6.0.0
  - systemtags: 1.18.0
  - tasks: 0.15.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_ldap: 1.19.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0
  - audioplayer: 3.4.1 (installed 3.4.1)
  - contactsinteraction: 1.9.0 (installed 1.6.0)
  - encryption: 2.16.0
  - files_external: 1.20.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - firstrunwizard: 2.17.0 (installed 2.16.0)
  - guests: 3.0.1 (installed 3.0.1)
  - music: 1.9.1 (installed 1.9.1)
  - photos: 2.4.0 (installed 2.3.0)
  - richdocumentscode: 23.5.702 (installed 23.5.702)
  - twofactor_totp: 10.0.0-beta.2

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

This would be the relevant information...

{"reqId":"BtECHJ9PMNbUE0y96jnX","level":3,"time":"2024-01-16T21:57:48+00:00","remoteAddr":"192.168.1.75","user":"joe.user","app":"index","method":"POST","url":"/index.php/contactsmenu/contacts","message":"Parameter \"guestName\" for route \"core.GuestAvatar.getAvatar\" must match \"[^/]++\" (\"\" given) to generate a corresponding URL.","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"Symfony\\Component\\Routing\\Exception\\InvalidParameterException","Message":"Parameter \"guestName\" for route \"core.GuestAvatar.getAvatar\" must match \"[^/]++\" (\"\" given) to generate a corresponding URL.","Code":0,"Trace":[{"file":"/var/www/cloud.domain.tld/3rdparty/symfony/routing/Generator/UrlGenerator.php","line":161,"function":"doGenerate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/Route/Router.php","line":372,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/Route/CachingRouter.php","line":65,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/URLGenerator.php","line":103,"function":"generate","class":"OC\\Route\\CachingRouter","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/URLGenerator.php","line":115,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/Contacts/ContactsMenu/ContactsStore.php","line":345,"function":"linkToRouteAbsolute","class":"OC\\URLGenerator","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/Contacts/ContactsMenu/ContactsStore.php","line":162,"function":"contactArrayToEntry","class":"OC\\Contacts\\ContactsMenu\\ContactsStore","type":"->"},{"function":"OC\\Contacts\\ContactsMenu\\{closure}","class":"OC\\Contacts\\ContactsMenu\\ContactsStore","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/cloud.domain.tld/lib/private/Contacts/ContactsMenu/ContactsStore.php","line":161,"function":"array_map"},{"file":"/var/www/cloud.domain.tld/lib/private/Contacts/ContactsMenu/Manager.php","line":54,"function":"getContacts","class":"OC\\Contacts\\ContactsMenu\\ContactsStore","type":"->"},{"file":"/var/www/cloud.domain.tld/core/Controller/ContactsMenuController.php","line":51,"function":"getEntries","class":"OC\\Contacts\\ContactsMenu\\Manager","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OC\\Core\\Controller\\ContactsMenuController","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/cloud.domain.tld/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/cloud.domain.tld/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/cloud.domain.tld/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":194,"message":"Parameter \"guestName\" for route \"core.GuestAvatar.getAvatar\" must match \"[^/]++\" (\"\" given) to generate a corresponding URL.","exception":{},"CustomMessage":"Parameter \"guestName\" for route \"core.GuestAvatar.getAvatar\" must match \"[^/]++\" (\"\" given) to generate a corresponding URL."}}

Additional info

No response

@JRGonz JRGonz added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jan 16, 2024
@JRGonz JRGonz changed the title [Bug]: After upgrade to 28.0.1 nonstop errors regarding guestName avaatar [Bug]: After upgrade to 28.0.1 nonstop errors regarding guestName avatar Jan 16, 2024
@joshtrichards
Copy link
Member

joshtrichards commented Jan 16, 2024

I think $contact['FN']' is probably "" (empty) but not null here:

if (isset($contact['isLocalSystemBook'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $uid, 'size' => 64]);
$entry->setProperty('isUser', true);
} elseif (isset($contact['FN'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $contact['FN'], 'size' => 64]);

The route expects guestName to have a value:

['name' => 'GuestAvatar#getAvatar', 'url' => '/avatar/guest/{guestName}/{size}', 'verb' => 'GET'],

I suspect it'll go away if you change isset() to !empty().

EDIT: Might be a couple other spots where the use of isset() needs to be double-checked around the same area, but they may also not be of consequence

@JRGonz
Copy link
Author

JRGonz commented Jan 16, 2024

Any idea on the underlying cause? Is this related to LDAP auth? Is this an actual bug? Maybe a combination of the two? I just don't understand why it is pulling a guest avatar from an LDAP authenticated user. This is flooding my logs as an error and I guess 28 keeps an error in log count that doesn't go away for a week. Otherwise everything is functional but I really would like to know what this is related to.

I mean with my limited knowledge it almost looks as though it is first searching the local system side for avatars but then not finding it and then snatching the avatar from LDAP (which the server has) and plugging it in so LDAP users have avatars. Maybe I am wrong though.

@joshtrichards
Copy link
Member

joshtrichards commented Jan 17, 2024

Any idea on the underlying cause?

Outside of making that area of code noted a bit more robust to empty name fields that reach it? No.

Well, I suppose having guest users with empty name fields. :-)

Is this an actual bug?

Not sure.

Handling of empty name fields at this point in the code could be more robust. That would eliminate the error you're seeing, but unclear whether it's expected that you have guest users with empty name fields in your environment. :-)

I just don't understand why it is pulling a guest avatar from an LDAP authenticated user.

This area of code looks to be generating the contacts menu, so it's looking up everyone's avatars - including for any guests you have added - and not just the currently authenticated user's avatar.

It doesn't sound like you've experienced any other symptoms, so that's a good sign.

  • Have you created any guest users?
  • Do your guest users have empty name fields?
  • Have you used the guests app?
  • Did this problem start before - or after - the guests app was disabled?

What version of Nextcloud did you upgrade from?

EDIT: Didn't mean to close.

@JRGonz
Copy link
Author

JRGonz commented Jan 17, 2024

I created a test guest user a while back just for testing but then deleted the user. That was quite a while ago. This issue happened both when enabled and disabled. I actually disabled it at the time because I was suspecting that may possibly have been the cause. I went from 27 (latest forgot exact version) to 28.0.1. Is there a way to possibly hunt down remnants of guest users in the db and possibly remove them or from occ to check that? Maybe it's just something lingering in the db?

@JRGonz
Copy link
Author

JRGonz commented Jan 17, 2024

sudo -u www-data php --define apc.enable_cli=1 /var/www/cloud.domain.tld/occ guests:list

No guests created
An unhandled exception has been thrown:
TypeError: Return value of "OCA\Guests\Command\ListCommand::execute()" must be of the type int, "null" returned. in /var/www/cloud.domain.tld3rdparty/symfony/console/Command/Command.php:301
Stack trace:
#0 /var/www/cloud.domain.tld/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#1 /var/www/cloud.domain.tld/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#2 /var/www/cloud.domain.tld/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#3 /var/www/cloud.domain.tld/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#4 /var/www/cloud.domain.tld/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run()
#5 /var/www/cloud.domain.tld/console.php(100): OC\Console\Application->run()
#6 /var/www/cloud.domain.tld/occ(11): require_once('...')


I'm guessing because no guests exist.

joshtrichards added a commit that referenced this issue Jan 17, 2024
Fixes #42858 and makes things more robust

Signed-off-by: Josh <[email protected]>
@JRGonz
Copy link
Author

JRGonz commented Jan 17, 2024

I applied the changes manually and so far no errors in the log (which would pop up on any access to anything in the web ui). After truncating the Nextcloud log I now have a green checkmark in the admin page. I will keep an eye on it but it seems fixed.

@joshtrichards
Copy link
Member

I'm guessing because no guests exist.

No, an upstream dependency changed exit code requirements. Fix pending in nextcloud/guests#1101

backportbot-nextcloud bot pushed a commit that referenced this issue Jan 17, 2024
Fixes #42858 and makes things more robust

Signed-off-by: Josh <[email protected]>
@joshtrichards
Copy link
Member

The other matter fixed in nextcloud/guests#1102 and will be in the next release.

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 28-feedback bug feature: contacts menu
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants