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

Duplicate key value violates unique constraint address_unique #3897

Closed
ManuGowda opened this issue Jul 1, 2019 · 2 comments
Closed

Duplicate key value violates unique constraint address_unique #3897

ManuGowda opened this issue Jul 1, 2019 · 2 comments

Comments

@ManuGowda
Copy link
Contributor

Expected behavior

Should not insert a record which already exists

Actual behavior

10:05:00.273Z ERROR lisk-framework:
    Caused error during cleanup { error: duplicate key value violates unique constraint "address_unique"
        at Connection.parseE (/home/lisk/lisk-2.0.0-rc.0-f5bc2760c-e629652-Linux-x86_64/node_modules/pg/lib/connection.js:554:11)
        at Connection.parseMessage (/home/lisk/lisk-2.0.0-rc.0-f5bc2760c-e629652-Linux-x86_64/node_modules/pg/lib/connection.js:379:19)
        at Socket.<anonymous> (/home/lisk/lisk-2.0.0-rc.0-f5bc2760c-e629652-Linux-x86_64/node_modules/pg/lib/connection.js:119:22)
        at Socket.emit (events.js:189:13)
        at Socket.EventEmitter.emit (domain.js:441:20)
        at addChunk (_stream_readable.js:284:12)
        at readableAddChunk (_stream_readable.js:265:11)
        at Socket.Readable.push (_stream_readable.js:220:10)
        at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
      name: 'error',
      length: 218,
      severity: 'ERROR',
      code: '23505',
      detail: 'Key (ip, "wsPort")=(134.209.250.246, 5000) already exists.',
      hint: undefined,
      position: undefined,
      internalPosition: undefined,
      internalQuery: undefined,
      where: undefined,
      schema: 'public',
      table: 'peers',
      column: undefined,
      dataType: undefined,
      constraint: 'address_unique',
      file: 'nbtinsert.c',
      line: '434',
      routine: '_bt_check_unique' }

Steps to reproduce

  • Deploy a network from release branch 2.2.0(sdk) and core(development) branch
  • Enable forging

Which version(s) does this affect? (Environment, OS, etc...)

2.2.0

@ishantiw
Copy link
Member

I tried to re-create the above issue and is only possible when deletion of peers from the database was not called or finished properly. In that case it will throw the above error. To test it, I removed this line and I'm able to see the above error.

await this.storage.entities.Peer.delete();

@ishantiw ishantiw assigned ishantiw and unassigned pablitovicente Jul 11, 2019
@ManuGowda
Copy link
Contributor Author

after merging 2.0.0 changes and 2.1.0 changes to 2.2.0 this issue doesn't exist anymore, so closing this issue.

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

No branches or pull requests

3 participants