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

[1.20.0] doctor crash with segfault #25965

Closed
tuxmaster5000 opened this issue Jul 18, 2023 · 1 comment · Fixed by #26072
Closed

[1.20.0] doctor crash with segfault #25965

tuxmaster5000 opened this issue Jul 18, 2023 · 1 comment · Fixed by #26072
Labels

Comments

@tuxmaster5000
Copy link
Contributor

Description

The call:

sudo -u gitea /opt/gitea/gitea --config /etc/gitea/app.ini doctor --all --fix

crash with segfault:

unable to open log file "": open : no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x79f9c7]

goroutine 34 [running]:
code.gitea.io/gitea/modules/util/rotatingfilewriter.(*RotatingFileWriter).Close(0x0)
	/source/modules/util/rotatingfilewriter/writer.go:91 +0x27
panic({0x2d4f220, 0x62c1980})
	/usr/local/go/src/runtime/panic.go:884 +0x213
code.gitea.io/gitea/modules/util/rotatingfilewriter.(*RotatingFileWriter).Write(0x0, {0xc002584400, 0x5c, 0x400})
	/source/modules/util/rotatingfilewriter/writer.go:72 +0x2c
code.gitea.io/gitea/modules/log.(*EventWriterBaseImpl).Run(0xc002494cc0, {0x45c6a50, 0xc0003fefe0})
	/source/modules/log/event_writer_base.go:104 +0x54e
code.gitea.io/gitea/modules/log.eventWriterStartGo.func1()
	/source/modules/log/event_writer_base.go:157 +0xb1
created by code.gitea.io/gitea/modules/log.eventWriterStartGo
	/source/modules/log/event_writer_base.go:153 +0x1c5

Running gitea as an systemd service will work fine.
Log config block:

[log]
logger.access.MODE = ,
LEVEL = Info
MODE = console
COLORIZE = false
ROOT_PATH = /var/log/gitea

Gitea Version

1.20.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

Rocky 9.2

How are you running Gitea?

Binary from GH

Database

PostgreSQL

@tuxmaster5000
Copy link
Contributor Author

set the option "--log-file -" will helps, but an segfault is not very nice.

wxiaoguang added a commit that referenced this issue Jul 25, 2023
Replace #21790

And close #25965 by the way (it needs a separate fix for 1.20)

Major changes:

1. Move "gitea convert" to "gitea doctor conver". The old "gitea doctor"
still works as a hidden sub-command (to avoid breaking)
2. Do not write "doctor.log" by default, it's not useful in most cases
and causes bugs like 25965
3. Improve documents
4. Fix the "help" commands. Before, the "./gitea doctor" can't show the
sub-command help correctly (regression of the last cli/v2 refactoring)

After this PR:

```
./gitea help # show all sub-commands for the app
./gitea doctor # show the sub-commands for the "doctor"
./gitea doctor help # show the sub-commands for the "doctor", as above
```
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant