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

Closed
opened 2025-11-02 07:38:48 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @AlawnCN on GitHub (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

Originally created by @AlawnCN on GitHub (Sep 13, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref):1.15.2 - Git version: - Operating system:docker gitea/gitea:1.15.2 - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ``` 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
GiteaMirror added the type/bug label 2025-11-02 07:38:48 -06:00
Author
Owner

@zeripath commented on GitHub (Sep 13, 2021):

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()
}
@zeripath commented on GitHub (Sep 13, 2021): Appears to be regression from xorm 1.2.2 - in `xorm/rows.go`:90-93 ```go // 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: ```go // 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() } ```
Author
Owner

@delvh commented on GitHub (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.

@delvh commented on GitHub (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.
Author
Owner

@zeripath commented on GitHub (Sep 14, 2021):

yup that would fix this.

@zeripath commented on GitHub (Sep 14, 2021): yup that would fix this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7838