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

Internal Server Error Decoding Failed readObjectStart: expect { or n, but found <, error found in #2 when pushing #31311

Closed
neubreed opened this issue Jun 10, 2024 · 4 comments · Fixed by #31333
Labels
issue/workaround it is or has a workaround type/bug
Milestone

Comments

@neubreed
Copy link

Description

I have a new installation using Docker and have imported repositories using unadopted repositories

I'm able to push to most of them, however for a couple of repos I'm getting the following errors, and am unable to rectify:

Output from the push

$ git push origin master
Enumerating objects: 837, done.
Counting objects: 100% (837/837), done.
Delta compression using up to 2 threads
Compressing objects: 100% (439/439), done.
Writing objects: 100% (450/450), 108.70 KiB | 2.42 MiB/s, done.
Total 450 (delta 358), reused 5 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (358/358), completed with 322 local objects.
remote:
remote: Gitea: Internal Server Error Decoding Failed
remote: Gitea: HookPreReceive(last) failed: unable to decode error response "POST http://localhost:3000/api/internal/hook/pre-receive/clients/roadworx": readObjectStart: expect { or n, but found <, error found in #2 byte of ...|
remote: <!DOCTYPE h|..., bigger context ...|
remote: <!DOCTYPE html>
remote: <html lang="en-US" data-theme="gite|...
To ssh://gitea.xxx.xxx:222/clients/roadworx.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://gitea.xxx.xxx:222/clients/roadworx.git'

Logs

2024/06/11 07:14:41 ...eb/routing/logger.go:78:func1() [W] router: failed    POST /api/internal/hook/pre-receive/clients/roadworx for 172.27.0.2:0, panic in 8.7ms @ private/hook_pre_receive.go:105(private.HookPreReceive), err=runtime error: invalid memory address or nil pointer dereference
2024/06/11 07:14:41 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference

I've looked through all past issues similar to this but couldn't find a solution.

Cheers,
Ryan

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Docker

How are you running Gitea?

Using docker

Database

MySQL/MariaDB

@wxiaoguang
Copy link
Contributor

2024/06/11 07:14:41 ...eb/routing/logger.go:78:func1() [W] router: failed POST /api/internal/hook/pre-receive/clients/roadworx for 172.27.0.2:0, panic in 8.7ms @ private/hook_pre_receive.go:105(private.HookPreReceive), err=runtime error: invalid memory address or nil pointer dereference
2024/06/11 07:14:41 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference

The logs are really helpful. Do you have more logs? There should be more stacktrace lines below.

@neubreed
Copy link
Author

hey .. sorry didn't know what you needed .. I didn't want to flood with unnecessary dumpage

This is everything after I did the push

Accepted publickey for git from 172.27.0.2 port 48554 ssh2: RSA SHA256:oqHVLMBXjU9vjyCB3H+j41k6PEMi+wF8SoFIjoBupqA
2024/06/11 15:00:03 ...ters/private/serv.go:384:ServCommand() [D] Serv Results:
IsWiki: false
DeployKeyID: 0
KeyID: 1        KeyName: rsa-key-gitea
UserName: ryan
UserID: 1
OwnerName: clients
RepoName: roadworx
RepoID: 31
2024/06/11 15:00:03 ...eb/routing/logger.go:102:func1() [I] router: completed GET /api/internal/serv/command/1/clients/roadworx?mode=2&verb=git-receive-pack for 172.27.0.2:0, 200 OK in 5.3ms @ private/serv.go:79(private.ServCommand)
2024/06/11 15:00:04 ...dules/git/command.go:291:Run() [D] git.Command.RunDir(/data/git/repositories/clients/roadworx.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse
2024/06/11 15:00:04 ...dules/git/command.go:291:Run() [D] git.Command.RunDir(/data/git/repositories/clients/roadworx.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch
2024/06/11 15:00:04 ...dules/git/command.go:291:Run() [D] git.Command.RunDir(/data/git/repositories/clients/roadworx.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check
2024/06/11 15:00:04 ...eb/routing/logger.go:78:func1() [W] router: failed    POST /api/internal/hook/pre-receive/clients/roadworx for 172.27.0.2:0, panic in 6.7ms @ private/hook_pre_receive.go:105(private.HookPreReceive), err=runtime error: invalid memory address or nil pointer dereference
2024/06/11 15:00:04 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:770 (0x441111)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:116 (0x1cedda8)
/usr/local/go/src/runtime/panic.go:770 (0x441111)
/usr/local/go/src/runtime/panic.go:261 (0x45a9b7)
/usr/local/go/src/runtime/signal_unix.go:881 (0x45a985)
/go/src/code.gitea.io/gitea/routers/private/hook_pre_receive.go:150 (0x261d557)
/go/src/code.gitea.io/gitea/routers/private/hook_pre_receive.go:122 (0x261d268)
/usr/local/go/src/reflect/value.go:596 (0x4ff165)
/usr/local/go/src/reflect/value.go:380 (0x4fe278)
/go/src/code.gitea.io/gitea/modules/web/handler.go:172 (0x1cf79bc)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:182 (0x1cf7a5b)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:182 (0x1cf7a5b)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/chain.go:31 (0x1cee805)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:459 (0x1cf17a5)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/middleware/realip.go:36 (0x2613f54)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/routers/private/internal.go:35 (0x2623aef)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/services/context/private.go:72 (0x262c978)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:73 (0x1cef3ae)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:327 (0x1cf0d3a)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:459 (0x1cf17a5)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:122 (0x1cedc4a)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x254d8d3)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:49 (0x254ec4f)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:40 (0x254e7db)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:103 (0x254dc35)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/src/code.gitea.io/gitea/modules/web/handler.go:136 (0x1cf7e59)
/usr/local/go/src/net/http/server.go:2166 (0x9ed148)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:90 (0x1cef36d)
/go/src/code.gitea.io/gitea/modules/web/route.go:163 (0x1cf9267)
/usr/local/go/src/net/http/server.go:3137 (0x9f084d)
/usr/local/go/src/net/http/server.go:2039 (0x9ebb27)
/usr/local/go/src/runtime/asm_amd64.s:1695 (0x47cca0)
2024/06/11 15:00:04 ...s/private/ssh_log.go:26:SSHLog() [E] ssh: Internal Server Error Decoding Failed. HookPreReceive(last) failed: unable to decode error response "POST http://localhost:3000/api/internal/hook/pre-receive/clients/roadworx": readObjectStart: expect { or n, but found <, error found in #2 byte of ...|
<!DOCTYPE h|..., bigger context ...|
<!DOCTYPE html>
<html lang="en-US" data-theme="gite|...
2024/06/11 15:00:04 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/log for 172.27.0.2:0, 200 OK in 0.1ms @ private/ssh_log.go:17(private.SSHLog)
2024/06/11 15:00:04 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/1/update/31 for 172.27.0.2:0, 200 OK in 6.5ms @ private/key.go:16(private.UpdatePublicKeyInRepo)
Received disconnect from 172.27.0.2 port 48554:11: disconnected by user
Disconnected from user git 172.27.0.2 port 48554

@wxiaoguang
Copy link
Contributor

/go/src/code.gitea.io/gitea/routers/private/hook_pre_receive.go:150 (0x261d557)
/go/src/code.gitea.io/gitea/routers/private/hook_pre_receive.go:122 (0x261d268)

Thank you very much. Here, it is the crash point ..... It is related to the SHA256 support and related refactors.

The problem should be fixed, while I guess there might be a workaround, could you try to "sync branches" from the admin dashboard panel?

@neubreed
Copy link
Author

No, thank you!

I'm guessing it's the option "Sync missed branches from git data to databases"

And it worked!

Many thanks
Ryan

@lunny lunny added the issue/workaround it is or has a workaround label Jun 11, 2024
@lunny lunny added this to the 1.22.1 milestone Jun 12, 2024
@lunny lunny closed this as completed in 1968c22 Jun 12, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jun 12, 2024
Fix go-gitea#31330
Fix go-gitea#31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.
silverwind pushed a commit that referenced this issue Jun 12, 2024
Backport #31333 by @lunny

Fix #31330
Fix #31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 10, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Fix adopt repository has empty object name in database (go-gitea#31333)

Fix go-gitea#31330
Fix go-gitea#31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.

(cherry picked from commit 1968c22)

With tests services/repository/adopt_test.go

(cherry picked from commit 8efef06)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/workaround it is or has a workaround type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants