apache / couchdb-nano

Nano: The official Apache CouchDB library for Node.js
https://www.npmjs.com/package/nano
Apache License 2.0
651 stars 165 forks source link

Deleting records frequently hangs for one minute or crashes #329

Open crystalfp opened 1 year ago

crystalfp commented 1 year ago

Expected Behavior

In my server I delete a single record from the db taking around 100 milliseconds. The deletion is done this way:

const sts = await databaseHandler.bulk({docs: [
  {
    _id: 'CRgLVMx5ELyYa8bl9sDad+++',
    _rev: '73-12c2ea0e5981bf59e84db86ab9660265',
    _deleted: true
  }
]});

This works and takes 90-250 milliseconds, sometimes 2 seconds. The returning status is:

[
  {
    ok: true,
    id: 'CRgLVMx5ELyYa8bl9sDad+++',
    rev: '74-50b80ed261f55ea4f08999ec94c2ec3b'
  }
]

Current Behavior

Frequently the bulk call will take around 60 seconds and returns:

[
  {
    id: 'CRgLVMx5ELyYa8bl9sDad+++',
    error: 'unknown_error',
    reason: 'undefined'
  }
]

or sometimes CouchDB returns status 500

Error: couch returned 500
    at responseHandler (D:\Projects\VUEIdeaIgniterEnvironment\server\node_modules\nano\lib\nano.js:206:20)
    at D:\Projects\VUEIdeaIgniterEnvironment\server\node_modules\nano\lib\nano.js:456:13
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Really I don't know where to look to understand what happens

Possible Solution

Well, for my side I could not wait for the deletion and returning immediately, but seems a dirty workaround. At least having a way for understanding what happens.

Steps to Reproduce (for bugs)

  1. See above

Context

Your Environment

glynnbird commented 1 year ago

I suggest debugging your CouchDB setup with curl or using the dashboard. I very much doubt that Nano is at fault here, just that CouchDB is not replying within 60s and it would be helpful to get to the bottom of why that is the case.