cernec1999 / ssh-honeypot

5 stars 1 forks source link

Bug: Data race when stopping containers #19

Closed cernec1999 closed 3 years ago

cernec1999 commented 4 years ago
WARNING: DATA RACE
Write at 0x000001073f8a by goroutine 10:
  main.main.func1()
      /home/ubuntu/ssh-honeypot/main.go:352 +0x24c

Previous read at 0x000001073f8a by goroutine 7:
  main.spawnContainers()
      /home/ubuntu/ssh-honeypot/main.go:75 +0x2c

Goroutine 10 (running) created at:
  main.main()
      /home/ubuntu/ssh-honeypot/main.go:350 +0x200

Goroutine 7 (running) created at:
  main.main()
      /home/ubuntu/ssh-honeypot/main.go:344 +0x170
cernec1999 commented 4 years ago

programIsRunning variable is where the data race happens. Should we make atomic or lock it with the containerNamesLock mutex? I think I'll take the mutex approach here.