# Metricbeat： fatal error: concurrent map read and map write

**URL:** <https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [November 13, 2018, 7:20am UTC](https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399 "2018-11-13T07:20:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jun\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jun_zhang/32/25863_2.png) [@Jun\_Zhang](https://discuss.elastic.co/u/Jun_Zhang)\
**Post date:** [November 13, 2018, 7:20am UTC](https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399/1 "2018-11-13T07:20:57Z")

</div>

metricbeat: 6.4.3  
OS: CentOS 7.5  
Docker: 18.06-1

metricbeat logs:

> 2018-11-13T12:22:10.262+0800 ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF  
> 2018-11-13T12:22:10.262+0800 INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events  
> fatal error: concurrent map read and map write
> 
> goroutine 328 [running]:  
> runtime.throw(0x27b8023, 0x21)  
> /usr/local/go/src/runtime/panic.go:616 +0x81 fp=0xc420463878 sp=0xc420463858 pc=0x117be91  
> runtime.mapaccess1\_faststr(0x23fef60, 0xc4205f72c0, 0xc431736640, 0x36, 0xc4204639e0)  
> /usr/local/go/src/runtime/hashmap\_fast.go:181 +0x421 fp=0xc4204638e8 sp=0xc420463878 pc=0x115bad1  
> [github.com/elastic/beats/metricbeat/module/kubernetes/util.(\*enricher).Enrich](http://github.com/elastic/beats/metricbeat/module/kubernetes/util.(*enricher).Enrich)(0xc42096f7c0, 0xc422cff500, 0x123, 0x123)  
> /go/src/github.com/elastic/beats/metricbeat/module/kubernetes/util/kubernetes.go:298 +0xcb fp=0xc420463a78 sp=0xc4204638e8 pc=0x1cc1ccb  
> [github.com/elastic/beats/metricbeat/module/kubernetes/state\_container.(\*MetricSet).Fetch](http://github.com/elastic/beats/metricbeat/module/kubernetes/state_container.(*MetricSet).Fetch)(0xc4206cdd10, 0xc42da22000, 0xc42da22000, 0xc42da22000, 0xc420463d40, 0xc42200f140)  
> /go/src/github.com/elastic/beats/metricbeat/module/kubernetes/state\_container/state\_container.go:120 +0xe5 fp=0xc420463b18 sp=0xc420463a78 pc=0x1ccd3d5  
> [github.com/elastic/beats/metricbeat/mb/module.(\*metricSetWrapper).multiEventFetch](http://github.com/elastic/beats/metricbeat/mb/module.(*metricSetWrapper).multiEventFetch)(0xc420896f20, 0x7fb69f1f9508, 0xc4206cdd10, 0x29319e0, 0xc4202ba030)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:252 +0x52 fp=0xc420463b88 sp=0xc420463b18 pc=0x1aa1ad2  
> [github.com/elastic/beats/metricbeat/mb/module.(\*metricSetWrapper).fetch](http://github.com/elastic/beats/metricbeat/mb/module.(*metricSetWrapper).fetch)(0xc420896f20, 0x29319e0, 0xc4202ba030)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:232 +0x12f fp=0xc420463c28 sp=0xc420463b88 pc=0x1aa176f  
> [github.com/elastic/beats/metricbeat/mb/module.(\*metricSetWrapper).startPeriodicFetching](http://github.com/elastic/beats/metricbeat/mb/module.(*metricSetWrapper).startPeriodicFetching)(0xc420896f20, 0x29319e0, 0xc4202ba030)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:219 +0x121 fp=0xc420463d88 sp=0xc420463c28 pc=0x1aa1511  
> [github.com/elastic/beats/metricbeat/mb/module.(\*metricSetWrapper).run](http://github.com/elastic/beats/metricbeat/mb/module.(*metricSetWrapper).run)(0xc420896f20, 0xc42093c240, 0xc420600b40)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:196 +0x5ca fp=0xc420463f58 sp=0xc420463d88 pc=0x1aa0ffa  
> [github.com/elastic/beats/metricbeat/mb/module.(\*Wrapper).Start.func1](http://github.com/elastic/beats/metricbeat/mb/module.(*Wrapper).Start.func1)(0xc420892a90, 0xc42093c240, 0xc420600b40, 0xc420896f20)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:137 +0x249 fp=0xc420463fc0 sp=0xc420463f58 pc=0x1aa3c49  
> runtime.goexit()  
> /usr/local/go/src/runtime/asm\_amd64.s:2361 +0x1 fp=0xc420463fc8 sp=0xc420463fc0 pc=0x11ac031  
> created by [github.com/elastic/beats/metricbeat/mb/module.(\*Wrapper).Start](http://github.com/elastic/beats/metricbeat/mb/module.(*Wrapper).Start)  
> /go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:125 +0x145
> 
> goroutine 1 [semacquire, 1019 minutes]:  
> sync.runtime\_Semacquire(0xc4201c423c)  
> /usr/local/go/src/runtime/sema.go:56 +0x39  
> sync.(\*WaitGroup).Wait(0xc4201c4230)  
> /usr/local/go/src/sync/waitgroup.go:129 +0x72  
> [github.com/elastic/beats/metricbeat/beater.(\*Metricbeat).Run](http://github.com/elastic/beats/metricbeat/beater.(*Metricbeat).Run)(0xc4202a2690, 0xc4204be400, 0xc420449a60, 0x1)  
> /go/src/github.com/elastic/beats/metricbeat/beater/metricbeat.go:233 +0x26c  
> [github.com/elastic/beats/libbeat/cmd/instance.(\*Beat).launch](http://github.com/elastic/beats/libbeat/cmd/instance.(*Beat).launch)(0xc4204be400, 0x277c5ed, 0xa, 0x277c5ed, 0xa, 0x0, 0x0, 0x0, 0x0, 0xc4201d80f0, ...)  
> /go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:389 +0x49c  
> [github.com/elastic/beats/libbeat/cmd/instance.Run.func1](http://github.com/elastic/beats/libbeat/cmd/instance.Run.func1)(0x277c5ed, 0xa, 0x277c5ed, 0xa, 0x0, 0x0, 0x277c5ed, 0xa, 0x277c5ed, 0xa, ...)  
> /go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:194 +0x611  
> [github.com/elastic/beats/libbeat/cmd/instance.Run](http://github.com/elastic/beats/libbeat/cmd/instance.Run)(0x277c5ed, 0xa, 0x277c5ed, 0xa, 0x0, 0x0, 0x0, 0x0, 0xc4201d80f0, 0x0, ...)  
> /go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:195 +0xbe  
> [github.com/elastic/beats/libbeat/cmd.genRunCmd.func1](http://github.com/elastic/beats/libbeat/cmd.genRunCmd.func1)(0xc42035b680, 0xc420281800, 0x0, 0x3)  
> /go/src/github.com/elastic/beats/libbeat/cmd/run.go:37 +0x4f  
> [github.com/elastic/beats/vendor/github.com/spf13/cobra.(\*Command).execute](http://github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).execute)(0xc42035b680, 0xc42011a050, 0x3, 0x3, 0xc42035b680, 0xc42011a050)  
> /go/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:704 +0x2c6  
> [github.com/elastic/beats/vendor/github.com/spf13/cobra.(\*Command).ExecuteC](http://github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).ExecuteC)(0xc42035b680, 0x0, 0x277c5ed, 0xc4202e1440)  
> /go/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:785 +0x2e4  
> [github.com/elastic/beats/vendor/github.com/spf13/cobra.(\*Command).Execute](http://github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).Execute)(0xc42035b680, 0xc42050bf78, 0xc4200fc058)  
> /go/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:738 +0x2b  
> main.main()  
> /go/src/github.com/elastic/beats/metricbeat/main.go:34 +0x2f

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [November 13, 2018, 10:26am UTC](https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399/2 "2018-11-13T10:26:51Z")

</div>

Hi @Jun_Zhang,

Thanks for reporting this, it looks bad. It seems to happen on a reconnection to the Kubernetes API. Could you please [fill a bug report](https://github.com/elastic/beats/issues/new)?

---

<div class="post-metadata">

**Author:** ![Jun\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jun_zhang/32/25863_2.png) [@Jun\_Zhang](https://discuss.elastic.co/u/Jun_Zhang)\
**Post date:** [November 13, 2018, 11:27am UTC](https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399/3 "2018-11-13T11:27:07Z")

</div>

Done.

> <https://github.com/elastic/beats/issues/9055>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 11, 2018, 11:27am UTC](https://discuss.elastic.co/t/metricbeat-fatal-error-concurrent-map-read-and-map-write/156399/4 "2018-12-11T11:27:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
