ethereum / wiki

The Ethereum Wiki
https://www.ethereum.org
14.75k stars 2.56k forks source link

Is there a BUG in geth? About goleveldb #587

Closed dong14 closed 6 years ago

dong14 commented 6 years ago

Now, my geth is running in the "full" mode, but when the amount of data is more than 1TB, the process is interrupted. And the error is as follows:

panic: runtime error: index out of range [recovered] panic: runtime error: index out of range [recovered] panic: runtime error: index out of range goroutine 30 [running]: github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).mCompaction.func1(0xc47488df28, 0xc4200f5680) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:741 +0xf1 panic(0xe0fa60, 0x181a830) /usr/local/go/src/runtime/panic.go:491 +0x283 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).compactionTransact.func1(0x18516e0, 0xc4420c6eb0, 0xc4200f5680, 0xc4457dc320, 0xc) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:158 +0x1c0 panic(0xe0fa60, 0x181a830) /usr/local/go/src/runtime/panic.go:491 +0x283 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.shortenb(0x10040758a4f, 0x4, 0xc47488d440) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util.go:30 +0x14d github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(version).computeCompaction(0xc45a0f1b30) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/version.go:395 +0x4b3 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(versionStaging).finish(0xc47488d760, 0xc4387a8320) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/version.go:510 +0x935 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(version).spawn(0xc42fe67810, 0xc4387a8320, 0xc42fe67810) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/version.go:279 +0x7a github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(session).commit(0xc42008c240, 0xc4387a8320, 0x0, 0x0) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/session.go:195 +0x88 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).compactionCommit.func1(0xc4457dc330, 0xc4317d6e01, 0xc4457dc330) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:263 +0x37 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(compactionTransactFunc).run(0xc4420c6eb0, 0xc4457dc330, 0x18516e0, 0xc4420c6eb0) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:241 +0x33 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).compactionTransact(0xc4200f5680, 0xc4457dc320, 0xc, 0x18516e0, 0xc4420c6eb0) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:185 +0x162 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).compactionTransactFunc(0xc4200f5680, 0xc4457dc320, 0xc, 0xc46b8a4d40, 0x0) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:252 +0x99 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).compactionCommit(0xc4200f5680, 0xf45dee, 0x5, 0xc4387a8320) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:262 +0x120 github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(DB).memCompaction(0xc4200f5680) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:322 +0x4ef github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).mCompaction(0xc4200f5680) /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go:755 +0x8b created by github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.openDB /mnt/go/src/github.com/ethereum/go-ethereum-1.7.3/build/_workspace/src/github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/db.go:147 +0x680

After analysis,the code with problem is as follows:

`var bunits = [...]string{"", "Ki", "Mi", "Gi"}

func shortenb(bytes int) string { i := 0 for ; bytes > 1024 && i < 4; i++ { bytes /= 1024 } return fmt.Sprintf("%d%sB", bytes, bunits[i]) }`

So, please pay attention to it as soon as possible.

jamesray1 commented 6 years ago

Ask in https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge, not here.

karalabe commented 6 years ago

It was already fixed and a new release pushed out. Please update.