question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POST returns sometimes HTTP code 500

See original GitHub issue

I have a nodered flow which fetches screenshots from security cameras and POSTing them to this docker image running in docker under windows. most of the time, it just works as expected and other times it returns an error 500.

I cannot even tell whether I am doing it somehow wrong or if there is a bug in this docker container. Can you guys help me somehow? Where should I go from here?

The docker log shows this:

172.17.0.1 - - [14/Oct/2020 11:23:32] "POST /model/predict HTTP/1.1" 200 -
172.17.0.1 - - [14/Oct/2020 11:27:35] "POST /model/predict HTTP/1.1" 200 -
172.17.0.1 - - [14/Oct/2020 11:27:38] "POST /model/predict HTTP/1.1" 200 -
172.17.0.1 - - [14/Oct/2020 11:28:28] "POST /model/predict HTTP/1.1" 200 -
[2020-10-14 11:30:53,323] ERROR in app: Exception on /model/predict [POST]
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/conda/lib/python3.7/site-packages/flask_restplus/api.py", line 319, in wrapper
resp = resource(*args, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
resp = meth(*args, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/flask_restplus/marshalling.py", line 136, in wrapper
resp = f(*args, **kwargs)
File "/workspace/api/predict.py", line 89, in post
image = model_wrapper._read_image(image_data)
File "/workspace/core/model.py", line 62, in _read_image
image = Image.open(io.BytesIO(image_data)).convert("RGB")
File "/opt/conda/lib/python3.7/site-packages/PIL/Image.py", line 2818, in open
raise IOError("cannot identify image file %r" % (filename if filename else fp))
OSError: cannot identify image file <_io.BytesIO object at 0x7f8394db9d70>
172.17.0.1 - - [14/Oct/2020 11:30:53] "POST /model/predict HTTP/1.1" 500 -

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MLnickcommented, Oct 16, 2020

@fabsenet thank you for opening the issue. It did highlight that we need to harden the error handling and should return a 400 rather - this would have told you that the issue was with your input. So thanks again, it is helpful for us!

0reactions
fabsenetcommented, Oct 16, 2020

I investigated further and the source for the image (blueiris) is itself sometimes returning http status 503. My flow does not check this code but it used the payload, which is an empty array then. so I understand this now better. The object detection is not the problem.

Sorry to take your time 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

500 Internal Server Error - HTTP - MDN Web Docs - Mozilla
This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response.
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
An HTTP 500 internal server error is a general error message. It covers unexpected issues that don't fit into existing error codes. HTTP...
Read more >
HTTP Error 500 – Internal Server Error Explained in Plain ...
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the ...
Read more >
How to Fix a 500 Internal Server Error - Lifewire
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the website's server, but...
Read more >
How to fix HTTP 500 internal server error? - IONOS
This is especially the case for the “500 Internal Server Error.” This message indicates that an error has occurred during connection to the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found