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

POST requests broken on 2.5.0 #784

Closed
cbarraford opened this issue May 7, 2019 · 7 comments
Closed

POST requests broken on 2.5.0 #784

cbarraford opened this issue May 7, 2019 · 7 comments
Labels

Comments

@cbarraford
Copy link

cbarraford commented May 7, 2019

When making a post request to Hug (v2.5.0), i never get a response. If I Ctrl-C the hug process, i get the following trackback...

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python3.7/site-packages/falcon/api.py", line 269, in __call__
    responder(req, resp, **params)
  File "/usr/local/lib/python3.7/site-packages/hug/interface.py", line 762, in __call__
    input_parameters = self.gather_parameters(request, response, context, api_version, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/hug/interface.py", line 611, in gather_parameters
    body = body_formatter(body, content_length=request.content_length, **content_params)
  File "/usr/local/lib/python3.7/site-packages/hug/input_format.py", line 43, in json
    return json_converter.loads(text(body, charset=charset))
  File "/usr/local/lib/python3.7/site-packages/hug/input_format.py", line 37, in text
    return body.read().decode(charset)
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt

Version 2.4.8 seems to work just fine.

Reproduction steps

You'll need the code provided in this gist

  1. Build the docker image
docker build -t hug-bug --no-cache .
  1. Run hug
docker run --rm -it -v $(pwd):/app -p 5454:5454 hug-bug
  1. Curl our hug service
curl -H "Content-Type: application/json" -X POST -d '{"foo":"bar"}' "localhost:5454/test"
@voglster
Copy link

voglster commented May 8, 2019

Something is definitely broken 2.5... All of my Docker builds that use hug without a version in requirements.txt (shame on me) won't pass integration tests. Rolling back to 2.4.8 all good.

@GhostofGoes
Copy link
Contributor

The two breaking changes in 2.5 were moving to Falcon 2.0 and dropping support for Python 3.4. My guess is that it's something to do with Falcon.

@timothycrosley
Copy link
Collaborator

I'm going to focus on this tonight, and make sure a new test is written for every failure case I find that was able to slip through. I am very sorry I let this breakage slip through!

@voglster
Copy link

voglster commented May 9, 2019

Tim no problem man! Hug is still way worth it in time saved for me. In fact, if you are working on it and you would like another pair of eyes, feel free to email me and I'll pair with ya. Though you are probably a better coder than I, so I am not sure how much help I would be.

@cbarraford
Copy link
Author

@timothycrosley thanks for taking a look at this so quickly, and I appreciate the work you (and others) do on hug.

@cbarraford
Copy link
Author

@GhostofGoes if you've dropped support for python 3.4, does CONTRIBUTING.md need to be updated?

timothycrosley added a commit that referenced this issue May 9, 2019
@timothycrosley
Copy link
Collaborator

The error presented here should now be fixed in the 2.5.1 hotfix release,

@voglster so glad you find Hug useful! The incompatibility luckily ended up being fairly easy to spot, and I ended up spending most of the time just waiting for the automated systems to confirm I had fixed the issue :).

@cbarraford happy to help! I've updated CONTRIBUTING.md to reflect this change - a quick background is that support was dropped because 3.4 itself hit EOL.

Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants