codechain-indexer icon indicating copy to clipboard operation
codechain-indexer copied to clipboard

SequelizeForeignKeyConstraintError when requesting transaction quickly serveral times.

Open cubistplay opened this issue 6 years ago • 0 comments

The error message following occurs when I request transaction ("/tx") quickly several times.

{ SequelizeForeignKeyConstraintError: update or delete on table "AssetSchemes" violates foreign key constraint "AssetTransferInputs_assetType_fkey" on table "AssetTransferInputs" at Query.formatError (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/lib/dialects/postgres/query.js:296:16) at query.catch.err (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/lib/dialects/postgres/query.js:86:18) at tryCatcher (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/promise.js:690:18) at _drainQueueStep (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/async.js:138:12) at _drainQueue (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/async.js:131:9) at Async._drainQueues (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/async.js:147:5) at Immediate.Async.drainQueues [as _onImmediate] (/home/kodebox/codechain/codechain-indexer/node_modules/sequelize/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) at process.topLevelDomainCallback (domain.js:120:23) name: 'SequelizeForeignKeyConstraintError', parent: { error: update or delete on table "AssetSchemes" violates foreign key constraint "AssetTransferInputs_assetType_fkey" on table "AssetTransferInputs" at Connection.parseE (/home/kodebox/codechain/codechain-indexer/node_modules/pg/lib/connection.js:554:11) at Connection.parseMessage (/home/kodebox/codechain/codechain-indexer/node_modules/pg/lib/connection.js:379:19) at Socket. (/home/kodebox/codechain/codechain-indexer/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: 388, severity: 'ERROR', code: '23503', detail: 'Key (assetType)=(6ed1f013b0bad558266590f9f6a917058ffb4063) is still referenced from table "AssetTransferInputs".', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'AssetTransferInputs', column: undefined, dataType: undefined, constraint: 'AssetTransferInputs_assetType_fkey', file: 'ri_triggers.c', line: '3280', routine: 'ri_ReportViolation', sql: 'DELETE FROM "Blocks" WHERE "number" = 81' }, original: { error: update or delete on table "AssetSchemes" violates foreign key constraint "AssetTransferInputs_assetType_fkey" on table "AssetTransferInputs" at Connection.parseE (/home/kodebox/codechain/codechain-indexer/node_modules/pg/lib/connection.js:554:11) at Connection.parseMessage (/home/kodebox/codechain/codechain-indexer/node_modules/pg/lib/connection.js:379:19) at Socket. (/home/kodebox/codechain/codechain-indexer/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: 388, severity: 'ERROR', code: '23503', detail: 'Key (assetType)=(6ed1f013b0bad558266590f9f6a917058ffb4063) is still referenced from table "AssetTransferInputs".', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'AssetTransferInputs', column: undefined, dataType: undefined, constraint: 'AssetTransferInputs_assetType_fkey', file: 'ri_triggers.c', line: '3280', routine: 'ri_ReportViolation', sql: 'DELETE FROM "Blocks" WHERE "number" = 81' }, sql: 'DELETE FROM "Blocks" WHERE "number" = 81', fields: null, table: 'AssetSchemes', value: undefined, index: 'AssetTransferInputs_assetType_fkey', reltype: undefined } (node:19211) UnhandledPromiseRejectionWarning: Error: DBError at Object.exports.DBError (/home/kodebox/codechain/codechain-indexer/src/exception.ts:2:30) at Object.deleteBlockByNumber (/home/kodebox/codechain/codechain-indexer/src/models/logic/block.ts:188:25) (node:19211) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:19211) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

cubistplay avatar Feb 27 '19 03:02 cubistplay