why does pymongo's find_one fail silently? (nginx/uwsgi/flask/gevent/pymongo) -
Summary: In my flask + javant + uwsgi + nginx, Pampo silently for no reason Have to feel the app I'll get some hints, where should I look
I'm a newcomer to web application programming (and python), please stand by me, I'm porting an app to the OpenStock provider for everyone , And I think that the code that works well at first fails later and silently later. I wonder if someone can put some light on it.
This is the question in question:
Emergency
is a Pimpo collection. This is correct immediately.
user_id
is the user ID I'm looking for. this is right.
22 def get_emergency_by_user (user_id): 23 print "The user is going to find an emergency:" + user_id 24 print emergency 25 print emergency drawer.user_id 26 try: 27 emergency = emergency ('EmergencyDict.user_id: user_id}) except 28: 29 Print' Mongo Fail '30 Print' This Must Appear '31 Print' Emergency -% s'% Emergency 32 Return Emergency
Here is the output from the function (line number to be added for easy reference):
failure case
23 user is going to find emergency The unitTestScript 24 collection ('connection (' [redacted] ', [redacted]), u' [redacted] ', u'emergencies' 25 userid
Can see 23 to 25 work fine , And I think that is called the 27 line. But I get nothing below, neither line 29 (except :
case) nor line 30 runs anytime.
The most strange thing is that there are times when during the day it is not a problem, and it works perfectly in these cases, it looks like this (pairs for easy reference Going to the Emergency from Users: UnitTestScript 24 Archive (Database ('[' 'Readded]', [Readed]), You '[Readed]', U'Margency ') 25 User ID 30 This 31 {' _obj '... yes Should. Jason's bunch representing the right document ... '}
I have not been able to separate anything, though it works. It's painful, and I do not know where to look forward to.
I have tried
I have read some articles that suggest that I need to get the from the monkey import monkey; Monkey patch_all () line in my import; I did it.
I have also read that you can not use uVszy + Gagweet with many threads, so my uvesby is configured with 1 thread.
tl; Dr my flask + javent + uwsgi + nginx seems to silently disappear in the app for no reason, I will get some signal where I should see
I just remembered how we solved it. The version of pymongo in Requirements.txt was old. I updated it to the latest version, and then it was OK
Comments
Post a Comment