Fantom-foundation / go-opera

Opera blockchain protocol secured by the Lachesis consensus algorithm
https://fantom.foundation/
GNU Lesser General Public License v3.0
262 stars 268 forks source link

Downloaded snapsync files, node crashed after restart with a math/rand/rng.go error #547

Open flolege opened 3 weeks ago

flolege commented 3 weeks ago

Describe the bug I downloaded the snapsync from 09-Jun-2024-01-54. I started my node, and everything worked as expected. I stopped and immediately restarted my node. I got the following error right at startup. Then I tried again, and it worked normally.

`# ./opera --syncmode full --nousb --db.preset ldb-1 --datadir=/.opera --gcmode light --port 5051 --cache 32019 INFO [06-10|12:07:13.655] Maximum peer count total=50 INFO [06-10|12:07:13.655] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" WARN [06-10|12:07:13.655] Option nousb is deprecated and USB is deactivated by default. Use --usb to enable

panic: runtime error: index out of range [6668503113575729992] with length 607 goroutine 1 [running]: math/rand.(rngSource).Uint64(...) /usr/local/go/src/math/rand/rng.go:249 math/rand.(rngSource).Int63(0x0?) /usr/local/go/src/math/rand/rng.go:234 +0x92 math/rand.(Rand).Int63(...) /usr/local/go/src/math/rand/rand.go:84 math/rand.(Rand).Int(...) /usr/local/go/src/math/rand/rand.go:102 github.com/syndtr/goleveldb/leveldb/memdb.(DB).randHeight(0xc000486000) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/memdb/memdb.go:204 +0x4f github.com/syndtr/goleveldb/leveldb/memdb.(DB).Put(0xc000486000, {0xc000711620, 0x5a, 0x5a}, {0xc00215a3cf, 0x1, 0xc006885ec8?}) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/memdb/memdb.go:292 +0x105 github.com/syndtr/goleveldb/leveldb.decodeBatchToMem.func1(0x2610?, {0x1, 0x5a370, 0x52, 0x5a3c3, 0x1}) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/batch.go:304 +0x30d github.com/syndtr/goleveldb/leveldb.decodeBatch({0xc00210000c, 0x27f488, 0x3ffdf4}, 0xc006886060) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/batch.go:281 +0x1de github.com/syndtr/goleveldb/leveldb.decodeBatchToMem({0xc002100000, 0x27f494, 0x3ffe00}, 0x247a43158, 0xc000486000) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/batch.go:299 +0x2c5 github.com/syndtr/goleveldb/leveldb.(DB).recoverJournal(0xc00056aa80) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/db.go:580 +0xa90 github.com/syndtr/goleveldb/leveldb.openDB(0xc00034a0f0) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/db.go:131 +0x43c github.com/syndtr/goleveldb/leveldb.Open({0x1b29f98?, 0xc0002bc150?}, 0xc006886400?) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/db.go:203 +0x188 github.com/syndtr/goleveldb/leveldb.OpenFile({0xc001a70090?, 0x1?}, 0xc006886468) /ch53/go/pkg/mod/github.com/syndtr/goleveldb@v1.0.1-0.20210305035536-64b5b1c73954/leveldb/db.go:225 +0x5d github.com/Fantom-foundation/lachesis-base/kvdb/leveldb.New({0xc001a70090, 0x2a}, 0x7f451ac5e5b8?, 0x17c58, 0x0, 0xc0007022b8) /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/leveldb/leveldb.go:130 +0x168 github.com/Fantom-foundation/lachesis-base/kvdb/leveldb.(Producer).OpenDB(0xc000703200, {0xc00032b012, 0x8}) /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/leveldb/producer.go:56 +0x10a github.com/Fantom-foundation/go-opera/utils/dbutil/dbcounter.(DBProducer).OpenDB(0xc000703218, {0xc00032b012, 0x8}) /ch53/goOpera/utils/dbutil/dbcounter/dbcounter.go:94 +0x37 github.com/Fantom-foundation/lachesis-base/kvdb/flushable.(SyncedPool).callbacks.func1() /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/flushable/synced_pool.go:73 +0x2d github.com/Fantom-foundation/lachesis-base/kvdb/flushable.(LazyFlushable).initUnderlyingDb(0xc0017ef7f0) /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/flushable/lazy_flushable.go:44 +0x64 github.com/Fantom-foundation/lachesis-base/kvdb/flushable.(LazyFlushable).InitUnderlyingDb(0xc0017ef7f0) /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/flushable/lazy_flushable.go:38 +0x86 github.com/Fantom-foundation/lachesis-base/kvdb/flushable.(SyncedPool).Initialize(0x1609060?, {0xc0005fad00?, 0x4, 0xb?}, {0x0, 0x0, 0x0}) /ch53/go/pkg/mod/github.com/!fantom-foundation/lachesis-base@v0.0.0-20230817040848-1326ba9aa59b/kvdb/flushable/syncedpool.go:59 +0x8d github.com/Fantom-foundation/go-opera/integration.MakeMultiProducer(0xc000390768?, 0x4376c7?, {0x0?}) /ch53/goOpera/integration/routing.go:35 +0x14f github.com/Fantom-foundation/go-opera/integration.CheckStateInitialized({0xc000390768, 0x15}, {{0xc00071b740}, {0xc00071b770}, {0xc00071b7a0}, {0x0, 0x0}}) /ch53/goOpera/integration/assembly.go:148 +0x67 github.com/Fantom-foundation/go-opera/integration.makeEngine({, }, , , {{{0xde0b6b3a763ffff, 0x64}, {0x0, 0x0, 0x0}, {0x0, ...}, ...}, ...}) /ch53/goOpera/integration/assembly.go:199 +0x625 github.com/Fantom-foundation/go-opera/integration.MakeEngine({, }, , {{{0xde0b6b3a763ffff, 0x64}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...}) /ch53/goOpera/integration/assembly.go:307 +0x34b github.com/Fantom-foundation/go-opera/cmd/opera/launcher.makeNode(0xc00039c840, 0xc00001e000, 0x0) /ch53/goOpera/cmd/opera/launcher/launcher.go:299 +0x356 github.com/Fantom-foundation/go-opera/cmd/opera/launcher.lachesisMain(0xc00039c840) /ch53/goOpera/cmd/opera/launcher/launcher.go:281 +0xc9 gopkg.in/urfave/cli%2ev1.HandleAction({0x15b4020?, 0x195cf98?}, 0xc0000f3500?) /ch53/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x5a gopkg.in/urfave/cli%2ev1.(App).Run(0xc0006031e0, {0xc000040340, 0xd, 0xd}) /ch53/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:264 +0x725 github.com/Fantom-foundation/go-opera/cmd/opera/launcher.Launch(...) /ch53/goOpera/cmd/opera/launcher/launcher.go:261 main.main() /ch53/goOpera/cmd/opera/main.go:11 +0x35`

To Reproduce Steps to reproduce the behavior are given above.

Expected behavior A clear and concise description of what you expected to happen. No exception when starting the node.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):