Skip to content

Commit b36f402

Browse files
committed
Fix race condition in numShutDownSig in alpha
1 parent 36499ea commit b36f402

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

dgraph/cmd/alpha/run.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,14 @@ func run() {
527527
sdCh := make(chan os.Signal, 3)
528528
shutdownCh = make(chan struct{})
529529

530-
var numShutDownSig int
531530
defer func() {
532531
signal.Stop(sdCh)
533532
close(sdCh)
534533
}()
535534
// sigint : Ctrl-C, sigterm : kill command.
536535
signal.Notify(sdCh, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
537536
go func() {
537+
var numShutDownSig int
538538
for {
539539
select {
540540
case _, ok := <-sdCh:
@@ -555,7 +555,6 @@ func run() {
555555
}
556556
}
557557
}()
558-
_ = numShutDownSig
559558

560559
// Setup external communication.
561560
aclCloser := y.NewCloser(1)

worker/groups.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ func (g *groupi) applyState(state *pb.MembershipState) {
289289
}
290290

291291
func (g *groupi) ServesGroup(gid uint32) bool {
292-
// No need to acquire the lock on g because gid is always
293-
// accessed atomically via groupId() function
294292
return g.groupId() == gid
295293
}
296294

0 commit comments

Comments
 (0)