Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: duplicate key value violates unique constraint "PK_WalletObjects" #4977

Closed
1 task done
hell0-w opened this issue May 17, 2023 · 2 comments · Fixed by #4985
Closed
1 task done

[Bug]: duplicate key value violates unique constraint "PK_WalletObjects" #4977

hell0-w opened this issue May 17, 2023 · 2 comments · Fixed by #4985
Assignees
Labels
Milestone

Comments

@hell0-w
Copy link

hell0-w commented May 17, 2023

What is your BTCPay version?

TCPay Server v1.9.3+781190a65

How did you deploy BTCPay Server?

https://install.btcpayserver.org/

What happened?

After update from v.BTCPay Server v1.7.5+372df93c1 to new version BTCPay Server v1.9.3+781190a65

I see that in postgres logs errors and in NBXplorer:

*** data,key and tx are changed to short log view: ...

this ticket can help me to solve it?
#4743
SELECT SETVAL('"InvoiceSearches_Id_seq"', (SELECT max("Id") FROM "InvoiceSearches"));

Need your help.
Thanks.

Also after update i have a bug with invoices.
Link to new ticket:
#4978

How did you encounter this bug?

docker logs -f generated_postgres_1 -t
docker logs -f generated_nbxplorer_1 -t

Relevant log output

`2023-05-17 09:28:19.834 UTC [9293] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:28:19.834 UTC [9293] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, label, invoice) already exists.
2023-05-17 09:28:19.834 UTC [9293] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:28:19.844 UTC [9298] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:28:19.844 UTC [9298] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, invoice, KuezCbYieRQPJaP2irr6fm) already exists.
2023-05-17 09:28:19.844 UTC [9298] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:28:19.855 UTC [9294] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:28:19.855 UTC [9294] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, tx, 05aaac4b...) already exists.
2023-05-17 09:28:19.855 UTC [9294] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:32:51.961 UTC [9327] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:32:51.961 UTC [9327] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, tx, b05de59...) already exists.
2023-05-17 09:32:51.961 UTC [9327] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:32:51.965 UTC [9329] ERROR:  duplicate key value violates unique constraint "PK_WalletObjectLinks"
2023-05-17 09:32:51.965 UTC [9329] DETAIL:  Key ("WalletId", "AType", "AId", "BType", "BId")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, address, 38vfg8sJhwPDCxpobHvRH6GCCLGgGPhYYs, tx, b05de59...) already exists.
2023-05-17 09:32:51.965 UTC [9329] STATEMENT:  INSERT INTO "WalletObjectLinks" ("AId", "AType", "BId", "BType", "WalletId", "Data")
        VALUES ($1, $2, $3, $4, $5, $6)
2023-05-17 09:32:51.972 UTC [9330] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:32:51.972 UTC [9330] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, tx, b8e4f81c9d3effe1744249f782cc01d6cde8ea12f5d749c1b97e39aa3196e9a5) already exists.
2023-05-17 09:32:51.972 UTC [9330] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:32:51.975 UTC [9357] ERROR:  duplicate key value violates unique constraint "PK_WalletObjectLinks"
2023-05-17 09:32:51.975 UTC [9357] DETAIL:  Key ("WalletId", "AType", "AId", "BType", "BId")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, address, 3GLwGRJsVyh6msebSmC6t86Q45u9gYeyPM, tx, b8e4f8...) already exists.
2023-05-17 09:32:51.975 UTC [9357] STATEMENT:  INSERT INTO "WalletObjectLinks" ("AId", "AType", "BId", "BType", "WalletId", "Data")
        VALUES ($1, $2, $3, $4, $5, $6)
2023-05-17 09:32:51.982 UTC [9327] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:32:51.982 UTC [9327] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, tx, 05aaac...) already exists.
2023-05-17 09:32:51.982 UTC [9327] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:32:51.985 UTC [9329] ERROR:  duplicate key value violates unique constraint "PK_WalletObjectLinks"
2023-05-17 09:32:51.985 UTC [9329] DETAIL:  Key ("WalletId", "AType", "AId", "BType", "BId")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, address, 3DyFYN2kru7oTWLCivAFHpCL9ipjV2bhei, tx, 05aaac...) already exists.
2023-05-17 09:32:51.985 UTC [9329] STATEMENT:  INSERT INTO "WalletObjectLinks" ("AId", "AType", "BId", "BType", "WalletId", "Data")
        VALUES ($1, $2, $3, $4, $5, $6)
2023-05-17 09:36:18.534 UTC [9328] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:36:18.534 UTC [9328] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, label, invoice) already exists.
2023-05-17 09:36:18.534 UTC [9328] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:36:18.543 UTC [9329] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:36:18.543 UTC [9329] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, invoice, 7td1y7BcmUSz12WcLUcjB3) already exists.
2023-05-17 09:36:18.543 UTC [9329] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)
2023-05-17 09:36:18.550 UTC [9313] ERROR:  duplicate key value violates unique constraint "PK_WalletObjects"
2023-05-17 09:36:18.550 UTC [9313] DETAIL:  Key ("WalletId", "Type", "Id")=(S-AprSc64pgef2z67QkY9SecxB2...-BTC, tx, 3da0abc...) already exists.
2023-05-17 09:36:18.550 UTC [9313] STATEMENT:  INSERT INTO "WalletObjects" ("Id", "Type", "WalletId", "Data")
        VALUES ($1, $2, $3, $4)`


__________________________

in NBXplorer log of container i see thiss error:

2023-05-17T08:43:23.849973228Z info: Explorer:       BTC: Transaction 1e4... failed to broadcast (Code: RPC_TRANSACTION_ERROR, Message: General error during transaction submission, Details: bad-txns-inputs-missingorspent )

What browser do you use?

No response

Additional information

No response

Are you sure this is a bug report?

  • I confirm this is a bug report
@hell0-w hell0-w changed the title [Bug]: [Bug]: duplicate key value violates unique constraint "PK_WalletObjects" May 17, 2023
@pavlenex pavlenex added the Bug label May 17, 2023
@pavlenex pavlenex added this to the 1.10.0 milestone May 17, 2023
@NicolasDorier
Copy link
Member

Your version is quite old, please update.
Those logs are just noisy and don't show an actual problem I opened a PR to avoid having spam in the logs.

@hell0-w hell0-w closed this as completed May 18, 2023
@github-project-automation github-project-automation bot moved this from Backlog 🪵 to Done ✅ in BTCPay Server Roadmap 🛣️ May 18, 2023
@hell0-w hell0-w reopened this May 18, 2023
@github-project-automation github-project-automation bot moved this from Done ✅ to To-Do 📝 in BTCPay Server Roadmap 🛣️ May 18, 2023
@hell0-w
Copy link
Author

hell0-w commented May 18, 2023

Your version is quite old, please update. Those logs are just noisy and don't show an actual problem I opened a PR to avoid having spam in the logs.

@NicolasDorier
Thanks for answer.
Logs witch I provide above from latest version after update, it's updated latest version:
Current version BTCPay Server v1.9.3+781190a65,

Thanks for creating PR.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants