You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/11/19 10:09:15 UTC

[GitHub] [dubbo-go] bonake opened a new issue #884: config.Load()加载client.yml时偶尔会出现错误:fatal error: concurrent map read and map write

bonake opened a new issue #884:
URL: https://github.com/apache/dubbo-go/issues/884


   config.Load()加载client.yml时偶尔会出现如下错误:fatal error: concurrent map read and map write, 应该是内部使用map时的不安全调用引起的。
   调用堆栈如下:
   goroutine 25 [running]:
   runtime.throw(0x4650cfd, 0x21)
   	/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc00022a130 sp=0xc00022a100 pc=0x403bf92
   runtime.mapaccess1_faststr(0x45ed1c0, 0xc00007a0f0, 0x4642b4e, 0x9, 0x2)
   	/usr/local/go/src/runtime/map_faststr.go:21 +0x465 fp=0xc00022a1a0 sp=0xc00022a130 pc=0x4018ca5
   net/url.Values.Get(...)
   	/usr/local/go/src/net/url/url.go:888
   github.com/apache/dubbo-go/common.URL.GetParam(...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/common/url.go:433
   github.com/apache/dubbo-go/common.URL.Service(0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, 0x0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/common/url.go:383 +0x2d9 fp=0xc00022a368 sp=0xc00022a1a0 pc=0x4427599
   github.com/apache/dubbo-go/registry.(*BaseRegistry).service(0xc000158140, 0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/base_registry.go:202 +0x65 fp=0xc00022a430 sp=0xc00022a368 pc=0x4436405
   github.com/apache/dubbo-go/registry.(*BaseRegistry).consumerRegistry(0xc000158140, 0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/base_registry.go:352 +0x78 fp=0xc00022a5e8 sp=0xc00022a430 pc=0x4438678
   github.com/apache/dubbo-go/registry.(*BaseRegistry).processURL(0xc000158140, 0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/base_registry.go:273 +0x6c5 fp=0xc00022a910 sp=0xc00022a5e8 pc=0x44374a5
   github.com/apache/dubbo-go/registry.(*BaseRegistry).register(0xc000158140, 0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/base_registry.go:235 +0xf8 fp=0xc00022aa18 sp=0xc00022a910 pc=0x4436c78
   github.com/apache/dubbo-go/registry.(*BaseRegistry).Register(0xc000158140, 0xc0001e4c30, 0x5, 0x4640b86, 0x1, 0x0, 0x0, 0x0, 0x0, 0xc00007a0f0, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/base_registry.go:150 +0x1d8 fp=0xc00022aca8 sp=0xc00022aa18 pc=0x4435a58
   github.com/apache/dubbo-go/registry/protocol.(*registryProtocol).Refer(0xc00014ec30, 0xc00014c7e0, 0x8, 0xc0001add40, 0x13, 0xc00014c7eb, 0xe, 0xc00014c7fa, 0x4, 0xc00007a150, ...)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/registry/protocol/protocol.go:157 +0x535 fp=0xc00022b390 sp=0xc00022aca8 pc=0x44e83f5
   github.com/apache/dubbo-go/config.(*ReferenceConfig).Refer(0xc0001da840, 0x4591d80, 0xc000122658)
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/config/reference_config.go:138 +0xbf5 fp=0xc00022b860 sp=0xc00022b390 pc=0x44547f5
   github.com/apache/dubbo-go/config.loadConsumerConfig()
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/config/config_loader.go:138 +0x609 fp=0xc00022ba50 sp=0xc00022b860 pc=0x444cea9
   github.com/apache/dubbo-go/config.Load()
   	/Users/lizhh/Documents/prj/goexample/pkg/mod/github.com/apache/dubbo-go@v1.5.4/config/config_loader.go:328 +0x13a fp=0xc00022baa8 sp=0xc00022ba50 pc=0x444eefa
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] bonake commented on issue #884: config.Load()加载client.yml时偶尔会出现错误:fatal error: concurrent map read and map write

Posted by GitBox <gi...@apache.org>.
bonake commented on issue #884:
URL: https://github.com/apache/dubbo-go/issues/884#issuecomment-730279005


   github.com/apache/dubbo-go@v1.5.4/common/url.go 中的map访问是否可以考虑加锁
   // RangeParams will iterate the params
   // it's not thread-safe
   func (c *URL) RangeParams(f func(key, value string) bool) {
   	for k, v := range c.params {
   		if !f(k, v[0]) {
   			break
   		}
   	}
   }
   
   // GetParam gets value by key
   func (c URL) GetParam(s string, d string) string {
   	r := c.params.Get(s)
   	if len(r) == 0 {
   		r = d
   	}
   	return r
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks commented on issue #884: config.Load()加载client.yml时偶尔会出现错误:fatal error: concurrent map read and map write

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on issue #884:
URL: https://github.com/apache/dubbo-go/issues/884#issuecomment-730296933


   @bonake pls check pr https://github.com/apache/dubbo-go/pull/876 whether it can fix this bug. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks closed issue #884: config.Load()加载client.yml时偶尔会出现错误:fatal error: concurrent map read and map write

Posted by GitBox <gi...@apache.org>.
AlexStocks closed issue #884:
URL: https://github.com/apache/dubbo-go/issues/884


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org