BrainPad / FindYourCandy

Apache License 2.0
77 stars 18 forks source link

502 bad gateway on accessing /predict #34

Closed kazunori279 closed 7 years ago

kazunori279 commented 7 years ago

After go through the webapp README, I got 502 bad gateway with my browser when I tried to access the page /predict.

Please find attached log files. Let me know if I should check other points.

logs.zip

kazunori279 commented 7 years ago

Please also add troubleshooting tips when you get this error. Such as the locations of the log files you have to check.

max-hana commented 7 years ago

What is the permission of /var/run/uwsgi directory?

kazunori279 commented 7 years ago

$ sudo ls -al /var/run/uwsgi/ total 8 drwxrwxr-x 2 root root 80 Mar 5 05:30 .

max-hana commented 7 years ago

Have you done these ? (it's in setup/linux_box.md )

$ sudo mkdir -m 775 /var/run/uwsgi
$ sudo chown brainpad:brainpad /var/run/uwsgi
$ sudo mkdir -m 775 /var/log/uwsgi
$ sudo chown brainpad:brainpad /var/log/uwsgi
kazunori279 commented 7 years ago

Thanks, the commands removed the 502 error! (the shell history says I've done those, but apparently it wasn't in effective)

Now I've restarted the services, but sudo systemctl restart uwsgi-webapp.service doesn't come back to shell... is this expected? Also, I'm accessing /predict from browser, but it doesn't respond.

max-hana commented 7 years ago

I could not imagine how you encountered that, but let'me get you out of there.

Please do the following thing

chmod 777 /var/log/uwsgi   # just make sure
sudo systemctl stop nginx.service
sudo systemctl stop uwsgi-webapp.service
sudo kill -9 <the process # of `/usr/local/bin/uwsgi --ini /etc uwsgi/webapp.ini`>
sudo rm /var/run/uwsgi/webapp.*

wait a while, and then start uwsgi.

I'm not sure but may be it's safer to stop nginx before rebooting any uWSGI service.

kazunori279 commented 7 years ago

I was able to access the "Find You Candy" UI!

But when I made a voice request, it says "something went wrong". I found the following error on webapp.log. FYI, I tried camera_tune.py again and it worked well.

2017-03-05 15:15:59,477 - candysorter.views.api - WARNING - Retrying: 5 times. 2017-03-05 15:15:59,579 - candysorter.views.api - ERROR - Unexpected error. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full _dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "./candysorter/views/api.py", line 102, in wrapper return f(*args, **kwargs) File "./candysorter/views/api.py", line 152, in similarities img = _capture_image() File "./candysorter/views/api.py", line 432, in _capture_image raise Exception('Failed to capture image.') Exception: Failed to capture image.

rindai87 commented 7 years ago

Are you actually putting candies on marker paper?

kazunori279 commented 7 years ago

yes, and confirmed that camera_tune.py detected the candies.

I was able to get the detailed Exception:

OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/brainpad/opencv_from_git/opencv/modules/imgproc/src/color.cpp, line 9748

rindai87 commented 7 years ago

OK, this issue looks the same as #10. We instructed some troubleshoot. Can you check the issue, especially this comment might help you?