Segmentation violation and other errors with Go 1.13.6 - Beats 7.5.1

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
go test
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/", line 392, in standalone_func
return func(*(a + p.args), **p.kwargs)
File "/src/", line 165, in test_json_simple_comparisons
File "/src/", line 104, in check_kill_and_wait
return self.check_wait(exit_code=exit_code)
File "/src/", 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.

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?

Same error:

root@2a4cae7a4792://src/ mage goTestUnit
2020/01/15 18:12:56 Found Elastic Beats dir at /src/
Unknown target specified: goTestUnit
root@2a4cae7a4792://src/ cd heartbeat/
root@2a4cae7a4792://src/ mage goTestUnit
2020/01/15 18:13:39 Found Elastic Beats dir at /src/

go test: Unit Testing
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]:*FlagSet).AddGoFlag(0xc00021c870, 0x0)

Fail: 1
Skip: 0
Pass: 223
Packages: 11
Duration: 34.266046999s
JUnit Report: /src/
Output File: /src/

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.

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?

Yes - I tried in couple of envt with similar results. Wonder if it is related to :

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

And to confirm, this is all on x86_64 and s390x where these issues are occurring right?

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?


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