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

SLU ending up in a lock state #83

Open
nvinayvarma189 opened this issue Mar 9, 2022 · 1 comment
Open

SLU ending up in a lock state #83

nvinayvarma189 opened this issue Mar 9, 2022 · 1 comment

Comments

@nvinayvarma189
Copy link
Contributor

Issue:
I added uwsgi.lock() and uwsgi.unlock() in my endpoints.py file like this. When the first exception occurs in an SLU service, the SLU will be left in a locked state. The SLU will not be attending to any following requests. This behavior is bad because, if one error occurs, then everything will fail until we redeploy.

Steps to reproduce locally:

  1. If not already present, add uwsgi.lock() and uwsgi.unlock() in your local endpoints.py file like this.
  2. Run task serve to run your SLU service locally
  3. Intentionally, create a curl request such that it causes an exception in the PREDICT_API function of the endpoints.py file. Something like 1 divided by 0
  4. Send this curl request to your local SLU
  5. You should see the Exception showing up in the output of your terminal. Your SLU service should still be running though.
  6. Send the same curl request again
  7. You should see that you are getting an empty reply from the SLU service after 1 minute
@nvinayvarma189
Copy link
Contributor Author

from @ltbringer

try:
    uwsgi.lock()
    this_may_raise_err()
except SomeException as err:
     return hande(err)
finally:
     uwsgi.unlock()

or use a context manager

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

No branches or pull requests

1 participant