nspcc-dev / neofs-sdk-go

Go implementation of NeoFS SDK
Apache License 2.0
6 stars 14 forks source link

Pool unexpected panic #631

Open AliceInHunterland opened 3 weeks ago

AliceInHunterland commented 3 weeks ago

During https://github.com/nspcc-dev/neo-go/pull/3582#issuecomment-2395164230 I have created the pool:

signer := user.NewAutoIDSignerRFC6979(acc.PrivateKey().PrivateKey)
    p, err := pool.New(pool.NewFlatNodeParams(rpcNeoFS), signer, pool.DefaultOptions())
    if err != nil {
        return cli.Exit(fmt.Sprintf("failed to create NeoFS pool: %v", err), 1)
    }

    if err = p.Dial(context.Background()); err != nil {
        return cli.Exit(fmt.Sprintf("failed to dial NeoFS pool: %v", err), 1)
    }
    defer p.Close()

and then tried to p.ObjectPutInit(ctx, hdr, signer, prmObjectPutInit) and received this after ~2 hours of work.

[2024-10-06T01:47:40+03:00] Successfully uploaded block: 442000
panic: runtime error: index out of range [-1]

goroutine 247 [running]:
math/rand.(*rngSource).Uint64(...)
        math/rand/rng.go:249
math/rand.(*rngSource).Int63(0x1400048d6a8?)
        math/rand/rng.go:234 +0x98
math/rand.(*Rand).Int63(...)
        math/rand/rand.go:96
math/rand.(*Rand).Int31(...)
        math/rand/rand.go:110
math/rand.(*Rand).Int31n(0x14000040750?, 0x48d7a0?)
        math/rand/rand.go:142 +0x8c
math/rand.(*Rand).Intn(0x10?, 0x10?)
        math/rand/rand.go:183 +0x30
github.com/nspcc-dev/neofs-sdk-go/pool.(*sampler).Next(0x140001cf3c0)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/sampler.go:63 +0x2c
github.com/nspcc-dev/neofs-sdk-go/pool.(*innerPool).connection(0x140001cf400)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:988 +0x1a0
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).connection(0x60?)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:967 +0x58
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).sdkClient(0xad8f60c33a130b3?)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:1031 +0x1c
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).ObjectPutInit(0x1400048da88, {0x101e0dec0, 0x1027af240}, {0x0, 0x0, 0x1400422a2a0, {0x0, 0x0, 0x0}}, {0x101e0e400, ...}, ...)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/object.go:35 +0xa4
github.com/nspcc-dev/neo-go/cli/util.uploadBlock({0x101e0dec0, 0x1027af240}, {{0x14000192180, 0x1, 0x1}, {0x101e0e400, 0x140003f53b0}, 0x140002fb150, 0x14000436a80, 0x1400004b910, ...}, ...)
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:401 +0x11c
github.com/nspcc-dev/neo-go/cli/util.uploadBin.func3()
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:162 +0x6bc
created by github.com/nspcc-dev/neo-go/cli/util.uploadBin in goroutine 1
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:145 +0xb48
(base) ekaterinapavlova@MacBook-Air-4 neo-go % 

I have been using as rpcNeoFS "st1.t5.fs.neo.org:8080", "st2.t5.fs.neo.org:8080", "st3.t5.fs.neo.org:8080", "st4.t5.fs.neo.org:8080".

Maybe connected with #600

roman-khimov commented 5 days ago

Rather suspicious since it's a math/rand panic. But it's dependent on randomness source. What's the SDK version? Maybe we broke something in recent upgrades.

AliceInHunterland commented 5 days ago

github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12

And we had it (the same one) multiple times - for example, yesterday:

Retrying after error: session: init session: status: code = 1024 message = connection to the RPC node has been lost
panic: runtime error: index out of range [-1]

goroutine 380 [running]:
math/rand.(*rngSource).Uint64(...)
        math/rand/rng.go:249
math/rand.(*rngSource).Int63(0x1040ce160?)
        math/rand/rng.go:234 +0x98
math/rand.(*Rand).Int63(...)
        math/rand/rand.go:96
math/rand.(*Rand).Int31(...)
        math/rand/rand.go:110
math/rand.(*Rand).Int31n(0x0?, 0x2700008?)
        math/rand/rand.go:142 +0x8c
math/rand.(*Rand).Intn(0x10?, 0x10?)
        math/rand/rand.go:183 +0x30
github.com/nspcc-dev/neofs-sdk-go/pool.(*sampler).Next(0x140016cb940)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/sampler.go:63 +0x2c
github.com/nspcc-dev/neofs-sdk-go/pool.(*innerPool).connection(0x140002a6940)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:988 +0x1a0
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).connection(0x60?)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:967 +0x58
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).sdkClient(0x1400204fb58?)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/pool.go:1031 +0x1c
github.com/nspcc-dev/neofs-sdk-go/pool.(*Pool).ObjectHead(0x14000162dc0, {0x1037922c0, 0x1041372a0}, {0xf9, 0x19, 0x7b, 0x9b, 0x81, 0x72, 0xcb, ...}, ...)
        github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.12/pool/object.go:96 +0x8c
github.com/nspcc-dev/neo-go/cli/util.getSmt.func1()
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:411 +0x84
github.com/nspcc-dev/neo-go/cli/util.retry(0x1400204fec8)
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:210 +0xd4
github.com/nspcc-dev/neo-go/cli/util.getSmt(0x14000162dc0, {0xf9, 0x19, 0x7b, 0x9b, 0x81, 0x72, 0xcb, 0x82, 0x30, ...}, ...)
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:410 +0x148
created by github.com/nspcc-dev/neo-go/cli/util.updateIndexFiles in goroutine 1
        github.com/nspcc-dev/neo-go/cli/util/uploader.go:329 +0x5a8
carpawell commented 11 hours ago

@AliceInHunterland, can you also attach go verison just in case? since math's panic is not cool.