NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 440 forks source link

BoltDB panic: page already freed #2413

Open ericflo opened 6 years ago

ericflo commented 6 years ago

Getting this on startup on the latest from master branch:

Sia Daemon v1.3.1
Loading...
(0/6) Loading siad...
(1/6) Loading gateway...
(2/6) Loading consensus...
(3/6) Loading transaction pool...
panic: page 512601 already freed

goroutine 98 [running]:
github.com/NebulousLabs/bolt.(*freelist).free(0xc42006fce0, 0x27ade, 0x7fcceb86b000)
    /go/src/github.com/NebulousLabs/bolt/freelist.go:121 +0x301
github.com/NebulousLabs/bolt.(*Bucket).free.func1(0x7fcceb86b000, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/bolt/bucket.go:684 +0x51
github.com/NebulousLabs/bolt.(*Bucket)._forEachPageNode(0xc4211268c0, 0x7d259, 0x0, 0xc4201282a8)
    /go/src/github.com/NebulousLabs/bolt/bucket.go:506 +0x87
github.com/NebulousLabs/bolt.(*Bucket).forEachPageNode(0xc4211268c0, 0xc4201282a8)
    /go/src/github.com/NebulousLabs/bolt/bucket.go:499 +0x7c
github.com/NebulousLabs/bolt.(*Bucket).free(0xc4211268c0)
    /go/src/github.com/NebulousLabs/bolt/bucket.go:682 +0x5f
github.com/NebulousLabs/bolt.(*Bucket).DeleteBucket(0xc420730018, 0xc421118440, 0xd, 0x10, 0xc420445000, 0x0)
    /go/src/github.com/NebulousLabs/bolt/bucket.go:255 +0x2ab
github.com/NebulousLabs/bolt.(*Tx).DeleteBucket(0xc420730000, 0xc421118440, 0xd, 0x10, 0xe344095df3e7c5ec, 0x9e)
    /go/src/github.com/NebulousLabs/bolt/tx.go:121 +0x4f
github.com/NebulousLabs/Sia/modules/consensus.applyFileContractMaintenance(0xc420730000, 0xc4200a0160)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/maintenance.go:180 +0x6e5
github.com/NebulousLabs/Sia/modules/consensus.applyMaintenance(0xc420730000, 0xc4200a0160)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/maintenance.go:192 +0x65
github.com/NebulousLabs/Sia/modules/consensus.generateAndApplyDiff(0xc420730000, 0xc4200a0160, 0xc42016a200, 0x2)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/diffs.go:231 +0x1e8
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).applyUntilBlock(0xc42008db80, 0xc420730000, 0xc4200a0160, 0x0, 0x0, 0x0, 0x302000000000000, 0x35006aeeaaf316c3)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/fork.go:84 +0x221
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).forkBlockchain(0xc42008db80, 0xc420730000, 0xc4200a0160, 0x4000000000000000, 0x5d3b68cfd48b4eb5, 0xe2b7b4a14c78d214, 0x5f52a6a98783cd93, 0x947b04a80572e139, 0x59db8745, 0xc420060e40, ...)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/fork.go:111 +0xac
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).addBlockToTree(0xc42008db80, 0xc420730000, 0x4000000000000000, 0x5d3b68cfd48b4eb5, 0xe2b7b4a14c78d214, 0x5f52a6a98783cd93, 0x947b04a80572e139, 0x59db8745, 0xc420060e40, 0x1, ...)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/accept.go:164 +0x106
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).managedAcceptBlocks.func1(0xc420730000, 0xaf2a18, 0xc420730000)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/accept.go:262 +0x2a9
github.com/NebulousLabs/bolt.(*DB).Update(0xc42012e780, 0xc4201292e8, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/bolt/db.go:603 +0x9a
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).managedAcceptBlocks(0xc42008db80, 0xc4202f2400, 0xa, 0xa, 0x0, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/accept.go:245 +0x4f2
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).managedReceiveBlocks(0xc42008db80, 0xe15820, 0xc4203fc140, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/synchronize.go:225 +0x4f9
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).(github.com/NebulousLabs/Sia/modules/consensus.managedReceiveBlocks)-fm(0xe15820, 0xc4203fc140, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/synchronize.go:445 +0x3e
github.com/NebulousLabs/Sia/modules/gateway.(*Gateway).managedRPC(0xc4200a0840, 0xc42001f390, 0x10, 0xac3640, 0xa, 0xc42016a8e0, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/gateway/rpc.go:66 +0x2c2
github.com/NebulousLabs/Sia/modules/gateway.(*Gateway).RPC(0xc4200a0840, 0xc42001f390, 0x10, 0xac3640, 0xa, 0xc42016a8e0, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/gateway/rpc.go:76 +0xd1
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).threadedInitialBlockchainDownload.func1(0xc42008db80, 0xc420129ef0, 0xc420129e98, 0xc420129ea0, 0x0, 0x0)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/synchronize.go:580 +0x127
github.com/NebulousLabs/Sia/modules/consensus.(*ConsensusSet).threadedInitialBlockchainDownload(0xc42008db80, 0xc4203d8300, 0x853b99)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/synchronize.go:601 +0x14a
github.com/NebulousLabs/Sia/modules/consensus.New.func1(0x1, 0xc42016a4b0, 0xc42008db80, 0xe15aa0, 0xc4200a0840)
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/consensusset.go:151 +0x3e4
created by github.com/NebulousLabs/Sia/modules/consensus.New
    /go/src/github.com/NebulousLabs/Sia/modules/consensus/consensusset.go:144 +0x64f
ericflo commented 6 years ago

This may have been a corrupt transactionpool.db, but even if that's true, it doesn't seem like panic is the right behavior. Should these dbs get checksums?

tbenz9 commented 6 years ago

This is likely related to issue #2318 which the Devs are aware of and planning on fixing eventually. Since the error messages are slightly different let's keep this issue open and tag it as Bug.

Recommendation to Devs: "Bug"

lax20attack commented 6 years ago

Any workaround?


A critical error loading Sia has occured: Siad unexpectedly exited. Error log: Loading...
(0/6) Loading siad...
(1/6) Loading gateway...
(2/6) Loading consensus...
(3/6) Loading transaction pool...
panic: page 294241 already freed
lukechampine commented 6 years ago

@lax20attack unfortunately we don't currently have a workaround for this, other than ensuring you have enough free disk space and redownloading the blockchain.

musichook commented 6 years ago

Fixed on Mac by removing this file: /Users/Username/Library/Application Support/Sia-UI/sia/transactionpool/transactionpool.db