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 2020/08/18 22:12:36 UTC

[GitHub] [couchdb] stheobald opened a new issue #3087: POST to _changes timeout when request.body is included

stheobald opened a new issue #3087:
URL: https://github.com/apache/couchdb/issues/3087


   ## Description
   
   When POSTing to the _changes endpoint with a request.body, and not using one of the builtin filters (doc_ids for example) the connection always times out.
   @rnewson has looked into this, and says "the code starts the response, and may even send it, but the web server itself (mochiweb) won't proceed because it still needs to read the request body first. we should send a 400 Bad Request if you send a body when it's unexpected"
   
   ## Steps to Reproduce
    curl 'foo:bar@localhost:15984/db1/_design/foo'
   {"_id":"_design/foo","_rev":"1-1cfd4ef84175f09eb3d41bda94062244","filters":{"bar":"function() { return true; }"}}
   ​
   curl 'foo:bar@localhost:15984/db1/_changes?style=all_docs&since=0&limit=100&filter=foo/bar' -XPOST -Hcontent-type:application/json --data-raw '{"doc_ids": ["foobar"]}'
   
   ## Expected Behaviour
   Return a 400 Bad Request error in preference to waiting for a timeout if a req.body is provided but unexpected (see enhancement request https://github.com/apache/couchdb/issues/3086 which may solve this bug as a side-effect)
   
   ## Your Environment
   Couchdb 3.1


----------------------------------------------------------------
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.

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



[GitHub] [couchdb] eiri commented on issue #3087: POST to _changes timeout when request.body is included

Posted by GitBox <gi...@apache.org>.
eiri commented on issue #3087:
URL: https://github.com/apache/couchdb/issues/3087#issuecomment-747606145


   Just want to drop a note here that I've found the root case for this bug and going to open PR with the fix after Holidays.


----------------------------------------------------------------
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.

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



[GitHub] [couchdb] stheobald commented on issue #3087: POST to _changes timeout when request.body is included

Posted by GitBox <gi...@apache.org>.
stheobald commented on issue #3087:
URL: https://github.com/apache/couchdb/issues/3087#issuecomment-731880109


   @ricellis after discussing this with some of the maintainers, it has become apparent neither this, or the related enhancement is considered a high priority item, and is accordingly unlikely to be fixed by the volunteer maintainers in their free time. They did suggest that they'd consider fixing it as a paid gig.
   
   In the meantime, I have found a workaround by having an API endpoint maintain a design document filter for each user. This mechanism allows me to pass what I would have hoped to pass in a req.body as a doc instead. Then I restart the replication with a reference to that updated filter. Replicating that design document to the client allows me to keep all clients associated with that user in sync.


----------------------------------------------------------------
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.

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



[GitHub] [couchdb] eiri closed issue #3087: POST to _changes timeout when request.body is included

Posted by GitBox <gi...@apache.org>.
eiri closed issue #3087:
URL: https://github.com/apache/couchdb/issues/3087


   


----------------------------------------------------------------
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.

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



[GitHub] [couchdb] eiri commented on issue #3087: POST to _changes timeout when request.body is included

Posted by GitBox <gi...@apache.org>.
eiri commented on issue #3087:
URL: https://github.com/apache/couchdb/issues/3087#issuecomment-780923877


   Fixed in https://github.com/apache/couchdb/pull/3373


----------------------------------------------------------------
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.

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



[GitHub] [couchdb] ricellis commented on issue #3087: POST to _changes timeout when request.body is included

Posted by GitBox <gi...@apache.org>.
ricellis commented on issue #3087:
URL: https://github.com/apache/couchdb/issues/3087#issuecomment-731461849


   I think it is preferable to solve this by always reading the body rather than changing the existing behaviour to a `400 Bad Request`. The existing `POST /{db}/_changes` endpoint that has been released in the wild for a long time permits other requests (i.e. not just those not using a filter) and any change to that behaviour would break existing code/users.
   
   For example, whilst it is perhaps unusual to POST a `{}` body it's not completely unexpected given the way the API is described in the [docs](https://docs.couchdb.org/en/stable/api/database/changes.html#post--db-_changes):
   >Requests the database changes feed in the same way as GET /{db}/_changes does, but is widely used with ?filter=_doc_ids
   
   Nothing stated about it being valid _only_ for filters.


----------------------------------------------------------------
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.

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