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

runtime error: invalid memory address or nil pointer dereference #17030

Closed
2 of 6 tasks
AlawnCN opened this issue Sep 13, 2021 · 3 comments · Fixed by #17068
Closed
2 of 6 tasks

runtime error: invalid memory address or nil pointer dereference #17030

AlawnCN opened this issue Sep 13, 2021 · 3 comments · Fixed by #17068
Labels

Comments

@AlawnCN
Copy link

AlawnCN commented Sep 13, 2021

  • Gitea version (or commit ref):1.15.2
  • Git version:
  • Operating system:docker gitea/gitea:1.15.2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
```
2021/09/12 17:50:21 ...odels/repo_mirror.go:117:MirrorsIterate() [I] [SQL] SELECT `id`, `repo_id`, `interval`, `enable_prune`, `updated_unix`, `next_update_unix`, `lfs_enabled`, `lfs_endpoint` FROM `mirror` WHERE (next_update_unix<=?) AND (next_update_unix!=0) [1631469021] - 25.421658ms
2021/09/12 17:50:21 .../graceful/manager.go:135:func1() [C] PANIC during RunWithShutdownContext: runtime error: invalid memory address or nil pointer dereference
    Stacktrace: /usr/local/go/src/runtime/panic.go:212 (0x43ea5a)
    /usr/local/go/src/runtime/signal_unix.go:734 (0x458a32)
    /go/src/code.gitea.io/gitea/vendor/xorm.io/xorm/rows.go:92 (0xc2235b)
    /go/src/code.gitea.io/gitea/vendor/xorm.io/xorm/rows.go:142 (0xc22367)
    /go/src/code.gitea.io/gitea/vendor/xorm.io/xorm/rows.go:78 (0xc21811)
    /go/src/code.gitea.io/gitea/vendor/xorm.io/xorm/session_iterate.go:19 (0xc41316)
    /go/src/code.gitea.io/gitea/vendor/xorm.io/xorm/session_iterate.go:38 (0xc412f3)
    /go/src/code.gitea.io/gitea/models/repo_mirror.go:117 (0x146012c)
    /go/src/code.gitea.io/gitea/services/mirror/mirror.go:55 (0x2009284)
    /go/src/code.gitea.io/gitea/modules/cron/tasks_basic.go:25 (0x2018374)
    /go/src/code.gitea.io/gitea/modules/cron/tasks.go:88 (0x2017c21)
    /go/src/code.gitea.io/gitea/modules/graceful/manager.go:139 (0xc61685)
    /go/src/code.gitea.io/gitea/modules/cron/tasks.go:82 (0x2015ba4)
    /go/src/code.gitea.io/gitea/modules/cron/tasks.go:56 (0x2015a27)
    /go/src/code.gitea.io/gitea/vendor/github.com/gogs/cron/cron.go:171 (0x2004498)
    /usr/local/go/src/runtime/asm_amd64.s:1371 (0x47b360)
    
2021/09/12 17:50:21 ...eue/queue_channel.go:98:func1() [W] ChannelQueue: task-channel Terminated before completed flushing
2021/09/12 17:50:21 ...eue/queue_channel.go:98:func1() [W] ChannelQueue: push_update-channel Terminated before completed flushing
2021/09/12 17:50:21 ...eue/queue_channel.go:98:func1() [W] ChannelQueue: mail-channel Terminated before completed flushing
2021/09/12 17:50:21 ...eue/queue_channel.go:98:func1() [W] ChannelQueue: notification-service-channel Terminated before completed flushing
2021/09/12 17:50:21 ...eful/server_hooks.go:47:doShutdown() [I] PID: 18 Listener ([::]:3000) closed.
2021/09/12 17:50:21 .../graceful/manager.go:226:doHammerTime() [W] Setting Hammer condition
2021/09/12 17:50:21 cmd/web.go:244:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
2021/09/12 17:50:22 .../graceful/manager.go:243:doTerminate() [W] Terminating
2021/09/12 17:50:22 ...er/issues/indexer.go:169:2() [I] PID: 18 Issue Indexer closed
2021/09/12 17:50:22 cmd/web.go:161:runWeb() [I] PID: 18 Gitea Web Finished
```

Description

see log above

Screenshots

@zeripath
Copy link
Contributor

Appears to be regression from xorm 1.2.2 - in xorm/rows.go:90-93

// Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.
func (rows *Rows) Err() error {
	return rows.rows.Err()
}

Should probably be:

// Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.
func (rows *Rows) Err() error {
	if rows.rows == nil {
		return nil
	}
	return rows.rows.Err()
}

@delvh
Copy link
Member

delvh commented Sep 13, 2021

I think https://gitea.com/xorm/xorm/pulls/2046 fixed that bug upstream, so the only thing left to do is upgrade xorm once a patched version is released.

@zeripath
Copy link
Contributor

yup that would fix this.

@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants