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

gitea doctor --run output is sometime truncated #19969

Closed
silentcodeg opened this issue Jun 14, 2022 · 2 comments · Fixed by #19982
Closed

gitea doctor --run output is sometime truncated #19969

silentcodeg opened this issue Jun 14, 2022 · 2 comments · Fixed by #19982
Labels

Comments

@silentcodeg
Copy link
Contributor

Description

Steps to reproduce:

  • docker run --name gitea -p 3000:3000 -e GITEA__security__INSTALL_LOCK=true -d gitea/gitea:1.16.8-rootless
  • docker exec gitea gitea admin user create --admin --username root --password admin1234 --email root@example.com
  • docker exec gitea mkdir /var/lib/gitea/data/log
  • go to the web interface to create a test repository, with an initial README.md file
  • docker exec gitea mv /var/lib/gitea/git/repositories/root/test.git /var/lib/gitea/git/repositories/root/other.git
  • docker exec gitea gitea doctor --run hooks

What is expected?

$ docker exec gitea gitea doctor --run hooks
[1] Check if hook files are up-to-date and executable
 - [W] old hook file /var/lib/gitea/git/repositories/root/test.git/hooks/pre-receive does not exist
 - [W] hooks directory /var/lib/gitea/git/repositories/root/test.git/hooks/pre-receive.d does not exist
 - [W] new hook file /var/lib/gitea/git/repositories/root/test.git/hooks/pre-receive.d/gitea does not exist
 - [W] old hook file /var/lib/gitea/git/repositories/root/test.git/hooks/update does not exist
 - [W] hooks directory /var/lib/gitea/git/repositories/root/test.git/hooks/update.d does not exist
 - [W] new hook file /var/lib/gitea/git/repositories/root/test.git/hooks/update.d/gitea does not exist
 - [W] old hook file /var/lib/gitea/git/repositories/root/test.git/hooks/post-receive does not exist
 - [W] hooks directory /var/lib/gitea/git/repositories/root/test.git/hooks/post-receive.d does not exist
 - [W] new hook file /var/lib/gitea/git/repositories/root/test.git/hooks/post-receive.d/gitea does not exist
OK

What actually happens?

The output is truncated, the line with OK is never shown and other lines are truncated randomly:

$ docker exec gitea gitea doctor --run hooks
[1] Check if hook files are up-to-date and executable
 - [W] old hook file /var/lib/gitea/git/repositories/root/test.git/hooks/pre-receive does not exist

Gitea Version

1.16.8

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

Operating System

How are you running Gitea?

Database

SQLite

@wxiaoguang
Copy link
Contributor

Just a guess, the doctor logger writes to Stdout, and in its Flush it does nothing, then the content is still in the buffer ....

Gusted pushed a commit to Gusted/gitea that referenced this issue Jun 15, 2022
- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves go-gitea#19969
@Gusted
Copy link
Contributor

Gusted commented Jun 15, 2022

TL;DR It's resolved in #19982

To give some more info to this issue, while debugging I noticed that at a certain point message are just lost, they don't appear where they should be going. So my terminal crying of debug statements, I found the point where messages prefer to be in the void than being printed.

case l.queue <- event:
is the last codepath where all message will still be present, from there on, sometimes message just don't appear up again, therefor
case event, ok := <-m.queue:
is the start of the codepath whereby not all messages would be present. I'm not really sure of why some messages are somewhere in the void, but I did found out that this particular log had a huge buffer and reducing that to a non-buffer, the issue completely disappeared.

If you would like to waste your time(Please note that not all SENDING will be RECEIVED due to log levels etc.):

diff --git a/modules/log/event.go b/modules/log/event.go
index f66ecd179..0afb4e6bc 100644
--- a/modules/log/event.go
+++ b/modules/log/event.go
@@ -328,6 +328,7 @@ func (m *MultiChannelledLog) Start() {
                                m.level = INFO
                        }
                case event, ok := <-m.queue:
+                       fmt.Printf("RECEIVING: %t, %#v\n", ok, *event)
                        if !ok {
                                m.closeLoggers()
                                return
@@ -359,6 +360,7 @@ func (m *MultiChannelledLog) Start() {
 
 // LogEvent logs an event to this MultiChannelledLog
 func (m *MultiChannelledLog) LogEvent(event *Event) error {
+       fmt.Printf("SENDING: %#v\n", *event)
        select {
        case m.queue <- event:
                return nil

wxiaoguang pushed a commit that referenced this issue Jun 16, 2022
- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves #19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
vsysoev pushed a commit to IntegraSDL/gitea that referenced this issue Aug 10, 2022
- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves go-gitea#19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 24, 2022
- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves go-gitea#19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 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.

3 participants