core: Postgres block insert issue for block 46631

When running a fresh postgres sync with backend:latest the backend hangs and keeps restarting at block 46631.

Probably related to some recent changes. It´s the block with the first NFTs created it seems.

`I0226 09:05:44.548962 1 server.go:1147] Server._handleBlock: Received block ( 46631 / 107387 ) from Peer [ Remote Address : 35.232.92.5:17000 PeerID=1 ] panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x49 pc=0xb1b525]

goroutine 56 [running]: github.com/go-pg/pg/v10.(*Tx).RunInTransaction.func1() /root/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.0/tx.go:91 +0x86 panic({0x10a56c0, 0x1e8a660}) /usr/lib/go/src/runtime/panic.go:1038 +0x215 github.com/deso-protocol/core/lib.(*Postgres).InsertTransactionsTx(0xc0016054b8, 0xc0016054c8, {0xc016be2000, 0xae4, 0xc0037c7c c0}, 0xc004e97780) /deso/src/core/lib/postgres.go:1092 +0x1b65 github.com/deso-protocol/core/lib.(*Postgres).UpsertBlockAndTransactions.func1(0x0) /deso/src/core/lib/postgres.go:1336 +0x98 github.com/go-pg/pg/v10.(*Tx).RunInTransaction(0xc0016eb280, {0x1730468, 0xc00003a280}, 0xc016cb4230) /root/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.0/tx.go:95 +0xa5 github.com/go-pg/pg/v10.(*baseDB).RunInTransaction(0xc017fda798, {0x1730468, 0xc00003a280}, 0xc010586ea0) /root/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.0/tx.go:74 +0x51 github.com/deso-protocol/core/lib.(*Postgres).UpsertBlockAndTransactions(0xc000168e10, 0xc010586ea0, 0xc017c22000) /deso/src/core/lib/postgres.go:1324 +0x5c github.com/deso-protocol/core/lib.(*Blockchain).ProcessBlock(0xc00082ebb0, 0xc010586ea0, 0xe5) /deso/src/core/lib/blockchain.go:1935 +0x191c github.com/deso-protocol/core/lib.(*Server)._handleBlock(0xc000fd80c0, 0xc001bb6d80, 0xc010586ea0) /deso/src/core/lib/server.go:1193 +0x3e5 github.com/deso-protocol/core/lib.(*Server)._handlePeerMessages(0xc000fd80c0, 0xc001bb6d80) /deso/src/core/lib/server.go:1494 +0x18d github.com/deso-protocol/core/lib.(*Server).messageHandler(0xc000fd80c0) /deso/src/core/lib/server.go:1534 +0x19c created by github.com/deso-protocol/core/lib.(*Server).Start /deso/src/core/lib/server.go:1710 +0xb1 `

Will check what is causing it.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (19 by maintainers)

Most upvoted comments

Wow superfast. Just deleted that DB. But will sync one which has just started. And put this version there

awesome - sounds good. Keep me posted. I was able to reproduce it locally by submitting a bid on serial number 0 - which is a standing offer on any serial number, but there’s no NFT entry (as there is no real serial number 0)

Ok sync is running. Needed to start fresh. Anyway how can I setup the local stuff? I tried in the past but it did not work out. That way I can be of more assistance. Do you have a repo somewhere or the run.sh file? Thanks.

@mvanhalen - I replace the data-dir flag in the n0_test script in backend/scripts/nodes/no_test with the postgres-uri below to run a regtest node locally.

--postgres-uri=postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable \

Regtest allows you to start your own chain locally (not testnet nor mainnet).

I start postgres by using the following command to run a docker container:

sudo docker run --rm --name postgresql -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -d postgres:latest

You can use this scheme to sync to testnet by removing the --regtest flag. To sync mainnet, also remove --testnet=true

Let me know if you have further questions.

Thanks will test tomorrow. Appreciate it. Shameless plug: nftz.zone v2 is out. More here all possible because of Postgres sweetness! @lazynina @diamondhands0

current stable - so that is 2.0.7 i think @mvanhalen

For info @mvanhalen @lazynina - My PG node crashed yesterday - but after restarting just now its stuck at 108741. Looks like time of crash yesterday is same as time this block 108731 was mined.

I restarted with new stable image 2dc0ed73a08f - but still stuck with this error.

E0303 09:35:18.204038 1 blockchain.go:1214] MarkBlockInvalid: Block height: 108741, Block hash: 00000000000014b98e050080d584625a69236b78775bb3792827f9351b9d0eb7, Error: ConnectBlock: : ConnectTransaction: : RuleErrorCreateProfileTxnOutputExceedsInput

As this seems to be a new issue ill raise it as a separate one.

@lazynina @mvanhalen i created this a while ago for dharmesh to run postgres + backend locally

github.com/desodev/prodeso

Wow superfast. Just deleted that DB. But will sync one which has just started. And put this version there

awesome - sounds good. Keep me posted. I was able to reproduce it locally by submitting a bid on serial number 0 - which is a standing offer on any serial number, but there’s no NFT entry (as there is no real serial number 0)

Ok sync is running. Needed to start fresh. Anyway how can I setup the local stuff? I tried in the past but it did not work out. That way I can be of more assistance. Do you have a repo somewhere or the run.sh file? Thanks.

@mvanhalen - I’ll share how I run things locally tomorrow. Can you let me know what didn’t work for you? And assuming you want a local Postgres setup, correct?

@mvanhalen - I’m looking now, apologies for not seeing this issue earlier.