gogs/gogs

panic: runtime error: invalid memory address or nil pointer dereference - push commit

lota opened this issue ยท 4 comments

lota commented

Gogs version

0.14.0+dev

Git version

  • Server: 2.30.2
  • Client: 2.39.2

Operating system

Debian Linux

Database

mariadb

Describe the bug

after last upgrade on push we gets db errors messages (app.ini is ok, gogs-web works fine but not register commit)

strace

remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf04e3e]
remote: 
remote: goroutine 1 [running]:
remote: gogs.io/gogs/internal/database.(*DB).Actions(...)
remote: 	/tmp/d20240319-59-ybp1io/opt/gogs/internal/database/database.go:161
remote: gogs.io/gogs/internal/database.PushUpdate({{0xc0004535c0, 0x28}, {0xc0004535f0, 0x28}, {0xc00043ed20, 0x11}, 0x4, {0xc0000460bc, 0x4}, {0xc00004a035, ...}, ...})
remote: 	/tmp/d20240319-59-ybp1io/opt/gogs/internal/database/update.go:130 +0x63e
remote: gogs.io/gogs/internal/cmd.runHookPostReceive(0xc0004bb760?)
remote: 	/tmp/d20240319-59-ybp1io/opt/gogs/internal/cmd/hook.go:229 +0x398
remote: github.com/urfave/cli.HandleAction({0x135f5a0?, 0x2704b58?}, 0xc?)
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:524 +0x50
remote: github.com/urfave/cli.Command.Run({{0x1564ec0, 0xc}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x158c436, 0x1e}, {0x0, ...}, ...}, ...)
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:175 +0x67b
remote: github.com/urfave/cli.(*App).RunAsSubcommand(0xc0004af180, 0xc0004bb4a0)
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:405 +0xe87
remote: github.com/urfave/cli.Command.startApp({{0x1551303, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x15a4cd9, 0x2c}, {0x0, ...}, ...}, ...)
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:380 +0xb7f
remote: github.com/urfave/cli.Command.Run({{0x1551303, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x15a4cd9, 0x2c}, {0x0, ...}, ...}, ...)
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:103 +0x845
remote: github.com/urfave/cli.(*App).Run(0xc0004aefc0, {0xc000040040, 0x4, 0x4})
remote: 	/my/cache/go-path/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:277 +0xb87
remote: main.main()
remote: 	/tmp/d20240319-59-ybp1io/opt/gogs/gogs.go:39 +0x428
To ssh://git.nonlontano.it:10022/lota/lota
   0100c81..c11ac0d  master -> master

Alessandro

To reproduce

install gogs from package https://packager.io/gh/gogs/gogs
on debian 11 or debian 12 system

Expected behavior

commit woks without erros

Additional context

I am testing a stable package here
https://packager.io/gh/lota/gogs-new

Code of Conduct

  • I agree to follow this project's Code of Conduct

Thanks, is it confirmed a bug? I thought I wanted to revert to a backup as I thought I caused it?
Is my DB corrupted or would an update fix it as soon fix has been made or unknown yet?
Anyway I can help out?

Thanks ๐Ÿ˜Š

Here is my version of the error:

PS C:\git\Sample> git push -u origin master

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 32 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.13 KiB | 1.13 MiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)

remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xea4497]
remote:
remote: goroutine 1 [running]:
remote: gogs.io/gogs/internal/database.(*DB).Actions(...)
remote:         gogs.io/gogs/internal/database/database.go:161
remote: gogs.io/gogs/internal/database.PushUpdate({{0xc000708390, 0x28}, {0xc0007083c0, 0x28}, {0xc00062d488, 0x11}, 0x1, {0xc00004e034, 0x6}, {0xc00004e015, ...}, ...})
remote:         gogs.io/gogs/internal/database/update.go:130 +0x5f7
remote: gogs.io/gogs/internal/cmd.runHookPostReceive(0xc0004831e0?)
remote:         gogs.io/gogs/internal/cmd/hook.go:229 +0x37d
remote: github.com/urfave/cli.HandleAction({0x13114c0?, 0x26ba9d0?}, 0xc?)
remote:         github.com/urfave/cli@v1.22.14/app.go:524 +0x50
remote: github.com/urfave/cli.Command.Run({{0x151b1cb, 0xc}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1543241, 0x1e}, {0x0, ...}, ...}, ...)
remote:         github.com/urfave/cli@v1.22.14/command.go:175 +0x63e
remote: github.com/urfave/cli.(*App).RunAsSubcommand(0xc0000c6e00, 0xc000482f20)
remote:         github.com/urfave/cli@v1.22.14/app.go:405 +0xe07
remote: github.com/urfave/cli.Command.startApp({{0x15091c6, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x155be5e, 0x2c}, {0x0, ...}, ...}, ...)
remote:         github.com/urfave/cli@v1.22.14/command.go:380 +0xb58
remote: github.com/urfave/cli.Command.Run({{0x15091c6, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x155be5e, 0x2c}, {0x0, ...}, ...}, ...)
remote:         github.com/urfave/cli@v1.22.14/command.go:103 +0x7e5
remote: github.com/urfave/cli.(*App).Run(0xc0000c6c40, {0xc000122100, 0x4, 0x4})
remote:         github.com/urfave/cli@v1.22.14/app.go:277 +0xb27
remote: main.main()
remote:         gogs.io/gogs/gogs.go:39 +0x405

Thanks for the report!

Looking into it ๐Ÿ‘€

Thanks again for the report!

#7699 has been merged that should address the panic. I am not sure how long it takes for the whatever package manager you use to pick up the changes tho...

Thanks for fixing! This was really bothering me.