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

MongoError: Invalid Operation, no operations specified #730

Open
lautarodragan opened this issue Nov 6, 2018 · 0 comments
Open

MongoError: Invalid Operation, no operations specified #730

lautarodragan opened this issue Nov 6, 2018 · 0 comments
Assignees
Labels

Comments

@lautarodragan
Copy link
Member

lautarodragan commented Nov 6, 2018

@WesleyCharlesBlake found the following error:

{
  "level": 50,
  "time": 1541423343204,
  "msg": "Error downloading IPFS hashes",
  "pid": 18,
  "hostname": "node-testnet-poet-node-6678fdb454-q6m69",
  "module": "StorageReader",
  "file": "Router",
  "method": "onBatchReaderReadNextDirectorySuccess",
  "error": {
    "driver": true,
    "name": "MongoError",
    "stack": [
      "MongoError: Invalid Operation, no operations specified",
      "    at Function.create (/usr/src/app/node_modules/mongodb-core/lib/error.js:43:12)",
      "    at toError (/usr/src/app/node_modules/mongodb/lib/utils.js:149:22)",
      "    at UnorderedBulkOperation.bulkExecute (/usr/src/app/node_modules/mongodb/lib/bulk/common.js:937:31)",
      "    at UnorderedBulkOperation.execute (/usr/src/app/node_modules/mongodb/lib/bulk/unordered.js:125:22)",
      "    at bulkWrite (/usr/src/app/node_modules/mongodb/lib/operations/collection_ops.js:115:8)",
      "    at /usr/src/app/node_modules/mongodb/lib/utils.js:437:24",
      "    at new Promise (<anonymous>)",
      "    at executeOperation (/usr/src/app/node_modules/mongodb/lib/utils.js:432:10)",
      "    at Collection.insertMany (/usr/src/app/node_modules/mongodb/lib/collection.js:528:10)",
      "    at ClaimController.download (/usr/src/app/dist/babel/src/StorageReader/ClaimController.js:149:35)",
      "    at Router.onBatchReaderReadNextDirectorySuccess (/usr/src/app/dist/babel/src/StorageReader/Router.js:32:44)",
      "    at Channel.BaseChannel.dispatchMessage (/usr/src/app/node_modules/amqplib/lib/channel.js:466:12)",
      "    at Channel.BaseChannel.handleDelivery (/usr/src/app/node_modules/amqplib/lib/channel.js:475:15)",
      "    at Channel.emit (events.js:182:13)",
      "    at /usr/src/app/node_modules/amqplib/lib/channel.js:263:10",
      "    at Channel.content (/usr/src/app/node_modules/amqplib/lib/channel.js:316:9)"
    ],
    "message": "Invalid Operation, no operations specified",
    "type": "MongoError"
  },
  "v": 1
}

This happens when download is called with an empty array of ipfsFileHashes:

async download(ipfsFileHashes: ReadonlyArray<string>) {
const logger = this.logger.child({ method: 'download' })
logger.trace({ ipfsFileHashes }, 'Downloading Claims')
try {
await this.collection.insertMany(
ipfsFileHashes.map(ipfsFileHash => ({
ipfsFileHash,
claimId: null,
lastDownloadAttemptTime: null,
downloadSuccessTime: null,
downloadAttempts: 0,
})),
{ ordered: false },
)
} catch (exception) {
if (exception.code !== ErrorCodes.DuplicateKey) throw exception
logger.trace({ exception }, 'Duplicate IPFS hash')
}
}

If ipfsFileHashes is empty, this resolves to

      await this.collection.insertMany(
        [],
        { ordered: false },
      )

download should check whether the array is empty and do nothing if so.

Severity

This shouldn't be logged as an error not to trigger any false alarms, but it's not causing any damage otherwise.

@lautarodragan lautarodragan added this to the Mainnet-launch milestone Nov 6, 2018
@lautarodragan lautarodragan changed the title Error MongoError: Invalid Operation, no operations specified Nov 6, 2018
@geoffturk geoffturk removed this from the Mainnet-launch milestone Nov 29, 2018
@geoffturk geoffturk added ct-z and removed ct-z labels Nov 29, 2018
@geoffturk geoffturk modified the milestones: Mainnet-launch, PML2 Nov 29, 2018
@lautarodragan lautarodragan removed this from the PML2 milestone Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants