# Heartbeat fatal error: concurrent map iteration and map write

**URL:** <https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [March 20, 2018, 9:50am UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716 "2018-03-20T09:50:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flavio\_Fortes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flavio_fortes/32/42806_2.png) [@Flavio\_Fortes](https://discuss.elastic.co/u/Flavio_Fortes)\
**Post date:** [March 20, 2018, 9:50am UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/1 "2018-03-20T09:50:17Z")

</div>

Hello,

I'm trying to run Heartbeat version 6.1.1 up to 6.1.3 all failing, normally after 20 minutes running due to the following error:

```
2018/03/19 23:56:00.640256 scheduler.go:170: DBG [scheduler] Next wakeup time: 2018-03-20 00:59:00.6347839 +0100 CET
fatal error: concurrent map iteration and map write

goroutine 14273 [running]:
runtime.throw(0x15f08b5, 0x26)
        /usr/local/go/src/runtime/panic.go:605 +0x95 fp=0xc4202daed8 sp=0xc4202daeb8 pc=0xa81f65
runtime.mapiternext(0xc4202db0d0)

```

Config:

```
# Configure monitors
heartbeat.monitors:

- type: tcp
  hosts: ["s1234", "s1234", "s1234", "s1234", "s1234", "s1234"]
  ports: [5555,9000]
  schedule: '@every 180s'
  timeout: 30s

- type: tcp
  hosts: ["s1234", "s12345"]
  ports: [12503]
  schedule: '@every 180s'
  timeout: 30s

#================================ General =====================================
# The name of the shipper that publishes the network data. It can be used to group
hostname: smonitor

#----------------------------- Logstash output --------------------------------
output.logstash:
  # The Logstash hosts
  hosts: ["localhost:5045"]

```

Running on  
Platform : RHEL7 x86\_64

Can someone help?  
Kr,  
Flavio

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [March 20, 2018, 3:21pm UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/2 "2018-03-20T15:21:52Z")

</div>

This is definitely a bug. Is there any more to that stack trace than what you posted? If not, could you try running heartbeat in the foreground and add the [GOTRACEBACK=all](https://golang.org/pkg/runtime/) environment variable. Like

`sudo GOTRACEBACK=all heartbeat -e`

---

<div class="post-metadata">

**Author:** ![Flavio\_Fortes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flavio_fortes/32/42806_2.png) [@Flavio\_Fortes](https://discuss.elastic.co/u/Flavio_Fortes)\
**Post date:** [March 21, 2018, 11:37am UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/3 "2018-03-21T11:37:26Z")

</div>

Thanks for the reply Andrew,

Attached the full stack trace running with " GOTRACEBACK=all heartbeat/heartbeat -e -d "\*""

 ![3](https://us1.discourse-cdn.com/elastic/original/3X/6/f/6fbf8350ba2bb54bc802bd36aa4e52f4ebad25cf.png)  
Kr,  
Flavio

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [March 21, 2018, 12:04pm UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/4 "2018-03-21T12:04:37Z")

</div>

Thanks that helps a lot it finding the root causes. Any chance you can provide it as text? You can use [https://pastebin.com](https://pastebin.com) if it's too large to fit in here.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [March 21, 2018, 12:13pm UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/5 "2018-03-21T12:13:52Z")

</div>

I logged a bug in Github for this at [https://github.com/elastic/beats/issues/6616#issue-307219993](https://github.com/elastic/beats/issues/6616#issue-307219993). I recommend subscribing to the issue for updates.

---

<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:** [April 18, 2018, 12:13pm UTC](https://discuss.elastic.co/t/heartbeat-fatal-error-concurrent-map-iteration-and-map-write/124716/6 "2018-04-18T12:13:57Z")

</div>

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