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

NPE in routers/web/feed/profile.go:37 on 1.16.7 following failed migration #19631

Closed
zeripath opened this issue May 6, 2022 · 4 comments · Fixed by #19598 or #19629
Closed

NPE in routers/web/feed/profile.go:37 on 1.16.7 following failed migration #19631

zeripath opened this issue May 6, 2022 · 4 comments · Fixed by #19598 or #19629
Labels

Comments

@zeripath
Copy link
Contributor

zeripath commented May 6, 2022

Extract from a comment in #19613

2022/05/05 20:06:26 ...s/graceful/server.go:61:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 16
2022/05/05 20:06:46 Started GET / for 10.###.###.###:0
2022/05/05 20:06:46 routers/web/base.go:130:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:220 (0x457635)
/usr/local/go/src/runtime/signal_unix.go:818 (0x457605)
/go/src/code.gitea.io/gitea/routers/web/feed/profile.go:37 (0x1fbb59c)
/go/src/code.gitea.io/gitea/routers/web/user/home.go:134 (0x1fd20d2)
/go/src/code.gitea.io/gitea/routers/web/home.go:41 (0x2034770)
/go/src/code.gitea.io/gitea/modules/web/route.go:74 (0x1e47d44)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/[email protected]/mux.go:442 (0x1656dd5)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
...

The migration consists of pushing cloned repo's from GitHub into Gitea, the repo's are created using the API and data transferred using Git https.

Now that I have migrated a few more repo's, the 500 error on the landing page is gone. Presumably because whatever was causing it is not longer shown on it.

Originally posted by @number42net in #19613 (comment)

@zeripath
Copy link
Contributor Author

zeripath commented May 6, 2022

The line in 1.16 is:

repoOwner, ok := userCache[act.Repo.OwnerID]

And implies that act.Repo is nil which would imply that it was not being set in here:

func (actions ActionList) loadRepositories(e db.Engine) ([]*repo_model.Repository, error) {
if len(actions) == 0 {
return nil, nil
}
repoIDs := actions.getRepoIDs()
repoMaps := make(map[int64]*repo_model.Repository, len(repoIDs))
err := e.
In("id", repoIDs).
Find(&repoMaps)
if err != nil {
return nil, fmt.Errorf("find repository: %v", err)
}
for _, action := range actions {
action.Repo = repoMaps[action.RepoID]
}
return valuesRepository(repoMaps), nil
}

Likely because the repository does not exist.

Now, this code has changed a lot on main, so whilst there's a clear fix in 1.16 I'm not sure if 1.17 is affected.

@zeripath
Copy link
Contributor Author

zeripath commented May 6, 2022

and in fact it appears that this is very likely related to #19598

@number42net
Copy link

@zeripath Thanks for opening this and for looking into it!

@Gusted
Copy link
Contributor

Gusted commented May 11, 2022

PR's are merged, but for some reason Github didn't think about closing the linked issue.

@Gusted Gusted closed this as completed May 11, 2022
@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
3 participants