Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CouchDB 2.3.0 has reduced the allowed length of GET requests #5083

Closed
garethbowen opened this issue Dec 9, 2018 · 6 comments
Closed

CouchDB 2.3.0 has reduced the allowed length of GET requests #5083

garethbowen opened this issue Dec 9, 2018 · 6 comments
Assignees
Labels
Priority: 1 - High Blocks the next release. Type: Bug Fix something that isn't working as intended

Comments

@garethbowen
Copy link
Contributor

When making a view request PouchDB switches to use a POST if the URL with parameters exceeds 2000 characters. Against CouchDB 2.2.0 GET requests this long work as expected, but in CouchDB 2.3.0 they fail at around 1370 characters.

  1. Raise an issue with CouchDB to change the limit back or at least document the change.
  2. Raise an issue with PouchDB to change their limit - ideally submit a PR.
  3. Patch our PouchDB in webapp, api, and sentinel to have a lower limit to be removed once it's fixed properly either by Couch or Pouch.

Thanks @dianabarsan for finding this!

@garethbowen garethbowen added Type: Bug Fix something that isn't working as intended Priority: 1 - High Blocks the next release. labels Dec 9, 2018
@garethbowen
Copy link
Contributor Author

This is important because CouchDB 2.3.0 has performance improvements we would benefit from so I'm scheduling it for 3.2.0.

@dianabarsan dianabarsan self-assigned this Dec 11, 2018
@dianabarsan
Copy link
Member

dianabarsan commented Dec 14, 2018

The issue has been marked as a bug by CouchDB folk and resolving it requires updating a CouchDB dependency (mochiweb).

We can work around it by changing CouchDB configuration, specifically:

[chttpd]
server_options = [{recbuf, undefined}]    
		|
		V
server_options = [{recbuf, some_positive_integer}]

The value we should choose is up for debate, more details about what recbuf is can be found here.
This is the original issue that caused this change. I'm unaware if we've had problems of the sort.
Pre CouchDB 2.3.0, this value was defaulted to 262144 and it was part of chttpd.socket_options:

[chttpd]
socket_options = [{recbuf, 262144}, {sndbuf, 262144}, {nodelay, true}]

I've created a PR #5105 to demo the fact that adding the config fixes the issue.

@dianabarsan
Copy link
Member

As this bug can be avoided by changing CouchDB configuration, I've opened an issue in medic-infrastructure.

@SCdF
Copy link
Contributor

SCdF commented Dec 21, 2018

@dianabarsan this looks to also affect our Search service, and at least locally following the instructions in the infrastructure report hasn't fixed it:

image

@SCdF SCdF reopened this Dec 21, 2018
@dianabarsan
Copy link
Member

@SCdF have you updated your config?

@SCdF
Copy link
Contributor

SCdF commented Dec 21, 2018

Talked to @dianabarsan , I mis-read the infra ticket and changed the wrong value. After changing that value locally everything works.

I will raise a separate ticket to have this happen for devs in Grunt

@SCdF SCdF closed this as completed Dec 21, 2018
SCdF pushed a commit that referenced this issue Dec 21, 2018
This used to work in CouchDB < 2.3, but we now need to set this
manually, otherwise our app will error in endless weird ways.

262144 is picked because I think it was the default before that.

See:
 - https://github.com/medic/medic-infrastructure/issues/47
 - #5083
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 1 - High Blocks the next release. Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

3 participants