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

fatal error: concurrent map read and map write #146

Closed
wongoo opened this issue Jul 31, 2019 · 2 comments
Closed

fatal error: concurrent map read and map write #146

wongoo opened this issue Jul 31, 2019 · 2 comments

Comments

@wongoo
Copy link
Contributor

wongoo commented Jul 31, 2019

What happened:

detail see: https://travis-ci.org/apache/dubbo-go/jobs/565782895

2019-07-31T03:20:27.734Z	DEBUG	directory/directory.go:126	update service name: dubbo://:@:/TEST2?cluster=mock&group=group2!
fatal error: concurrent map read and map write
goroutine 12 [running]:
runtime.throw(0x7b7b34, 0x21)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/panic.go:617 +0x72 fp=0xc0000b36f0 sp=0xc0000b36c0 pc=0x42e932
runtime.mapaccess1_faststr(0x774340, 0xc0000863c0, 0x7ad44f, 0x5, 0x1)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/map_faststr.go:21 +0x464 fp=0xc0000b3760 sp=0xc0000b36f0 pc=0x413a44
net/url.Values.Get(...)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/net/url/url.go:838
github.com/apache/dubbo-go/common.URL.GetParam(...)
	/home/travis/gopath/src/github.com/apache/dubbo-go/common/url.go:286
github.com/apache/dubbo-go/registry/directory.(*registryDirectory).toGroupInvokers(0xc000146000, 0x7ad422, 0x5, 0x7acd31)
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:164 +0x956 fp=0xc0000b3d10 sp=0xc0000b3760 pc=0x6ef9b6
github.com/apache/dubbo-go/registry/directory.(*registryDirectory).refreshInvokers(0xc000146000, 0xc000129500)
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:145 +0x1b3 fp=0xc0000b3f80 sp=0xc0000b3d10 pc=0x6eeeb3
github.com/apache/dubbo-go/registry/directory.(*registryDirectory).update(0xc000146000, 0xc000129500)
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:128 +0x187 fp=0xc0000b3fd0 sp=0xc0000b3f80 pc=0x6eec97
runtime.goexit()
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000b3fd8 sp=0xc0000b3fd0 pc=0x45ccf1
created by github.com/apache/dubbo-go/registry/directory.(*registryDirectory).Subscribe
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:110 +0x3a
@gaoxinge
Copy link

gaoxinge commented Aug 30, 2019

Although pr #172 has been raised, there is still concurrent map read and write error (travis ci) when testing directory. @hxmhlt @AlexStocks

fatal error: concurrent map iteration and map write

