Hi,

Can you please do two things to help with this error report.

1. Please include the entire data race report -- we need this to match up 
the line with the source code you've provided in the gist
2. Please double check that you are not copying a your sync.Pool type by 
value, this can happen if you have a type declared on sync.Pool, not 
*sync.Pool, or it could happen if you do something like this

var x sync.Pool
y := x

Thanks

Dave

On Friday, 24 August 2018 13:46:10 UTC+10, nea...@gmail.com wrote:
>
> Hi lan,
>
> The sync.Pool has memory accesses in per-p private storage. Why it not 
> reports `DATA RACE`, but it reports when I copy those code outside stdlib?
> I'm confused about this, or there is something wrong in 
> https://gist.github.com/lrita/efa8c4ae555b4b7cceee29b4ed819652 
> Thanks.
>
> 在 2018年8月24日星期五 UTC+8上午4:36:06,Ian Lance Taylor写道:
>>
>> On Thu, Aug 23, 2018 at 12:43 AM,  <buaa...@gmail.com> wrote: 
>> > package main 
>> > 
>> > import "runtime" 
>> > 
>> > var a int 
>> > 
>> > func calc() { 
>> >     for i := 0; i < 10; i++ { 
>> >         go func() { 
>> >             for { 
>> >                 runtime.RaceDisable() 
>> >                 a++ 
>> >                 runtime.RaceEnable() 
>> >             } 
>> >         }() 
>> > 
>> >     } 
>> > } 
>> > 
>> > func main() { 
>> >     calc() 
>> > } 
>> > 
>> > go run -race a.go 
>>
>> Thanks for the example.  As the docs for runtime.RaceDisable say, it 
>> only applies to synchronization events, like mutex locks.  It doesn't 
>> apply to memory accesses. 
>>
>> Ian 
>>
>>
>> > 在 2018年8月22日星期三 UTC+8下午10:34:35,Ian Lance Taylor写道: 
>> >> 
>> >> On Wed, Aug 22, 2018 at 3:25 AM,  <nea...@gmail.com> wrote: 
>> >> > 
>> >> > When I copy the sync.Pool's source code in a repo, and using 
>> >> > `//go:linkname` 
>> >> > link those runtime functions manually. 
>> >> > When I run `go test -race`, it reports `DATA RACE`. 
>> >> > But the sync.Pool with the same test case does not report  `DATA 
>> RACE`. 
>> >> > 
>> >> > Does runtime.RaceDisable not work in non-std library ? 
>> >> 
>> >> It should work.  I think you'll have to show us your code. 
>> >> 
>> >> Ian 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "golang-nuts" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to golang-nuts...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to