honeycombio / loadgen

A flexible command-line load generator to create traces in OTel or Honeycomb formats
Apache License 2.0
6 stars 2 forks source link

fielder: crash in HexString from negative index #38

Closed lizthegrey closed 10 months ago

lizthegrey commented 10 months ago

Versions

Steps to reproduce

Run for a while.

Additional context

panic: runtime error: index out of range [-1]

goroutine 2088 [running]:
math/rand.(*rngSource).Uint64(...)
    math/rand/rng.go:249
math/rand.(*rngSource).Int63(0x0?)
    math/rand/rng.go:234 +0x8c
math/rand.(*Rand).Int63(...)
    math/rand/rand.go:96
math/rand.(*Rand).Int31(...)
    math/rand/rand.go:110
math/rand.(*Rand).Int31n(0x1?, 0xdb4bd40?)
    math/rand/rand.go:142 +0x8c
math/rand.(*Rand).Intn(0x0?, 0x5d63f8?)
    math/rand/rand.go:183 +0x30
main.Rng.Int(...)
    github.com/honeycombio/loadgen/fielder.go:89
main.Rng.HexString({0xf88694b949f0?}, 0x8)
    github.com/honeycombio/loadgen/fielder.go:115 +0x64
main.Rng.getValueGenerators.func14()
    github.com/honeycombio/loadgen/fielder.go:148 +0x40
main.(*Fielder).AddFields(0x40000bb0e0, {0x8886d0, 0x4014588f00}, 0x0, 0x8?)
    github.com/honeycombio/loadgen/fielder.go:479 +0x29c
main.(*SenderOTel).CreateSpan(0x20666f4c?, {0x883ee0?, 0x4006583320?}, {0x77cf26?, 0x0?}, 0x0?, 0x4?)
    github.com/honeycombio/loadgen/sender_otel_honey.go:104 +0x330
main.(*TraceGenerator).generate_spans(0x400060a000, {0x883ee0, 0x4006583320}, 0x2, 0x2, 0x1, 0x9086d489)
    github.com/honeycombio/loadgen/generator.go:98 +0x31c
main.(*TraceGenerator).generate_spans(0x400060a000, {0x883ee0, 0x4015da7740}, 0x1, 0x3, 0x18, 0x6f122eaf2)
    github.com/honeycombio/loadgen/generator.go:99 +0x24c
main.(*TraceGenerator).generate_root(0x400060a000, 0x4018acdf30?, 0x4, 0x19, 0x6fc23ac00)
    github.com/honeycombio/loadgen/generator.go:112 +0x110
main.(*TraceGenerator).generator(0x400060a000, 0x400041a000, 0x0?)
    github.com/honeycombio/loadgen/generator.go:140 +0x1ac
created by main.(*TraceGenerator).Generate in goroutine 21
    github.com/honeycombio/loadgen/generator.go:193 +0x464
lizthegrey commented 10 months ago

another crash:

panic: runtime error: index out of range [-2]

goroutine 867 [running]:
math/rand.(*rngSource).Uint64(...)
    math/rand/rng.go:249
math/rand.(*rngSource).Int63(0x8?)
    math/rand/rng.go:234 +0x92
math/rand.(*Rand).Int63(...)
    math/rand/rand.go:96
math/rand.(*Rand).Int31(...)
    math/rand/rand.go:110
math/rand.(*Rand).Int31n(0xc0003e2d80?, 0x9258768?)
    math/rand/rand.go:142 +0x6a
math/rand.(*Rand).Intn(0x0?, 0x0?)
    math/rand/rand.go:183 +0x25
main.Rng.Int(...)
    github.com/honeycombio/loadgen/fielder.go:89
main.Rng.HexString({0xc?}, 0x8)
    github.com/honeycombio/loadgen/fielder.go:115 +0x66
main.Rng.getValueGenerators.func14()
    github.com/honeycombio/loadgen/fielder.go:148 +0x45
main.(*Fielder).AddFields(0xc0000b10e0, {0xcda130, 0xc008ee5980}, 0x0, 0x6?)
    github.com/honeycombio/loadgen/fielder.go:479 +0x335
main.(*SenderOTel).CreateSpan(0x3cd9a2b?, {0xcd59a0?, 0xc008ae2870?}, {0xbcdc97?, 0x2?}, 0x15?, 0x36a17197d?)
    github.com/honeycombio/loadgen/sender_otel_honey.go:104 +0x41c
main.(*TraceGenerator).generate_spans(0xc0003e7340, {0xcd59a0, 0xc008ae2870}, 0x1, 0x3, 0x18, 0x6e3649ba8)
    github.com/honeycombio/loadgen/generator.go:98 +0x454
main.(*TraceGenerator).generate_root(0xc000275f80?, 0xc000275f40?, 0x4, 0x19, 0x6fc23ac00)
    github.com/honeycombio/loadgen/generator.go:112 +0x165
main.(*TraceGenerator).generator(0xc0003e7340, 0xc0004a6010, 0x3e6?)
    github.com/honeycombio/loadgen/generator.go:140 +0x205
created by main.(*TraceGenerator).Generate in goroutine 15
    github.com/honeycombio/loadgen/generator.go:193 +0x565
lizthegrey commented 10 months ago

Looks like sharing of a seeded rand across goroutines in a non-safe way