Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakdown metrics causes panic on 32-bit arch #727

Closed
axw opened this issue Mar 5, 2020 · 0 comments · Fixed by #728
Closed

Breakdown metrics causes panic on 32-bit arch #727

axw opened this issue Mar 5, 2020 · 0 comments · Fixed by #728

Comments

@axw
Copy link
Member

axw commented Mar 5, 2020

Describe the bug

Breakdown metrics are causing segfaults on 32-bit systems.

To Reproduce

Run the following program on a 32-bit system, or in 32-bit mode (e.g. GOARCH=386 go run ...):

package main

import "go.elastic.co/apm/apmtest"

func main() {
        t := apmtest.DiscardTracer
        for {
                tx := t.StartTransaction("name", "type")
                span := tx.StartSpan("name", "type", nil)
                span.End()
                tx.End()
        }
}

The program will quickly segfault, due to misalignment:

anic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8049fec]

goroutine 34 [running]:
runtime/internal/atomic.Xadd64(0x93f805c, 0x0, 0x0, 0xffffffff, 0x0)
        /home/andrew/tools/go/1.13.0/src/runtime/internal/atomic/asm_386.s:105 +0xc
go.elastic.co/apm.(*breakdownTiming).accumulate(0x93f805c, 0x0, 0x0, 0x0, 0x0, 0x336, 0x0, 0x1)
        /home/andrew/go/src/go.elastic.co/apm/breakdown.go:167 +0x4e
go.elastic.co/apm.(*breakdownMetricsMap).record(0x90b08d0, 0x836ed0d, 0x4, 0x836ec59, 0x4, 0x836ed0d, 0x4, 0x0, 0x0, 0x0, ...)
        /home/andrew/go/src/go.elastic.co/apm/breakdown.go:230 +0x1b1
go.elastic.co/apm.(*breakdownMetrics).recordTransaction(0x90b0930, 0x9082a80, 0x0)
        /home/andrew/go/src/go.elastic.co/apm/breakdown.go:211 +0x29a
go.elastic.co/apm.(*Tracer).loop(0x914a0f0)
        /home/andrew/go/src/go.elastic.co/apm/tracer.go:841 +0x1c56
created by go.elastic.co/apm.newTracer
        /home/andrew/go/src/go.elastic.co/apm/tracer.go:410 +0x615
exit status 2

Setting ELASTIC_APM_BREAKDOWN_METRICS=false in the environment stops this from occurring.

Expected behavior

The program should not crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant