eiri commented on issue #1184: _bulk_docs POST returns "unknown error" "badarg"
URL: https://github.com/apache/couchdb/issues/1184#issuecomment-380493233
 
 
   @jareware Thank you for the logs snippet, that really helped to reproduce 
this.
   
   So what's happening is that when the bulk size exceeds 100 docs we are 
switching to a different data structure when reordering the results, to speed 
things up. If an update validator function takes too long, os process will 
throw timeout, but the whole batch will be processed nevertheless. It seems 
that in 2.1.1 that timeout from the update validator was swallowed up the pipe 
and an attempt to fetch the missing key on reorder was throwing an exception.
   
   Evidently it was fixed since then. I can't pinpoint where that happened, but 
when I run the same case on current master it handles the error fine:
   ```json
   ...
      {
           "id": "1719307e8c6a14bc1f89f6e9570612bd", 
           "ok": true, 
           "rev": "1-1aefbf37f7524ef1d7708843e035d128"
       }, 
       {
           "error": "os_process_error", 
           "id": "1719307e8c6a14bc1f89f6e957061b2d", 
           "reason": "OS process timed out."
       }, 
       {
           "id": "1719307e8c6a14bc1f89f6e957062769", 
           "ok": true, 
           "rev": "1-ca8a74b9258d00dc126bbae88ab1844f"
       }, 
   ...
   ```
   
   This can be reproduces with validation fun looking something like this.
   ```javascript
   function(newDoc, oldDoc, userCtx) {
     if (newDoc.timeout) {
       var now = new Date().getTime();
       while(new Date().getTime() < now + 60000) { }
     }
   }
   ```
   The bulk's payload needs to be larger than 100 docs and have at least one 
doc with field `"timeout": true`.
   
   Note, that the config parameter `[couch_httpd_auth]` `timeout` not really 
related to this, os process timeout configured by `[couchdb]` 
`os_process_timeout` and is 5 seconds by default.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to