Skip to content

Conversation

@tklauser
Copy link
Contributor

@tklauser tklauser commented Jul 7, 2022

Fix the data race in agent.Liste uncovered in #173 and run tests with -race in CI.

tklauser added 2 commits July 7, 2022 10:49
Fix the following data race in agent.Listen:

==================
WARNING: DATA RACE
Write at 0x0000007620a0 by goroutine 9:
  github.com/google/gops/agent.Listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:112 +0x207
  github.com/google/gops/agent.TestAgentClose()
      /home/tklauser/go/src/github.com/google/gops/agent/agent_test.go:21 +0x6e
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47

Previous read at 0x0000007620a0 by goroutine 8:
  github.com/google/gops/agent.listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:130 +0x5a

Goroutine 9 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:57 +0x2e4

Goroutine 8 (finished) created at:
  github.com/google/gops/agent.Listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:123 +0x43b
  github.com/google/gops/agent.TestListen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent_test.go:13 +0x57
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
==================
--- FAIL: TestAgentClose (0.00s)
    testing.go:1312: race detected during execution of test
FAIL
FAIL	github.com/google/gops/agent	0.026s
@tklauser tklauser requested a review from odeke-em July 7, 2022 08:53
Copy link

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tklauser, LGTM!

@tklauser tklauser merged commit c14dce9 into master Jul 7, 2022
@tklauser tklauser deleted the pr/test-race branch July 7, 2022 16:07
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.

3 participants