goroutine 24 [running]:
runtime.throw(0x7c2d8e, 0x26)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/panic.go:617 +0x72 fp=0xc0000993c8 sp=0xc000099398 pc=0x42e932
runtime.mapiternext(0xc000099590)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/map.go:860 +0x520 fp=0xc000099450 sp=0xc0000993c8 pc=0x4104e0
runtime.mapiterinit(0x77c7a0, 0xc00010a390, 0xc000099590)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/map.go:850 +0x1c9 fp=0xc000099470 sp=0xc000099450 pc=0x40fec9
net/url.Values.Encode(0xc00010a390, 0x13, 0xc000057670)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/net/url/url.go:919 +0xd5 fp=0xc000099600 sp=0xc000099470 pc=0x5b39b5
github.com/apache/dubbo-go/common.URL.String(0x7b626a, 0x5, 0x7b5b71, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/travis/gopath/src/github.com/apache/dubbo-go/common/url.go:240 +0x20d fp=0xc0000996e0 sp=0xc000099600 pc=0x6d69fd
github.com/apache/dubbo-go/common.(*URL).String(0xc000105d40, 0x7ce330, 0xc0000e0240)
	<autogenerated>:1 +0x8a fp=0xc0000998a0 sp=0xc0000996e0 pc=0x6d8a9a
fmt.(*pp).handleMethods(0xc0000e0240, 0x73, 0x1)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:616 +0x29b fp=0xc000099940 sp=0xc0000998a0 pc=0x4b939b
fmt.(*pp).printArg(0xc0000e0240, 0x7a6c80, 0xc000105d40, 0x73)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:699 +0x20a fp=0xc0000999d8 sp=0xc000099940 pc=0x4b981a
fmt.(*pp).doPrintf(0xc0000e0240, 0x7c130c, 0x22, 0xc000099b50, 0x2, 0x2)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:1016 +0x152 fp=0xc000099ac0 sp=0xc0000999d8 pc=0x4bd202
fmt.Sprintf(0x7c130c, 0x22, 0xc000057b50, 0x2, 0x2, 0xc00007f380, 0xc000044b80)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:214 +0x66 fp=0xc000099b18 sp=0xc000099ac0 pc=0x4b62d6
github.com/apache/dubbo-go/registry.ServiceEvent.String(...)
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/event.go:45
github.com/apache/dubbo-go/registry.(*ServiceEvent).String(0xc0001222a0, 0x7ce330, 0xc0000e0000)
	<autogenerated>:1 +0x109 fp=0xc000099c58 sp=0xc000099b18 pc=0x6da759
fmt.(*pp).handleMethods(0xc0000e0000, 0x73, 0x1)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:616 +0x29b fp=0xc000099cf8 sp=0xc000099c58 pc=0x4b939b
fmt.(*pp).printArg(0xc0000e0000, 0x74afe0, 0xc0001222a0, 0x73)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:699 +0x20a fp=0xc000099d90 sp=0xc000099cf8 pc=0x4b981a
fmt.(*pp).doPrintf(0xc0000e0000, 0x7bdef7, 0x1b, 0xc00002ff60, 0x1, 0x1)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:1016 +0x152 fp=0xc000099e78 sp=0xc000099d90 pc=0x4bd202
fmt.Sprintf(0x7bdef7, 0x1b, 0xc00002ff60, 0x1, 0x1, 0x0, 0x45ccf1)
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/fmt/print.go:214 +0x66 fp=0xc000099ed0 sp=0xc000099e78 pc=0x4b62d6
go.uber.org/zap.(*SugaredLogger).log(0xc000010060, 0xff, 0x7bdef7, 0x1b, 0xc00002ff60, 0x1, 0x1, 0x0, 0x0, 0x0)
	/home/travis/gopath/pkg/mod/go.uber.org/[email protected]/sugar.go:230 +0x128 fp=0xc000099f20 sp=0xc000099ed0 pc=0x6acda8
go.uber.org/zap.(*SugaredLogger).Debugf(0xc000010060, 0x7bdef7, 0x1b, 0xc00002ff60, 0x1, 0x1)
	/home/travis/gopath/pkg/mod/go.uber.org/[email protected]/sugar.go:133 +0x79 fp=0xc000099f80 sp=0xc000099f20 pc=0x6aca59
github.com/apache/dubbo-go/common/logger.Debugf(...)
	/home/travis/gopath/src/github.com/apache/dubbo-go/common/logger/logging.go:42
github.com/apache/dubbo-go/registry/directory.(*registryDirectory).update(0xc00011e070, 0xc0001222a0)
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:122 +0xc9 fp=0xc000099fd0 sp=0xc000099f80 pc=0x6f5669
runtime.goexit()
	/home/travis/.gimme/versions/go1.12.linux.amd64/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000099fd8 sp=0xc000099fd0 pc=0x45ccf1
created by github.com/apache/dubbo-go/registry/directory.(*registryDirectory).Subscribe
	/home/travis/gopath/src/github.com/apache/dubbo-go/registry/directory/directory.go:109 +0x395

It seems that it is not safe when we calling url.String method.

@hxmhlt
Copy link
Contributor

hxmhlt commented Sep 17, 2019

resolved by #201

@hxmhlt hxmhlt closed this as completed Sep 17, 2019
LaurenceLiZhixin pushed a commit to LaurenceLiZhixin/dubbo-go that referenced this issue Jul 17, 2021
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

3 participants