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

Error 500 when accessing branches in repo #29936

Closed
davama opened this issue Mar 20, 2024 · 3 comments · Fixed by #29938
Closed

Error 500 when accessing branches in repo #29936

davama opened this issue Mar 20, 2024 · 3 comments · Fixed by #29938
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@davama
Copy link

davama commented Mar 20, 2024

Description

Good Day,

Hope I've posted all relevant info.

We have a repo inside an org, which does not allow us to view its branches via the UI. We had several branches that were automatically created with our pipeline via the API. We've been doing this for several months now. Only yesterday we noticed that we could not see the branches in the UI (this was never the case before). We were under version 1.21.7 and were hoping updating to 1.21.8 would help, but nothing.

Since we could see all the branches via the API, we decided to delete all the branches via API except for main. Now only main shows via the API. Interestingly under the UI, it still shows that 2 Branches exists. (see screenshots)

When i click on the tto-device-discovery branch, i get a 404 not found code page, which should be correct (see screenshot)

Looking at other tickets, i check permissions on the filesystem, but nothing interesting

git-1:/data/git/repositories/sot/netbox-sot.git$ pwd
/data/git/repositories/sot/netbox-sot.git
git-1:/data/git/repositories/sot/netbox-sot.git$ ls -al
total 196
drwxr-xr-x    8 git      git            150 Mar 20 13:22 .
drwxr-xr-x   14 git      git           4096 Mar  6 23:04 ..
-rw-r--r--    1 git      git             21 May  9  2023 HEAD
drwxr-xr-x    2 git      git              6 May  9  2023 branches
-rw-r--r--    1 git      git             66 Mar 20 13:22 config
-rw-r--r--    1 git      git             73 May  9  2023 description
drwxr-xr-x    6 git      git           4096 Mar 17 02:07 hooks
drwxr-xr-x    2 git      git             33 Mar 20 13:24 info
drwxr-xr-x    3 git      git             30 Mar 19 11:26 logs
drwxr-xr-x  260 git      git           8192 Mar 20 13:24 objects
-rw-r--r--    1 git      git         164524 Mar 20 13:22 packed-refs
drwxr-xr-x    5 git      git             43 Jul 17  2023 refs

Anything I can do to resolve this?

Below are the logs

2024/03/20 12:56:57 ...repository/branch.go:141:loadOneBranch() [E] CountDivergingCommits: exit status 128 - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
 - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
2024/03/20 12:56:57 ...eb/routing/logger.go:78:func1() [W] router: failed    GET /sot/netbox-sot/branches for [<redacted>]:0, panic in 65.6ms @ repo/branch.go:37(repo.Branches), err=runtime error: invalid memory address or nil pointer dereference
2024/03/20 12:56:57 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:914 (0x43eefe)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:116 (0x1ab40e8)
/usr/local/go/src/runtime/panic.go:914 (0x43eefe)
/usr/local/go/src/runtime/panic.go:261 (0x4566b7)
/usr/local/go/src/runtime/signal_unix.go:861 (0x456685)
/go/src/code.gitea.io/gitea/services/repository/branch.go:187 (0x1e3c44e)
/go/src/code.gitea.io/gitea/services/repository/branch.go:103 (0x1e3b88e)
/go/src/code.gitea.io/gitea/routers/web/repo/branch.go:56 (0x251de6f)
/usr/local/go/src/reflect/value.go:596 (0x4f23a6)
/usr/local/go/src/reflect/value.go:380 (0x4f1478)
/go/src/code.gitea.io/gitea/modules/web/handler.go:166 (0x1abd75b)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/chain.go:31 (0x1ab4745)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/middleware/get_head.go:37 (0x24e917b)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/context/context.go:223 (0x1bd1d0e)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20230613035928-39541325faa3/session.go:257 (0x1b2a755)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:122 (0x1ab3f78)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x2433fd3)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:46 (0x24351f2)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:37 (0x2434d75)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:100 (0x2434335)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:90 (0x1ab52f4)
/go/src/code.gitea.io/gitea/modules/web/route.go:163 (0x1abee27)
/usr/local/go/src/net/http/server.go:2938 (0x9a6f8d)
/usr/local/go/src/net/http/server.go:2009 (0x9a2e73)
/usr/local/go/src/runtime/asm_amd64.s:1650 (0x475b00)

Screenshots

2024-03-20_09-12
2024-03-20_09-16
2024-03-20_09-20

Gitea Version

1.21.8

Can you reproduce the bug on the Gitea demo site?

No

Operating System

Rocky Linux 9 (gitea inside docker)

Browser Version

Google Chrome Version 120.0.6099.224 (Official Build) (64-bit)

@davama davama added topic/ui Change the appearance of the Gitea UI type/bug labels Mar 20, 2024
@wxiaoguang
Copy link
Contributor

Maybe it could be "fixed" by "Fix loadOneBranch panic #29938"

@wxiaoguang
Copy link
Contributor

Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches.

@davama
Copy link
Author

davama commented Mar 20, 2024

Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches.

@wxiaoguang
thank you for the quick reply and PR!!

I clicked on Sync missed branches from git data to databases not sure if the same...

But now I dont get the Error 500!! Woohoo!

wxiaoguang added a commit that referenced this issue Mar 20, 2024
Backport #29938

Try to fix #29936

Far from ideal, but still better than panic.
lafriks pushed a commit that referenced this issue Mar 20, 2024
Try to fix #29936

Far from ideal, but still better than panic.
silverwind pushed a commit to lunny/gitea that referenced this issue Mar 20, 2024
Try to fix go-gitea#29936

Far from ideal, but still better than panic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants