owncloud / owncloud/ocis

go race reports quite a few issues at startup

Open
#4,088 9 comments 0 reactions 0 assignees View on GitHub
Priority:p3-medium Type:Bug
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

## Describe the bug

Running ocis with the race detector enable produces quite a few reports at startup:

`# go run -race ./ocis/cmd/ocis server`

results in:

```
==================
WARNING: DATA RACE
Write at 0x000007e68a10 by goroutine 51:
go-micro.dev/v4/util/log.SetLogger()
/root/go/pkg/mod/go-micro.dev/v4@v4.7.0/util/log/log.go:201 +0xd26
github.com/owncloud/ocis/v2/ocis-pkg/log.NewLogger()
/owncloud/ocis/ocis-pkg/log/log.go:93 +0xd1a
github.com/owncloud/ocis/v2/services/webdav/pkg/logging.Configure()
/owncloud/ocis/services/webdav/pkg/logging/logging.go:10 +0x24b
github.com/owncloud/ocis/v2/services/webdav/pkg/command.Server.func2()
/owncloud/ocis/services/webdav/pkg/command/server.go:35 +0xc8
github.com/urfave/cli/v2.(*Command).Run()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/command.go:169 +0xf36
github.com/urfave/cli/v2.(*App).RunContext()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:341 +0x1255
github.com/urfave/cli/v2.(*App).Run()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:247 +0x211
github.com/owncloud/ocis/v2/services/webdav/pkg/command.Execute()
/owncloud/ocis/services/webdav/pkg/command/root.go:36 +0x1af
github.com/owncloud/ocis/v2/services/webdav/pkg/command.SutureService.Serve()
/owncloud/ocis/services/webdav/pkg/command/root.go:54 +0x89
github.com/thejerf/suture/v4.(*Supervisor).runService.func2()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:565 +0x1c3

Previous write at 0x000007e68a10 by goroutine 49:
go-micro.dev/v4/util/log.SetLogger()
/root/go/pkg/mod/go-micro.dev/v4@v4.7.0/util/log/log.go:201 +0xd26
github.com/owncloud/ocis/v2/ocis-pkg/log.NewLogger()
/owncloud/ocis/ocis-pkg/log/log.go:93 +0xd1a
github.com/owncloud/ocis/v2/services/graph/pkg/logging.Configure()
/owncloud/ocis/services/graph/pkg/logging/logging.go:10 +0x24b
github.com/owncloud/ocis/v2/services/graph/pkg/command.Server.func2()
/owncloud/ocis/services/graph/pkg/command/server.go:35 +0xc8
github.com/urfave/cli/v2.(*Command).Run()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/command.go:169 +0xf36
github.com/urfave/cli/v2.(*App).RunContext()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:341 +0x1255
github.com/urfave/cli/v2.(*App).Run()
/root/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:247 +0x211
github.com/owncloud/ocis/v2/services/graph/pkg/command.Execute()
/owncloud/ocis/services/graph/pkg/command/root.go:36 +0x1af
github.com/owncloud/ocis/v2/services/graph/pkg/command.SutureService.Serve()
/owncloud/ocis/services/graph/pkg/command/root.go:54 +0x89
github.com/thejerf/suture/v4.(*Supervisor).runService.func2()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:565 +0x1c3

Goroutine 51 (running) created at:
github.com/thejerf/suture/v4.(*Supervisor).runService()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:539 +0x310
github.com/thejerf/suture/v4.(*Supervisor).Serve()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:348 +0x3e9
github.com/thejerf/suture/v4.(*Supervisor).ServeBackground.func1()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:297 +0x58

Goroutine 49 (running) created at:
github.com/thejerf/suture/v4.(*Supervisor).runService()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:539 +0x310
github.com/thejerf/suture/v4.(*Supervisor).Serve()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:348 +0x3e9
github.com/thejerf/suture/v4.(*Supervisor).ServeBackground.func1()
/root/go/pkg/mod/github.com/thejerf/suture/v4@v4.0.2/supervisor.go:297 +0x58
==================
....
==================
Found 21 data race(s)
```

While not all of the reported things might be causing serious problems. We should take a closer look and fix as many as possilbe.

**Tasks:**

- go-micro:
- [x] get https://github.com/go-micro/go-micro/pull/2659 merged
- [ ] bump go-micro (upon new release)
- [ ] reva
- [ ] ocis
~~- urfave/cli~~
~~- [ ] fix race condition~~
~~- [ ] bump urfave/cli in (upon new release)~~
~~- [ ] reva~~
~~- [ ] ocis~~
~~- [ ] go-micro~~
~~- thejerf/suture~~
~~- [ ] fix race condition~~
~~- [ ] bump in ocis (upon new release)~~

thejerf/suture does not need fixing, race is completely related to urfave/cli which is unfixable/has no thread safety at all. (see https://github.com/urfave/cli/issues/1242)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.