Skip to content

error calling AvatarLink: runtime error: invalid memory address or nil pointer dereference #22516

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

Closed
renothing opened this issue Jan 18, 2023 · 7 comments
Labels

Comments

@renothing
Copy link
Contributor

renothing commented Jan 18, 2023

Description

homepage render 500 after upgraded to 1.18.1

2023/01/18 20:48:53 ...s/context/context.go:220:HTML() [D] [63c85b34] Template: user/dashboard/dashboard
2023/01/18 20:48:53 ...user/notification.go:46:func1() [I] [63c85b34] [SQL] SELECT count(*) FROM `notification` WHERE (user_id = ?) AND (status = ?) [1 1] - 1.62181ms
2023/01/18 20:48:53 ...ls/system/setting.go:122:GetSettings() [I] [63c85b34] [SQL] SELECT `id`, `setting_key`, `setting_value`, `version`, `created`, `updated` FROM `system_setting` WHERE setting_key IN (?) [picture.disable_gravatar] - 1.402161ms
2023/01/18 20:48:53 ...bce556200f/engine.go:1244:Get() [I] [63c85b34] [SQL] SELECT `id`, `uid`, `email`, `lower_email`, `is_activated`, `is_primary` FROM `email_address` WHERE `lower_email`=? LIMIT 1 [[email protected]] - 1.397ms
2023/01/18 20:48:53 ...ls/system/setting.go:122:GetSettings() [I] [63c85b34] [SQL] SELECT `id`, `setting_key`, `setting_value`, `version`, `created`, `updated` FROM `system_setting` WHERE setting_key IN (?) [picture.enable_federated_avatar] - 1.352367ms
2023/01/18 20:48:53 ...s/context/context.go:233:HTML() [E] [63c85b34] Render failed: template: user/dashboard/feeds:91:29: executing "user/dashboard/feeds" at <$push.AvatarLink>: error calling AvatarLink: runtime error: invalid memory address or nil pointer dereference
2023/01/18 20:48:53 ...s/context/context.go:220:HTML() [D] [63c85b34] Template: status/500

settings

[picture]
DISABLE_GRAVATAR   = true
AVATAR_UPLOAD_PATH = /data/gitea/avatars
[server]
OFFLINE_MODE       = true
DISABLE_ROUTER_LOG = true

Gitea Version

1.18.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

image

Git Version

2.36.3

Operating System

docker

How are you running Gitea?

we use official docker image gitea/gitea

Database

MySQL

@twisted-nematic57
Copy link

twisted-nematic57 commented Jan 19, 2023

I'm using postgresql on arm64 ubuntu 22.04, everything's at latest version. Can reproduce the issue. This only occurs when the user is logged in, so users that are not logged in can still see the homepage just fine.

Everything else works fine AFAIK. Tested all tabs of the admin UI, and a few trivial Git actions on test repos.

Edit: It seems to fail when loading user icons that are from Git users that don't exist in the Gitea database. For example in my mirror of the Linux kernel source, Torvalds had his profile picture set on Github and that displayed fine in the mirror on 1.18. But now it fails because he's not registered as a user on my instance. It also attempts to display the profile pic of the person who committed recently on the homepage when I'm logged in so that also triggers the same error that the person who's posting got.

My profile picture displays fine in some places but fails in others. For example on my repository's homepage my committer profile pic is showing but when I click on the list of commits I get a slightly different nil pointer dereference error:
2023/01/18 16:26:29 ...s/context/context.go:233:HTML() [E] [63c88e35] Render failed: template: repo/commit_page:166:9: executing "repo/commit_page" at <avatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "mr-3">: error calling avatarByEmail: runtime error: invalid memory address or nil pointer dereference So I can clearly see it's something about a wrongfully dereferenced pointer that points to whatever avatarByEmail was looking for.

Rolling back to 1.18 for now.

@crystalcommunication
Copy link
Contributor

Disabling Gravatar works around the problem

@twisted-nematic57
Copy link

twisted-nematic57 commented Jan 19, 2023

Nope, disabling Gravatar does not fix the problem. Set DISABLE_GRAVATAR = true in [picture], still no avail.

@jolheiser
Copy link
Member

Since this is 1.18.x you will need to change it in the admin config page.

@twisted-nematic57
Copy link

Got it. Disabling Gravatar from the admin page worked and it didn't even need a restart to get fixed. Thanks!

However now I can't see external contributors' profile pics. This is just a temporary workaround.

@lunny
Copy link
Member

lunny commented Jan 19, 2023

This has been fixed in coming v1.18.2.

@wolfogre
Copy link
Member

Fixed by #22479

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants