Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

BulkWriteError: E11000 duplicate key error collection: meteor.validators index: consensus_pubkey_1 #310

Closed
michaelfig opened this issue Mar 8, 2020 · 4 comments

Comments

@michaelfig
Copy link
Contributor

michaelfig commented Mar 8, 2020

Describe the bug

I get the following error when starting meteor on a fresh MongoDB database: BulkWriteError: E11000 duplicate key error collection: meteor.validators index: consensus_pubkey_1

To Reproduce
Steps to reproduce the behavior:

  1. Check out the kwun/sdk-v0.38.x branch
  2. Create the settings.json
`settings.json` contents ```json { "public":{ "chainName": "Agoric Testnet", "chainId": "testnet-1.17.0", "gtm": "{Add your Google Tag Manager ID here}", "slashingWindow": 10000, "uptimeWindow": 250, "initialPageSize": 30, "bech32PrefixAccAddr": "cosmos", "bech32PrefixAccPub": "cosmospub", "bech32PrefixValAddr": "cosmosvaloper", "bech32PrefixValPub": "cosmosvaloperpub", "bech32PrefixConsAddr": "cosmosvalcons", "bech32PrefixConsPub": "cosmosvalconspub", "bondDenom": "uagstake", "powerReduction": 1000000, "coins": [ { "denom": "uagstake", "displayName": "AGSTAKE", "displayNamePlural": "AGSTAKES", "fraction": 1000000 } ], "gasPrice": 0.00, "coingeckoId": null }, "genesisFile": "https://testnet.agoric.com/genesis.json", "remote":{ "rpc":"http://178.62.245.23:26657", "lcd":"http://127.0.0.1:1317" }, "debug": { "startTimer": true, "readGenesis": true }, "params":{ "startHeight": 0, "defaultBlockTime": 5000, "blockInterval": 15000, "consensusInterval": 1000, "statusInterval":7500, "signingInfoInterval": 1800000, "proposalInterval": -1, "missedBlocksInterval": 60000, "delegationInterval": 900000 } } ```
3. Destroy the MongoDB database:
bash$ mongo
> use meteor
> db.dropDatabase()
  1. Run meteor npm install --save
  2. Run meteor --settings settings.json

Expected behavior
No errors.

Screenshots

log messages from starting meteor with the above settings.json
[[[[[ ~/big-dipper ]]]]]                                                        

=> Started proxy.                             
=> Started MongoDB.                                                             
app/client/styles.scss: warn: There are some @import rules in the middle of a file. This might be a bug, as imports are only valid at the beginning of a file.
W20200308-16:07:15.830(0)? (STDERR) CHECK SETTINGS JSON: public.coingeckoId is missing from settings
W20200308-16:07:15.892(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.39 is missing from settings
W20200308-16:07:15.893(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.40 is missing from settings
W20200308-16:07:15.894(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.41 is missing from settings
W20200308-16:07:15.894(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.42 is missing from settings
W20200308-16:07:15.894(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.43 is missing from settings
W20200308-16:07:15.895(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.44 is missing from settings
W20200308-16:07:15.895(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.45 is missing from settings
W20200308-16:07:15.895(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.46 is missing from settings
W20200308-16:07:15.896(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.47 is missing from settings
W20200308-16:07:15.896(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.48 is missing from settings
W20200308-16:07:15.896(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.49 is missing from settings
W20200308-16:07:15.896(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.50 is missing from settings
W20200308-16:07:15.897(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.51 is missing from settings
W20200308-16:07:15.897(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.52 is missing from settings
W20200308-16:07:15.897(0)? (STDERR) CHECK SETTINGS JSON: genesisFile.53 is missing from settings
W20200308-16:07:15.898(0)? (STDERR) (node:14950) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
I20200308-16:07:15.898(0)? === Start processing genesis file ===
I20200308-16:07:16.076(0)? {
I20200308-16:07:16.078(0)?   description: { moniker: 'node0' },
I20200308-16:07:16.078(0)?   commission: {
I20200308-16:07:16.079(0)?     rate: '0.100000000000000000',
I20200308-16:07:16.079(0)?     max_rate: '0.200000000000000000',
I20200308-16:07:16.079(0)?     max_change_rate: '0.010000000000000000'
I20200308-16:07:16.080(0)?   },
I20200308-16:07:16.080(0)?   min_self_delegation: '1',
I20200308-16:07:16.080(0)?   delegator_address: 'cosmos1jkmhgct3ztatf90v566dgd0pmucnhr8awaxcvu',
I20200308-16:07:16.081(0)?   validator_address: 'cosmosvaloper1jkmhgct3ztatf90v566dgd0pmucnhr8atfjdq0',
I20200308-16:07:16.081(0)?   pubkey: 'cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s',
I20200308-16:07:16.082(0)?   value: { denom: 'uagstake', amount: '2000000' }
I20200308-16:07:16.083(0)? }
I20200308-16:07:16.132(0)? BulkWriteError: E11000 duplicate key error collection: meteor.validators index: consensus_pubkey_1 dup key: { : "cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s" }
I20200308-16:07:16.135(0)?     at OrderedBulkOperation.handleWriteError (/home/bigdipper/.meteor/packages/npm-mongo/.3.3.0.qex4h.f9p14++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/lib/bulk/common.js:1112:11)
I20200308-16:07:16.136(0)?     at resultHandler (/home/bigdipper/.meteor/packages/npm-mongo/.3.3.0.qex4h.f9p14++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/lib/bulk/common.js:501:23)
I20200308-16:07:16.137(0)?     at handler (/home/bigdipper/.meteor/packages/npm-mongo/.3.3.0.qex4h.f9p14++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb-core/lib/sdam/topology.js:893:24)
I20200308-16:07:16.137(0)?     at /home/bigdipper/.meteor/packages/npm-mongo/.3.3.0.qex4h.f9p14++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:397:18
I20200308-16:07:16.137(0)?     at processTicksAndRejections (internal/process/task_queues.js:79:11) {
I20200308-16:07:16.138(0)?   index: 0,
I20200308-16:07:16.138(0)?   code: 11000,
I20200308-16:07:16.139(0)?   errmsg: 'E11000 duplicate key error collection: meteor.validators index: consensus_pubkey_1 dup key: { : "cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s" }',
I20200308-16:07:16.139(0)?   op: {
I20200308-16:07:16.140(0)?     consensus_pubkey: 'cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s',
I20200308-16:07:16.140(0)?     description: { moniker: 'node0' },
I20200308-16:07:16.141(0)?     commission: {
I20200308-16:07:16.141(0)?       rate: '0.100000000000000000',
I20200308-16:07:16.141(0)?       max_rate: '0.200000000000000000',
I20200308-16:07:16.142(0)?       max_change_rate: '0.010000000000000000'
I20200308-16:07:16.142(0)?     },
I20200308-16:07:16.143(0)?     min_self_delegation: '1',
I20200308-16:07:16.143(0)?     operator_address: 'cosmosvaloper1jkmhgct3ztatf90v566dgd0pmucnhr8atfjdq0',
I20200308-16:07:16.144(0)?     delegator_address: 'cosmos1jkmhgct3ztatf90v566dgd0pmucnhr8awaxcvu',
I20200308-16:07:16.144(0)?     voting_power: 2,
I20200308-16:07:16.145(0)?     jailed: false,
I20200308-16:07:16.145(0)?     status: 2,
I20200308-16:07:16.145(0)?     pub_key: {
I20200308-16:07:16.146(0)?       type: 'tendermint/PubKeyEd25519',
I20200308-16:07:16.146(0)?       value: 'Bll96hd8ymjLBBeNll/wnHWU6UIuCZqEwukH+qiYGCs='
I20200308-16:07:16.146(0)?     },
I20200308-16:07:16.146(0)?     address: 'B6E6C700D11BBE7C985947C8032D5BC727B159B4',
I20200308-16:07:16.146(0)?     accpub: 'cosmospub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4srmdqtz',
I20200308-16:07:16.147(0)?     operator_pubkey: 'cosmosvaloperpub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4sn80d7c',
I20200308-16:07:16.147(0)?     _id: 'C6ce2tZ3BaEW5DmaL'
I20200308-16:07:16.147(0)?   },
I20200308-16:07:16.147(0)?   name: 'BulkWriteError',
I20200308-16:07:16.148(0)?   driver: true,
I20200308-16:07:16.148(0)?   err: {
I20200308-16:07:16.148(0)?     index: 0,
I20200308-16:07:16.148(0)?     code: 11000,
I20200308-16:07:16.148(0)?     errmsg: 'E11000 duplicate key error collection: meteor.validators index: consensus_pubkey_1 dup key: { : "cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s" }',
I20200308-16:07:16.149(0)?     op: {
I20200308-16:07:16.149(0)?       consensus_pubkey: 'cosmosvalconspub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4s7dgt3s',
I20200308-16:07:16.149(0)?       description: [Object],
I20200308-16:07:16.149(0)?       commission: [Object],
I20200308-16:07:16.149(0)?       min_self_delegation: '1',
I20200308-16:07:16.150(0)?       operator_address: 'cosmosvaloper1jkmhgct3ztatf90v566dgd0pmucnhr8atfjdq0',
I20200308-16:07:16.150(0)?       delegator_address: 'cosmos1jkmhgct3ztatf90v566dgd0pmucnhr8awaxcvu',
I20200308-16:07:16.150(0)?       voting_power: 2,
I20200308-16:07:16.150(0)?       jailed: false,
I20200308-16:07:16.151(0)?       status: 2,
I20200308-16:07:16.151(0)?       pub_key: [Object],
I20200308-16:07:16.151(0)?       address: 'B6E6C700D11BBE7C985947C8032D5BC727B159B4',
I20200308-16:07:16.151(0)?       accpub: 'cosmospub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4srmdqtz',
I20200308-16:07:16.151(0)?       operator_pubkey: 'cosmosvaloperpub1zcjduepqqevhm6sh0n9x3jcyz7xevhlsn36ef62z9cye4pxzayrl42ycrq4sn80d7c',
I20200308-16:07:16.152(0)?       _id: 'C6ce2tZ3BaEW5DmaL'
I20200308-16:07:16.152(0)?     }
I20200308-16:07:16.152(0)?   },
I20200308-16:07:16.152(0)?   result: BulkWriteResult {
I20200308-16:07:16.152(0)?     result: {
I20200308-16:07:16.153(0)?       ok: 1,
I20200308-16:07:16.153(0)?       writeErrors: [Array],
I20200308-16:07:16.153(0)?       writeConcernErrors: [],
I20200308-16:07:16.153(0)?       insertedIds: [Array],
I20200308-16:07:16.154(0)?       nInserted: 0,
I20200308-16:07:16.154(0)?       nUpserted: 0,
I20200308-16:07:16.154(0)?       nMatched: 0,
I20200308-16:07:16.154(0)?       nModified: 0,
I20200308-16:07:16.154(0)?       nRemoved: 0,
I20200308-16:07:16.155(0)?       upserted: [],
I20200308-16:07:16.155(0)?       lastOp: [Object]
I20200308-16:07:16.155(0)?     }
I20200308-16:07:16.155(0)?   },
I20200308-16:07:16.156(0)?   [Symbol(mongoErrorContextSymbol)]: {}
I20200308-16:07:16.156(0)? }
=> Started your app.

=> App running at: http://localhost:3000/

Desktop (please complete the following information):
n/a

Smartphone (please complete the following information):
n/a

Additional context
Add any other context about the problem here.

Running on linux_x64 (recent Ubuntu). Agoric testnet-1.17.0.

@kwunyeung
Copy link
Member

So this is the error that make you don't have the list of validators. There is a unique index in the validator consensus key making sure validators won't be duplicated. Can you show me what is in the collection db.validators after you see this error message?

@michaelfig
Copy link
Contributor Author

michaelfig commented Mar 8, 2020

bigdipper@explorer-testnet:~/big-dipper$ mongoexport --collection=validators --db=meteor
2020-03-08T23:12:26.310+0000	connected to: mongodb://localhost/
2020-03-08T23:12:26.311+0000	exported 0 records

In the mongo shell, use meteor then show collections returns nothing.

@kwunyeung
Copy link
Member

Ah... I see.

When you run with Meteor directly. It runs the bundled MongoDB in the Meteor application. To remove the db of the application, you either run meteor reset or connect to the mongodb running with it which has a default port of 3001. If you are using mongo client to manipulate it. You should run

bash$ mongo --port 3001

@michaelfig
Copy link
Contributor Author

Okay, the missing meteor reset caused this problem. Closing, and I'll open a new issue.

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

No branches or pull requests

2 participants