Open ajile-in opened 7 years ago
I experienced the same issue and I have a workaround. I had to drop the txs collection (just clearing it of its records was not enough).
I then ran /v1/addresses/scan
to make sure I can see the full transaction history.
If I have more info, I'll post here.
12.9.2017 12.28 "Jeshan Giovanni BABOOA" notifications@github.com kirjoitti:
I experienced the same issue and I have a workaround. I had to drop the txs collection (just clearing it of its records was not enough). I then ran /v1/addresses/scan to make sure I can see the full transaction history.
If I have more info, I'll post here.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitpay/bitcore-wallet-service/issues/653#issuecomment-328797020, or mute the thread https://github.com/notifications/unsubscribe-auth/AchHDdbP-Xz7RH4S-1XPv3NVRAnjTUrKks5shk7UgaJpZM4NPIdc .
This is what appears in mongo log at time of error:
2017-09-15T09:21:54.481+0000 [conn14] query bws.fiat_rates query: { orderby: { ts: -1 }, $query: { provider: "BitPay", code: "USD", ts: { $lte: 1505467314041.0 } } } planSummary: COLLSCAN, COLLSCAN ntoreturn:1 ntoskip:0 nscanned:650309 nscannedObjects:650309 keyUpdates:0 numYields:1 locks(micros) r:821744 nreturned:1 reslen:104 430ms 2017-09-15T09:21:56.254+0000 [conn13] bws.txs Assertion failure 0 src/mongo/db/query/index_bounds_builder.cpp 862 2017-09-15T09:21:56.265+0000 [conn13] bws.txs 0x121df81 0x11bd689 0x11a1bf4 0xd55a47 0xd967e1 0xd96925 0xd97e4d 0xd9902a 0xd996a6 0xdaf2fe 0xade3b5 0xae08e4 0xae296e 0xabefef 0xd902ef 0xd73b87 0xbb4562 0xbb5ae0 0x774658 0x11d18db /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x121df81] /usr/bin/mongod(_ZN5mongo10logContextEPKc+0x159) [0x11bd689] /usr/bin/mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x194) [0x11a1bf4] /usr/bin/mongod(_ZN5mongo18IndexBoundsBuilder11alignBoundsEPNS_11IndexBoundsERKNS_7BSONObjEi+0x587) [0xd55a47] /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess14finishLeafNodeEPNS_17QuerySolutionNodeERKNS_10IndexEntryE+0x221) [0xd967e1] /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess19finishAndOutputLeafEPNS0_17ScanBuildingStateEPSt6vectorIPNS_17QuerySolutionNodeESaIS5_EE+0x45) [0xd96925] /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess17processIndexScansERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EEPS6_IPNS_17QuerySolutionNodeESaISD_EE+0x59d) [0xd97e4d] /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess15buildIndexedAndERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x5a) [0xd9902a] /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess22buildIndexedDataAccessERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x146) [0xd996a6] /usr/bin/mongod(_ZN5mongo12QueryPlanner4planERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsEPSt6vectorIPNS_13QuerySolutionESaIS9_EE+0x257e) [0xdaf2fe] /usr/bin/mongod(_ZN5mongo21SortStageKeyGenerator16getBoundsForSortERKNS_7BSONObjES3_+0x285) [0xade3b5] /usr/bin/mongod(_ZN5mongo21SortStageKeyGeneratorC1ERKNS_7BSONObjES3_+0xa64) [0xae08e4] /usr/bin/mongod(_ZN5mongo9SortStage4workEPm+0x38e) [0xae296e] /usr/bin/mongod(_ZN5mongo7OrStage4workEPm+0x12f) [0xabefef] /usr/bin/mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_7DiskLocE+0xef) [0xd902ef] /usr/bin/mongod(_ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x977) [0xd73b87] /usr/bin/mongod() [0xbb4562] /usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x500) [0xbb5ae0] /usr/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x98) [0x774658] /usr/bin/mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x50b) [0x11d18db] 2017-09-15T09:21:56.265+0000 [conn13] assertion 0 assertion src/mongo/db/query/index_bounds_builder.cpp:862 ns:bws.txs query:{ orderby: { createdOn: -1 }, $query: { walletId: "9c2bda88-23b6-487e-b395-93ac1310fa90", createdOn: { $gte: nan.0, $lte: nan.0 } } } 2017-09-15T09:21:56.265+0000 [conn13] ntoskip:0 ntoreturn:1000
I think I finally got to the bottom of the issue, it was due to paginating through transaction history at the end of it. I observed this issue on mongo 2.6.12 but not on 3.4.6 (note that 2.6.x is supported in bws as per documentation): @jadhavajay by any chance were you using mongo 3.x ?
I had this code to loop through the list:
let allTransactions = [];
let skip = 0;
while (true) {
let transactions = await this.client.getTxHistoryAsync({skip});
if (!transactions.length) {
break;
}
skip += transactions.length;
allTransactions = allTransactions.concat(transactions);
}
I had to change it to the following:
let allTransactions = [];
let skip = 0;
while (true) {
let transactions = [];
try {
transactions = await this.client.getTxHistoryAsync({skip});
} catch (e) {
log.error('error looping through transaction history', e);
}
if (!transactions.length) {
break;
}
skip += transactions.length;
allTransactions = allTransactions.concat(transactions);
}
(btw, the async functions are possible due to bluebird's promisify feature)
(Posted on Bitcore Forum as well for help).
We just upgraded our app code to Copay 3.1.3 with our own BWS v1.15 instance on the back-end. The wallet gets created successfully, however we are getting following error when the app queries BWS for the transaction history of newly created wallet.
106.210.143.106 2017-04-26T09:35:03.017Z "GET /bws/api/v2/wallets/?includeExtendedInfo=0&twoStep=1&r=27993" 200 - 1472.582 "Mozilla/5.0 (Linux; Android 6.0; Lenovo K50a40 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 Mobile Safari/537.36" 178c24ab-8819-4970-8324-ae0cd85dd2a6 cac5bfb65a67cb0d605bcc63fcf49c2b614be280e277c0e767a7af097212385a ERR! /v1/txhistory/?limit=5&r=98025 :undefined:assertion src/mongo/db/query/index_bounds_builder.cpp:862
106.210.143.106 2017-04-26T09:35:03.049Z "GET /bws/api/v1/txhistory/?limit=5&r=98025" 500 69 1422.901 "Mozilla/5.0 (Linux; Android 6.0; Lenovo K50a40 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 Mobile Safari/537.36" 178c24db-8819-4970-8324-ae9bf85dd2a6 cac5bab65a94cb0d605baa63fccd9c2b614be280e277cef747a7af847212385a ERR! /v1/txhistory/?limit=5&r=31647 :undefined:assertion src/mongo/db/query/index_bounds_builder.cpp:862
Is it something to do with the MongoDb version?