You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/07/12 08:50:19 UTC

[GitHub] [couchdb-nano] klues opened a new issue #269: Unhandled Promise Rejection on timeout of nano.db.compact()

klues opened a new issue #269:
URL: https://github.com/apache/couchdb-nano/issues/269


   <!--- Provide a general summary of the issue in the Title above -->
   
   I'm using a script that should compact all my databases, looks like this:
   ```
   const nano = require('nano')({
       "url": dbUrl.trim(),
       "requestDefaults": {"timeout": 250000}
   });
   
   const dblist = await nano.db.list().catch(err => console.log(err));
   for (const dbName of dblist) {
       try {
           await nano.db.compact(dbName).catch(err => {
               console.log(err);
           });
       } catch (e) {
           console.log(e);
       }
   }
   ```
   see full script at: https://github.com/asterics/AsTeRICS-Grid/blob/master/scripts/couchDBCompact.js
   
   ## Expected Behavior
   I expect the code above to:
   * use a connection timeout of 250 seconds
   * finish cleanly also in the case of an error since I'm catching all exceptions/rejections
   
   ## Current Behavior
   * the script works for most databases
   * for some databases it fails with the following error after 60 seconds (so my default timeout doesn't seem to work):
   ```
   (node:84469) UnhandledPromiseRejectionWarning: Error: {error,timeout}
       at responseHandler (/<path>/node_modules/nano/lib/nano.js:175:20)
       at /<path>/node_modules/nano/lib/nano.js:405:13
       at runMicrotasks (<anonymous>)
       at processTicksAndRejections (internal/process/task_queues.js:97:5)
   ```
   
   ## Steps to Reproduce (for bugs)
   1. Download the script from https://github.com/asterics/AsTeRICS-Grid/blob/master/scripts/couchDBCompact.js
   2. run `node couchDBCompact.js http://admin:password@localhost:5984 compact` with the correct credentials of a locally running CouchDB instance 
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced the bug in -->
   * Version used: nano 9.0.3
   * CouchDB Version: 2.2.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] glynnbird closed issue #269: Unhandled Promise Rejection on timeout of nano.db.compact()

Posted by GitBox <gi...@apache.org>.
glynnbird closed issue #269:
URL: https://github.com/apache/couchdb-nano/issues/269


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] glynnbird commented on issue #269: Unhandled Promise Rejection on timeout of nano.db.compact()

Posted by GitBox <gi...@apache.org>.
glynnbird commented on issue #269:
URL: https://github.com/apache/couchdb-nano/issues/269#issuecomment-918203316


   I could not reproduce this with Nano 9.0.4 and CouchDB 3.1.
   
   You could try the `curl` equivalent:
   
   ```sh
   curl -v -X POST -H 'Content-type: application/json'  'http://localhost:5984/db/_compact'
   ```
   
   For it always returns instantaneously. 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] klues commented on issue #269: Unhandled Promise Rejection on timeout of nano.db.compact()

Posted by GitBox <gi...@apache.org>.
klues commented on issue #269:
URL: https://github.com/apache/couchdb-nano/issues/269#issuecomment-918964161


   Thanks for testing!
   After some more testing I think my problem were limited ressources on my server. While compacting I sometimes got the error `no db shards could be opened` and then like described above the node timeout error. I've experimented with increasing CouchDB params like [max_dbs_open](https://docs.couchdb.org/en/3.1.1/config/couchdb.html#couchdb/max_dbs_open) which made things even worse. Finally my solution was to simply slow down the process with an additional timeout like this:
   
   ```
   await nano.db.compact(dbName).catch(err => {
       console.log(err);
   });
   await new Promise(resolve => setTimeout(() => resolve(), 5000));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org