Skip to content

[17.06] Fix possible data race in manager/state/store/memory_test.go#2697

Closed
thaJeztah wants to merge 1 commit intomoby:bump_v17.06from
thaJeztah:17.06-backport-2536-data-race
Closed

[17.06] Fix possible data race in manager/state/store/memory_test.go#2697
thaJeztah wants to merge 1 commit intomoby:bump_v17.06from
thaJeztah:17.06-backport-2536-data-race

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

Backport of #2537 for 17.06

git checkout -b 17.06-backport-2536-data-race upstream/bump_v17.06
git cherry-pick -s -S -x 06add13d57411618c18d4b9d181013e932462834

no conflicts, cherry-pick was clean

This PR is a fix for #2536, essentially using the first proposed way of fixing the original issue.

This fixes a possible data race in manager/state/store/memory_test.go

An alternative to this fix would be to define a new variable in the following way:

    for c := 0; c != 5; c++ {
        ...
        x := c
        go func() {
            ...
            Name: nodeIDs[i%benchmarkNumNodes] + "_" + strconv.Itoa(x) + "_" + strconv.Itoa(i),
            ...
        }
    }

@thaJeztah
Copy link
Copy Markdown
Member Author

Heh. The irony; it's failing on another data race;

WARNING: DATA RACE
Read at 0x00c42032a7a0 by goroutine 147:
  github.com/docker/swarmkit/manager/dispatcher.(*Dispatcher).isRunning()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/manager/dispatcher/dispatcher.go:413 +0x4b
  github.com/docker/swarmkit/manager/dispatcher.(*Dispatcher).Heartbeat()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/manager/dispatcher/dispatcher.go:1102 +0xcd
  github.com/docker/swarmkit/api.(*authenticatedWrapperDispatcherServer).Heartbeat()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/api/dispatcher.pb.go:471 +0x17d
  github.com/docker/swarmkit/api.(*raftProxyDispatcherServer).Heartbeat()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/api/dispatcher.pb.go:1727 +0x290
  github.com/docker/swarmkit/api._Dispatcher_Heartbeat_Handler.func1()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/api/dispatcher.pb.go:1008 +0xa1
  github.com/docker/swarmkit/vendor/github.com/grpc-ecosystem/go-grpc-prometheus.UnaryServerInterceptor()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go:29 +0xc9
  github.com/docker/swarmkit/api._Dispatcher_Heartbeat_Handler()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/api/dispatcher.pb.go:1010 +0x1fb
  github.com/docker/swarmkit/vendor/google.golang.org/grpc.(*Server).processUnaryRPC()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/vendor/google.golang.org/grpc/server.go:638 +0x10cc
  github.com/docker/swarmkit/vendor/google.golang.org/grpc.(*Server).handleStream()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/vendor/google.golang.org/grpc/server.go:796 +0x18a4
  github.com/docker/swarmkit/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1()
      /home/ubuntu/.go_workspace/src/github.com/docker/swarmkit/vendor/google.golang.org/grpc/server.go:449 +0xb6
....

Signed-off-by: Vincent Robbemond <vincentrobbemond@gmail.com>
(cherry picked from commit 06add13)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the 17.06-backport-2536-data-race branch from 19875fd to bbd0131 Compare July 9, 2018 10:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 9, 2018

Codecov Report

Merging #2697 into bump_v17.06 will increase coverage by 4.34%.
The diff coverage is n/a.

@@               Coverage Diff               @@
##           bump_v17.06    #2697      +/-   ##
===============================================
+ Coverage        57.72%   62.07%   +4.34%     
===============================================
  Files               10       42      +32     
  Lines             1230     5716    +4486     
===============================================
+ Hits               710     3548    +2838     
- Misses             451     1820    +1369     
- Partials            69      348     +279

@thaJeztah
Copy link
Copy Markdown
Member Author

closing, as 17.06 is EOL

@thaJeztah thaJeztah closed this Jun 5, 2021
@thaJeztah thaJeztah deleted the 17.06-backport-2536-data-race branch June 5, 2021 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant