Skip to content

Concurrent map access #31

@meirf

Description

@meirf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions