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

runtime/race: needs fix for new func representation #4885

Closed
remyoudompheng opened this issue Feb 23, 2013 · 4 comments
Closed

runtime/race: needs fix for new func representation #4885

remyoudompheng opened this issue Feb 23, 2013 · 4 comments

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. go run -race this:

package main

import "runtime"

func F(j *int) {
      for i := 0; i < 10; i++ {
            *j = *j + 1
      }
}


func main() {
      var j int
      go func() { F(&j) }()
      go func() { F(&j) }()
      runtime.Goexit()
}

What is the expected output? What do you see instead?

Expected:

WARNING: DATA RACE
Write by goroutine 3:
  main.F()
      /tmp/test.go:7 +0x41
  main.func·002()
      /tmp/test.go:15 +0x32

Previous write by goroutine 2:
  main.F()
      /tmp/test.go:7 +0x41
  main.func·001()
      /tmp/test.go:14 +0x32

Goroutine 3 (running) created at:
  main.main()
      /tmp/test.go:15 +0x71
  runtime.main()
      /opt/remy/go.clean/src/pkg/runtime/proc.c:255 +0x8e

Goroutine 2 (finished) created at:
  main.main()
      /tmp/test.go:14 +0x5a
  runtime.main()
      /opt/remy/go.clean/src/pkg/runtime/proc.c:255 +0x8e

Got:

WARNING: DATA RACE
Write by goroutine 4:
  main.F()
      /tmp/test.go:7 +0x41
  ??()
      -:0 +0x231df
  ??()
      -:0 +0x231df

Previous write by goroutine 3:
  main.F()
      /tmp/test.go:7 +0x41
  ??()
      -:0 +0x231ef
  ??()
      -:0 +0x231ef

Goroutine 4 (running) created at:
  main.main()
      /tmp/test.go:15 +0xef
  ??()
      -:0 +0x20ce1ef7

Goroutine 3 (finished) created at:
  main.main()
      /tmp/test.go:14 +0x99
  ??()
      -:0 +0x20ce1ef7


Please use labels and text to provide additional information.
@remyoudompheng
Copy link
Contributor Author

Comment 1:

gc's assumes -8(FP) is the return address, maybe this got wrong in some way?
The code in runtime/race.c can also be simplified to remove comparisons of PC with arena
start/end since it is no longer relevant.

Labels changed: added racedetector, removed racedetector.

@remyoudompheng
Copy link
Contributor Author

Comment 2:

This issue was closed by revision e2f9e81.

Status changed to Fixed.

@dvyukov
Copy link
Member

dvyukov commented May 19, 2013

Comment 3:

Labels changed: added go1.2, removed priority-triage, go1.1maybe.

@dvyukov
Copy link
Member

dvyukov commented May 19, 2013

Comment 4:

Labels changed: removed go1.2.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants