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

go race reports quite a few issues at startup #4088

Open
1 of 4 tasks
rhafer opened this issue Jul 4, 2022 · 9 comments
Open
1 of 4 tasks

go race reports quite a few issues at startup #4088

rhafer opened this issue Jul 4, 2022 · 9 comments
Labels

Comments

@rhafer
Copy link
Contributor

rhafer commented Jul 4, 2022

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/[email protected]/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/[email protected]/command.go:169 +0xf36
  github.com/urfave/cli/v2.(*App).RunContext()
      /root/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:341 +0x1255
  github.com/urfave/cli/v2.(*App).Run()
      /root/go/pkg/mod/github.com/urfave/cli/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/command.go:169 +0xf36
  github.com/urfave/cli/v2.(*App).RunContext()
      /root/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:341 +0x1255
  github.com/urfave/cli/v2.(*App).Run()
      /root/go/pkg/mod/github.com/urfave/cli/[email protected]/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/[email protected]/supervisor.go:565 +0x1c3

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

Goroutine 49 (running) created at:
  github.com/thejerf/suture/v4.(*Supervisor).runService()
      /root/go/pkg/mod/github.com/thejerf/suture/[email protected]/supervisor.go:539 +0x310
  github.com/thejerf/suture/v4.(*Supervisor).Serve()
      /root/go/pkg/mod/github.com/thejerf/suture/[email protected]/supervisor.go:348 +0x3e9
  github.com/thejerf/suture/v4.(*Supervisor).ServeBackground.func1()
      /root/go/pkg/mod/github.com/thejerf/suture/[email protected]/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:
    • get bump urfave cli & fix race condition micro/go-micro#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 urfave/cli#1242)

@rhafer rhafer added the Type:Bug label Jul 4, 2022
rhafer added a commit to rhafer/ocis that referenced this issue Jul 5, 2022
The help flag is configured automatically by default already. We don't
need to redo that for every single service.

This also addresses one of the finding of "go race" (owncloud#4088)
rhafer added a commit to rhafer/ocis that referenced this issue Jul 5, 2022
The help flag is configured automatically by default already. We don't
need to redo that for every single service.

This also addresses one of the finding of "go race" (owncloud#4088)
@micbar micbar added the Priority:p3-medium Normal priority label Jul 13, 2022
@micbar micbar added this to the 2.0.0 General Availability milestone Jul 13, 2022
@micbar micbar modified the milestones: 2.0.0 General Availability, 2.1.0 Service Pack 1 Sep 14, 2022
@rhafer
Copy link
Contributor Author

rhafer commented Oct 19, 2022

cs3org/reva#3377 should remove at least two of the races

@dragonchaser
Copy link
Member

Investigate what race conditions are still exists, fix those which are easy to fix, for all the others create tickets

@dragonchaser dragonchaser self-assigned this Sep 28, 2023
@dragonchaser
Copy link
Member

micro/go-micro#2659 Fix PR for go-micro here, removing this unmasked 2 other race condition, one is in urfave/cli (v2.25.7) and the other one in thejerf/suture(v4.0.2). Looking into the first at the moment and waiting for the go-micro cli to pass.

@dragonchaser
Copy link
Member

dragonchaser commented Oct 10, 2023

It looks like the race condition in urfave/cli is not present in its v2-maint branch.

@dragonchaser
Copy link
Member

Another fix in: cs3org/reva#4250

@dragonchaser
Copy link
Member

urfave/cli does not seem threadsafe at all, there are no mutexes. Either we completely rework urfave/cli or switch to cobra.

see: urfave/cli#1242

@micbar how to proceed?

@micbar
Copy link
Contributor

micbar commented Oct 25, 2023

They say the application needs to fix the races.

@dragonchaser
Copy link
Member

This is impossible, I have tried, also paired with @rhafer on this.

@micbar
Copy link
Contributor

micbar commented Oct 26, 2023

Okay, let us discuss in the team.

For the moment, let us stop putting efforts into that one.

@dragonchaser dragonchaser removed their assignment Oct 26, 2023
@micbar micbar removed this from the 2.1.0 Service Pack 1 milestone Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants