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

Concurrent map access #31

Open
meirf opened this issue Jun 14, 2017 · 2 comments
Open

Concurrent map access #31

meirf opened this issue Jun 14, 2017 · 2 comments

Comments

@meirf
Copy link

meirf commented Jun 14, 2017

It looks like tree_cache's map is susceptible to concurrent read/write.

fatal error: concurrent map read and map write
goroutine 26 [running]:
runtime.throw(0xaf4cd7, 0x21)
    /usr/local/go/src/runtime/panic.go:596 +0x95 fp=0xc42007da38 sp=0xc42007da18
runtime.mapaccess2_faststr(0xa164a0, 0xc4201f4b70, 0xc4201425f0, 0xd, 0x0, 0x0)
    /usr/local/go/src/runtime/hashmap_fast.go:326 +0x50a fp=0xc42007da98 sp=0xc42007da38
fsgo/net/discovery.(*TreeCache).readInstanceList(0xc4201abf80, 0xc4201425f0, 0xd, 0xe2f6e0, 0x0, 0x0)
   fsgo/net/discovery/tree_cache.go:55 +0xb1 fp=0xc42007dc70 sp=0xc42007da98
fsgo/net/discovery.(*TreeCache).readAndWatch(0xc4201abf80, 0xc4201425f0, 0xd, 0xae2425, 0x8)
fsgo/net/discovery/tree_cache.go:48 +0x31e fp=0xc42007dd40 sp=0xc42007dc70
fsgo/net/discovery.(*TreeCache).readServices(0xc4201abf80, 0xc4201f4ba0)
fsgo/net/discovery/tree_cache.go:116 +0x2e8 fp=0xc42007df80 sp=0xc42007dd40
fsgo/net/discovery.(*TreeCache).processServiceChanges.func1(0xc4201abf80, 0xc4201f4ba0)
fsgo/net/discovery/tree_cache.go:97 +0x54 fp=0xc42007dfd0 sp=0xc42007df80
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc42007dfd8 sp=0xc42007dfd0
fsgo/net/discovery.(*TreeCache).processServiceChanges
fsgo/net/discovery/tree_cache.go:100 +0x7d

goroutine 1 [runnable, locked to thread]:
fsgo/net/discovery.(*TreeCache).readInstanceList(0xc4201abf80, 0xc42001b810, 0xd, 0xe2f6e0, 0x0, 0x0)
	fsgo/net/discovery/tree_cache.go:84 +0x8ca
fsgo/net/discovery.(*TreeCache).readAndWatch(0xc4201abf80, 0xc42001b810, 0xd, 0xae2425, 0x8)
	fsgo/net/discovery/tree_cache.go:48 +0x31e
fsgo/net/discovery.(*TreeCache).readServices(0xc4201abf80, 0xc4201f4ba0)
	fsgo/net/discovery/tree_cache.go:116 +0x2e8
fsgo/net/discovery.(*TreeCache).processServiceChanges(0xc4201abf80)
	fsgo/net/discovery/tree_cache.go:101 +0x95
fsgo/net/discovery.(*TreeCache).Start(0xc4201abf80)
	fsgo/net/discovery/tree_cache.go:25 +0x2b
@meirf meirf changed the title Unguarded map Concurrent map access Jun 14, 2017
@meirf
Copy link
Author

meirf commented Jun 14, 2017

I think what happened is if the watcher detects an service change quickly it can update the list during the initial load.

@meirf
Copy link
Author

meirf commented Jun 21, 2017

Do you guys have an idea of how to fix this? This is causing us some pretty nasty errors.
Thanks!

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

No branches or pull requests

1 participant