Skip to content

Cannot update two milestones in parallel #162

Open
@maxceem

Description

@maxceem

When sending two requests for updating milestones in parallel, one of them fails with error

{
  "id": "b7e49a46-a4cb-4de6-a1a1-fa5e45e2862d",
  "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)\nFrom 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\nFrom 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    at /usr/src/app/node_modules/continuation-local-storage/context.js:84:17\nFrom 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\nFrom 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/update.js:158: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)"
  }
}

Example of two requests:

  • PATCH https://api.topcoder-dev.com/v4/timelines/412/milestones/1562 with payload
    {
      "param": {
        "details": {
          "content": {
            "links": [{
              "title": "Design 1",
              "url": "http://test.com",
              "type": "marvelapp"
            }, {
              "title": "Design 2",
              "url": "http://test.com",
              "type": "marvelapp"
            }]
          }
        },
        "status": "completed"
      }
    }
    
  • PATCH https://api.topcoder-dev.com/v4/timelines/412/milestones/1561 with payload
     {
       "param": {
         "details": {
           "prevMilestoneContent": {
             "links": [{
               "title": "Design 1",
               "url": "http://test.com",
               "type": "marvelapp"
             }, {
               "title": "Design 2",
               "url": "http://test.com",
               "type": "marvelapp"
             }]
           }
         }
       }
     }
    

User pat_monahan.
Both two milestones from one timeline.

Probably this issue is related to #118

Update this issue doesn't happen every time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions