@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.
@WesleyCharlesBlake found the following error:
This happens when
downloadis called with an empty array of ipfsFileHashes:node/src/StorageReader/ClaimController.ts
Lines 57 to 77 in 6d41162
If
ipfsFileHashesis empty, this resolves todownloadshould 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.