Skip to content

Error when creating milestones in parallel #118

Closed
@maxceem

Description

@maxceem

During project creation in connect-app we create a timeline, and after, create several milestones for the timeline. To make it work faster, milestones for the timeline are created in parallel.

When there are 5 milestones for one timeline are being created in parallel, 4 of them are created successfully, while during creation of the 5th one server respsond with the next error

{
  "id": "3a71a86a-441e-45df-beb1-c623279b448e",
  "result": {
    "success": false,
    "status": 500,
    "content": {
      "message": "could not serialize access due to concurrent update"
    },
    "debug": "SequelizeDatabaseError: could not serialize access due to concurrent update\n
        at Query.formatError (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/query.js:357:14)\n
        at Query.<anonymous> (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/query.js:88:19)\n
        at emitOne (events.js:115:13)\n
        at Query.emit (events.js:210:7)\n
        at Query.handleError (/usr/src/app/node_modules/pg/lib/query.js:108:8)\n
        at Connection.<anonymous> (/usr/src/app/node_modules/pg/lib/client.js:171:26)\n
        at emitOne (events.js:115:13)\n
        at Connection.emit (events.js:210:7)\n
        at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:109:12)\n
        at emitOne (events.js:115:13)\n
        at Socket.emit (events.js:210:7)\n
        at addChunk (_stream_readable.js:252:12)\n
        at readableAddChunk (_stream_readable.js:239:11)\n
        at Socket.Readable.push (_stream_readable.js:197:10)\n
        at TCP.onread [as _originalOnread] (net.js:589:20)\n
        at TCP.onread (/usr/src/app/node_modules/async-listener/glue.js:188:31)\n
    From previous event:\n
        at Query.run (/usr/src/app/node_modules/sequelize/lib/dialects/postgres/query.js:74:17)\n
        at /usr/src/app/node_modules/sequelize/lib/sequelize.js:849:20\n
        at /usr/src/app/node_modules/retry-as-promised/index.js:39:21\n
    From previous event:\n
        at retryAsPromised (/usr/src/app/node_modules/retry-as-promised/index.js:29:10)\n
        at /usr/src/app/node_modules/sequelize/lib/sequelize.js:848:12\n
    From previous event:\n
        at Promise.then (/usr/src/app/node_modules/sequelize/lib/promise.js:21:17)\n
        at transactionResolver (/usr/src/app/node_modules/sequelize/lib/sequelize.js:1284:40)\n
        at /usr/src/app/node_modules/continuation-local-storage/context.js:84:17\n
    From previous event:\n
        at Sequelize.transaction (/usr/src/app/node_modules/sequelize/lib/sequelize.js:1313:12)\n
        at module.exports (/usr/src/app/dist/routes/milestones/create.js:94:37)\n
        at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)\n
        at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)\n
        at authorizer.can.then (/usr/src/app/node_modules/tc-core-library-js/lib/middleware/permissions.js:10:9)\n
        at propagateAslWrapper (/usr/src/app/node_modules/async-listener/index.js:478:23)\n
        at /usr/src/app/node_modules/async-listener/glue.js:188:31\n
        at /usr/src/app/node_modules/async-listener/index.js:515:70\n
        at /usr/src/app/node_modules/async-listener/glue.js:188:31\n
        at <anonymous>\n
        at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:228:7)"
  }
}

This issue may be ignored if the bulk milestone creation is implemented regarding #108

Thouhg it could make sense taking a look anyway, to check if this issue may occur in other situations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions