payload icon indicating copy to clipboard operation
payload copied to clipboard

Local API `create` with `filePath` not properly awaited, leads to mongo lock failure

Open ssyberg opened this issue 2 years ago • 0 comments

Link to reproduction

No response

Describe the Bug

Related discord discussion: https://discord.com/channels/967097582721572934/1174039383574331562/1174039383574331562

Receiving this error on API creates, adding a sleep on creates with a filePath solves it.

[
    17: 15: 55
] ERROR (payload): There was an error while saving a version for the Image with ID 65282888aebd24030d4f8e0a.
[
    17: 15: 55
] ERROR (payload): Unable to acquire IX lock on '{
    7925038056408952763: Collection,
    1007509028767870907, projectname._images_versions
}' within 5ms. opId: 8048590, op: conn16163, connId: 16163.
    err: {
    "type": "MongoServerError",
    "message": "Unable to acquire IX lock on '{7925038056408952763: Collection, 1007509028767870907, projectname._images_versions}' within 5ms. opId: 8048590, op: conn16163, connId: 16163.",
    "stack":
          MongoServerError: Unable to acquire IX lock on '{
        7925038056408952763: Collection,
        1007509028767870907, projectname._images_versions
    }' within 5ms. opId: 8048590, op: conn16163, connId: 16163.

To Reproduce

Run a local api create with a filePath (perhaps in a loop with many updates of the same record?)

Payload Version

2.1.1

Adapters and Plugins

db-mongodb

ssyberg avatar Nov 15 '23 15:11 ssyberg