-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Task stays in queue when executing a requests.post #97
Comments
If it works in sync but not async, it usually means there is a context problem. Since workers run in a separate Django environment, The worker must be encountering a pretty bad error cause it executes within a Have you tried calling |
I tried the fully dotted path and it still fails at the same requests.post line. Is there a way to capture this "error"? |
It's almost impossible to attach a debugger to a forked process, but I've been using an exception wrapper for things like this: import traceback, functools
def trace_unhandled_exceptions(func):
@functools.wraps(func)
def wrapped_func(*args, **kwargs):
try:
func(*args, **kwargs)
except:
print 'Exception in '+func.__name__
traceback.print_exc()
return wrapped_func and then decorate the function @trace_unhandled_exceptions
def queue_get_auth(username, password):
a = Auth('https://auth', 'username', 'password') That will print any errors straight to the console. |
Still a no go. The crazy thing is if I remove the requests.post it works okay as well and continues on with the rest of the code. I will keep trying to dig into this. I am switching over from Django-RQ and it worked fine. |
The big culprit here is probably the multiprocessing module. That's the main difference with django-rq. This actually started out as a gist for a multiprocessing rq worker I was proposing a few months back. Some kind of error message would help. I'll see if I can somehow replicate it, although I am on the road the next couple of days. |
I switched to the redis broker instead of ORM and it seems to be working out okay. |
I ran a few test with simple asynced I'll rerun them with the ORM broker ;) |
Postgres worked ok. Even sqllite. I can't seem to reproduce it with just |
Could there be some kind of file locking happening with sqllite being the broker and the result backend? |
Yeah I switched to FileCache and it worked. I will see if I can get a second sqlite database. |
I figured it had to be something like this. Having the broker, results, monitoring and your queries running on a singe sqllite file might be a bit much. It also explains why we're not seeing any real error messages. |
As an FYI I did try it against my production Oracle database and had the same problem. |
In that case I'll have to come up with a test for when the broker, cache and Django are all on the same database and see if I can reproduce this. I'm not at all surprised that this would lead to locking. It's just something I've never tested for. I'll pick it up when I'm back next week. |
Thank you for you help and the nice library. I read about it on reddit and wanted to get it implemented. |
You're welcome. Feedback like this is very appreciated. I just can't test all this stuff on my own. |
In case someone, like me, comes to this issue, using ORM with sqlite, and requests.post() is "not working", this is still a problem in Sep of 2020. Just making a note here. |
When I try and execute a requests.post the task stays on the queue and never completes the requests.post request.
Pseudo code:
Error I am seeing and repeats until I delete it from the database queued tasks:
Is there a reason why the requests.post would be causing it to fail? How would I debug this? If I run it in sync: True it works fine. This is running on a Mac OS X 10.11, database sqlite.
The text was updated successfully, but these errors were encountered: