# Segmentation violation and other errors with Go 1.13.6 - Beats 7.5.1

**URL:** <https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [January 15, 2020, 8:54pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208 "2020-01-15T20:54:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rishi\_Misra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishi_misra/32/53882_2.png) [@Rishi\_Misra](https://discuss.elastic.co/u/Rishi_Misra)\
**Post date:** [January 15, 2020, 8:54pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/1 "2020-01-15T20:54:49Z")

</div>

Hi there,

I am in the process of porting Beats on s390x architecture and noticed that there are multiple segmentation violation when running test cases (Most of the beats - for example Filebeat, Packetbeat, Heartbeat has this error).

This also happens on x86 arch (Linux 2a4cae7a4792 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86\_64 x86\_64 x86\_64 GNU/Linux)

/============================================/  
...  
Testing Heartbeat  
go test -i [github.com/elastic/beats/heartbeat](http://github.com/elastic/beats/heartbeat) [github.com/elastic/beats/heartbeat/autodiscover](http://github.com/elastic/beats/heartbeat/autodiscover) [github.com/elastic/beats/heartbeat/autodiscover/builder/hints](http://github.com/elastic/beats/heartbeat/autodiscover/builder/hints) [github.com/elastic/beats/heartbeat/beater](http://github.com/elastic/beats/heartbeat/beater) [github.com/elastic/beats/heartbeat/cmd](http://github.com/elastic/beats/heartbeat/cmd) [github.com/elastic/beats/heartbeat/config](http://github.com/elastic/beats/heartbeat/config) [github.com/elastic/beats/heartbeat/eventext](http://github.com/elastic/beats/heartbeat/eventext) [github.com/elastic/beats/heartbeat/hbtest](http://github.com/elastic/beats/heartbeat/hbtest) [github.com/elastic/beats/heartbeat/include](http://github.com/elastic/beats/heartbeat/include) [github.com/elastic/beats/heartbeat/look](http://github.com/elastic/beats/heartbeat/look) [github.com/elastic/beats/heartbeat/monitors](http://github.com/elastic/beats/heartbeat/monitors) [github.com/elastic/beats/heartbeat/monitors/active/dialchain](http://github.com/elastic/beats/heartbeat/monitors/active/dialchain) [github.com/elastic/beats/heartbeat/monitors/active/http](http://github.com/elastic/beats/heartbeat/monitors/active/http) [github.com/elastic/beats/heartbeat/monitors/active/icmp](http://github.com/elastic/beats/heartbeat/monitors/active/icmp) [github.com/elastic/beats/heartbeat/monitors/active/tcp](http://github.com/elastic/beats/heartbeat/monitors/active/tcp) [github.com/elastic/beats/heartbeat/monitors/defaults](http://github.com/elastic/beats/heartbeat/monitors/defaults) [github.com/elastic/beats/heartbeat/monitors/jobs](http://github.com/elastic/beats/heartbeat/monitors/jobs) [github.com/elastic/beats/heartbeat/monitors/wrappers](http://github.com/elastic/beats/heartbeat/monitors/wrappers) [github.com/elastic/beats/heartbeat/reason](http://github.com/elastic/beats/heartbeat/reason) [github.com/elastic/beats/heartbeat/scheduler](http://github.com/elastic/beats/heartbeat/scheduler) [github.com/elastic/beats/heartbeat/scheduler/schedule](http://github.com/elastic/beats/heartbeat/scheduler/schedule) [github.com/elastic/beats/heartbeat/scheduler/schedule/cron](http://github.com/elastic/beats/heartbeat/scheduler/schedule/cron) [github.com/elastic/beats/heartbeat/scripts/mage](http://github.com/elastic/beats/heartbeat/scripts/mage) [github.com/elastic/beats/heartbeat/watcher](http://github.com/elastic/beats/heartbeat/watcher)  
go test [github.com/elastic/beats/heartbeat](http://github.com/elastic/beats/heartbeat) [github.com/elastic/beats/heartbeat/autodiscover](http://github.com/elastic/beats/heartbeat/autodiscover) [github.com/elastic/beats/heartbeat/autodiscover/builder/hints](http://github.com/elastic/beats/heartbeat/autodiscover/builder/hints) [github.com/elastic/beats/heartbeat/beater](http://github.com/elastic/beats/heartbeat/beater) [github.com/elastic/beats/heartbeat/cmd](http://github.com/elastic/beats/heartbeat/cmd) [github.com/elastic/beats/heartbeat/config](http://github.com/elastic/beats/heartbeat/config) [github.com/elastic/beats/heartbeat/eventext](http://github.com/elastic/beats/heartbeat/eventext) [github.com/elastic/beats/heartbeat/hbtest](http://github.com/elastic/beats/heartbeat/hbtest) [github.com/elastic/beats/heartbeat/include](http://github.com/elastic/beats/heartbeat/include) [github.com/elastic/beats/heartbeat/look](http://github.com/elastic/beats/heartbeat/look) [github.com/elastic/beats/heartbeat/monitors](http://github.com/elastic/beats/heartbeat/monitors) [github.com/elastic/beats/heartbeat/monitors/active/dialchain](http://github.com/elastic/beats/heartbeat/monitors/active/dialchain) [github.com/elastic/beats/heartbeat/monitors/active/http](http://github.com/elastic/beats/heartbeat/monitors/active/http) [github.com/elastic/beats/heartbeat/monitors/active/icmp](http://github.com/elastic/beats/heartbeat/monitors/active/icmp) [github.com/elastic/beats/heartbeat/monitors/active/tcp](http://github.com/elastic/beats/heartbeat/monitors/active/tcp) [github.com/elastic/beats/heartbeat/monitors/defaults](http://github.com/elastic/beats/heartbeat/monitors/defaults) [github.com/elastic/beats/heartbeat/monitors/jobs](http://github.com/elastic/beats/heartbeat/monitors/jobs) [github.com/elastic/beats/heartbeat/monitors/wrappers](http://github.com/elastic/beats/heartbeat/monitors/wrappers) [github.com/elastic/beats/heartbeat/reason](http://github.com/elastic/beats/heartbeat/reason) [github.com/elastic/beats/heartbeat/scheduler](http://github.com/elastic/beats/heartbeat/scheduler) [github.com/elastic/beats/heartbeat/scheduler/schedule](http://github.com/elastic/beats/heartbeat/scheduler/schedule) [github.com/elastic/beats/heartbeat/scheduler/schedule/cron](http://github.com/elastic/beats/heartbeat/scheduler/schedule/cron) [github.com/elastic/beats/heartbeat/scripts/mage](http://github.com/elastic/beats/heartbeat/scripts/mage) [github.com/elastic/beats/heartbeat/watcher](http://github.com/elastic/beats/heartbeat/watcher)  
panic: runtime error: invalid memory address or nil pointer dereference  
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x202aff6]

# ...

## FAIL: Test JSON response with simple straight-forward comparisons [with body='{"foo": 3}', comparison={'foo': 3}]

Traceback (most recent call last):  
File "//src/github.com/elastic/beats/heartbeat/build/python-env/local/lib/python2.7/site-packages/parameterized/parameterized.py", line 392, in standalone\_func  
return func(\*(a + p.args), \*\*p.kwargs)  
File "/src/github.com/elastic/beats/heartbeat/tests/system/test\_monitor.py", line 165, in test\_json\_simple\_comparisons  
proc.check\_kill\_and\_wait()  
File "/src/github.com/elastic/beats/heartbeat/tests/system/../../../libbeat/tests/system/beat/beat.py", line 104, in check\_kill\_and\_wait  
return self.check\_wait(exit\_code=exit\_code)  
File "/src/github.com/elastic/beats/heartbeat/tests/system/../../../libbeat/tests/system/beat/beat.py", line 93, in check\_wait  
exit\_code, actual\_exit\_code)  
AssertionError: Expected exit code to be 0, but it was 2

/============================================/

Upon changing Go version to 1.12.9 everything seems to work pretty well (at least most of the test cases pass).

I wonder if these are known issues.

Thanks for any guidance.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 15, 2020, 11:01pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/2 "2020-01-15T23:01:57Z")

</div>

Hmmm, this is a bit odd, we do run our internal builds on 1.13.6, and they do pass consistently on linux.

Out of curiosity, what happens with 1.13.6 when running `mage goTestUnit`?

---

<div class="post-metadata">

**Author:** ![Rishi\_Misra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishi_misra/32/53882_2.png) [@Rishi\_Misra](https://discuss.elastic.co/u/Rishi_Misra)\
**Post date:** [January 15, 2020, 11:18pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/3 "2020-01-15T23:18:25Z")

</div>

Same error:

/=============================/  
root@2a4cae7a4792://src/github.com/elastic/beats# mage goTestUnit  
2020/01/15 18:12:56 Found Elastic Beats dir at /src/github.com/elastic/beats  
Unknown target specified: goTestUnit  
root@2a4cae7a4792://src/github.com/elastic/beats# cd heartbeat/  
root@2a4cae7a4792://src/github.com/elastic/beats/heartbeat# mage goTestUnit  
2020/01/15 18:13:39 Found Elastic Beats dir at /src/github.com/elastic/beats

> > go test: Unit Testing  
> > FAILURES:  
> > Package: [github.com/elastic/beats/heartbeat](http://github.com/elastic/beats/heartbeat)  
> > Test: Failure  
> > panic: runtime error: invalid memory address or nil pointer dereference  
> > [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x202aff6]  
> > goroutine 1 [running]:  
> > [github.com/elastic/beats/vendor/github.com/spf13/pflag.(\*FlagSet).AddGoFlag](http://github.com/elastic/beats/vendor/github.com/spf13/pflag.(*FlagSet).AddGoFlag)(0xc00021c870, 0x0)  
> > [github.com/elastic/beats/heartbeat.init.0()](http://github.com/elastic/beats/heartbeat.init.0())

* * *

SUMMARY:  
Fail: 1  
Skip: 0  
Pass: 223  
Packages: 11  
Duration: 34.266046999s  
JUnit Report: /src/github.com/elastic/beats/heartbeat/build/TEST-go-unit.xml  
Output File: /src/github.com/elastic/beats/heartbeat/build/TEST-go-unit.out

> > go test: Unit Test Failed  
> > Error: go test failed: 1 test failures

/=============================/

I don't think it matters but just FYI: I am running this inside a Docker container launched using `docker run --rm -it ubuntu:18.04 bash`. I did the same test in another container using Go 1.12.9 and it worked fine.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 16, 2020, 2:29am UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/4 "2020-01-16T02:29:56Z")

</div>

Something weird is going on here, the tests for the beats codebase are run daily on my (linux x86\_64) laptop, our CI servers, and tons of developers and others. I never hear about segfaults as an issue.

I suspect there's something about your environment that's off but it's really hard to say what it is. Have you tried building it in an other environment?

---

<div class="post-metadata">

**Author:** ![Rishi\_Misra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishi_misra/32/53882_2.png) [@Rishi\_Misra](https://discuss.elastic.co/u/Rishi_Misra)\
**Post date:** [January 16, 2020, 8:35pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/5 "2020-01-16T20:35:09Z")

</div>

Yes - I tried in couple of envt with similar results. Wonder if it is related to : [https://github.com/elastic/beats/issues/13910](https://github.com/elastic/beats/issues/13910)?

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 16, 2020, 10:33pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/6 "2020-01-16T22:33:08Z")

</div>

Which branch are you on? Have you tried this on master? There may be some issues with your setup on 7.5 I hear.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 16, 2020, 10:33pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/7 "2020-01-16T22:33:30Z")

</div>

And to confirm, this is all on x86\_64 _and_ s390x where these issues are occurring right?

---

<div class="post-metadata">

**Author:** ![Rishi\_Misra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishi_misra/32/53882_2.png) [@Rishi\_Misra](https://discuss.elastic.co/u/Rishi_Misra)\
**Post date:** [January 17, 2020, 3:23pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/8 "2020-01-17T15:23:16Z")

</div>

I have been using 7.5.1 branch where this problem occurs.

Master works just fine with Go 1.13.6

In the link I mentioned above there are some workarounds mentioned which fixes the issue (adding `testing.Init()` in the code which has made its way to the master branch). Wonder if 7.5.1 docs can be changed to reflect this behavior - i.e., use Go 1.12.9 with 7.5.1?

---

<div class="post-metadata">

**Author:** ![Rishi\_Misra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishi_misra/32/53882_2.png) [@Rishi\_Misra](https://discuss.elastic.co/u/Rishi_Misra)\
**Post date:** [January 17, 2020, 3:26pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/9 "2020-01-17T15:26:22Z")

</div>

Yes.

---

<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:** [February 14, 2020, 3:26pm UTC](https://discuss.elastic.co/t/segmentation-violation-and-other-errors-with-go-1-13-6-beats-7-5-1/215208/10 "2020-02-14T15:26:22Z")

</div>

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