opencloud
opencloud copied to clipboard
inoitifywaitgo logs every event
Describe the bug
Currently, the inotifywaitgo package logs every event with the std log module: https://github.com/pablodz/inotifywaitgo/blob/main/inotifywaitgo/watcher.go#L57C1-L57C20
Steps to reproduce
- open https://ci.opencloud.eu/repos/4/pipeline/74/124
- wait
- see 90k lines of log
Expected behavior
no log lines, maybe in debug mode
Actual behavior
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,CREATE,.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info2332882244
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,"CLOSE_WRITE,CLOSE",.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info2332882244
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,DELETE,.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info2332882244
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,CREATE,.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info7868000834917243878
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,"CLOSE_WRITE,CLOSE",.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info7868000834917243878
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,MOVED_FROM,.23c3ae8a-e09d-4f9a-a994-778a3dae163f.info7868000834917243878
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,MOVED_TO,23c3ae8a-e09d-4f9a-a994-778a3dae163f.info
2025/10/27 17:07:32 /woodpecker/src/reva/data/uploads/,"CLOSE_WRITE,CLOSE",23c3ae8a-e09d-4f9a-a994-778a3dae163f
2025/10/27 17:07:32 /woodpecker/src/reva/data/users/2b832d80-47a3-1040-843a-e9d05cb2381a/.oc-nodes/locks/,CREATE,13e1eb28-8c35-451b-81f6-88ba8fe9a92a.mlock
we should submit a PR.
an ugly hack would be
diff --git a/pkg/storage/fs/posix/tree/inotifywatcher.go b/pkg/storage/fs/posix/tree/inotifywatcher.go
index cbf146d1c..2ae02413b 100644
--- a/pkg/storage/fs/posix/tree/inotifywatcher.go
+++ b/pkg/storage/fs/posix/tree/inotifywatcher.go
@@ -22,6 +22,8 @@ package tree
import (
"fmt"
+ "io"
+ "log"
"os"
"path/filepath"
"strconv"
@@ -59,6 +61,9 @@ func (iw *InotifyWatcher) Watch(path string) {
events := make(chan inotifywaitgo.FileEvent)
errors := make(chan error)
+ // discard std log:
+ log.SetOutput(io.Discard)
+
go inotifywaitgo.WatchPath(&inotifywaitgo.Settings{
Dir: path,
FileEvents: events,
but lets not go there.
- [ ] replace the package with a patched version
- [ ] submit pr
- [ ] switch back to upstream
cc @micbar
Downgrading to p2, no dataloss. But still a blocker.
I see here https://github.com/opencloud-eu/opencloud/issues/1621 similar logs with goroutine.
Upstream PR: https://github.com/pablodz/inotifywaitgo/pull/11
Reva and OpenCloud PRs to follow.