cobrateam / flask-mongoalchemy

Flask support for MongoDB using MongoAlchemy.
https://pythonhosted.org/Flask-MongoAlchemy/
BSD 2-Clause "Simplified" License
217 stars 45 forks source link

Multiple wsgi apps cause BadValue / ObjectID exception #31

Closed csik closed 12 years ago

csik commented 12 years ago

This may be a mongoalchemy list question, but I thought I'd work my way up from here.

I am running flask-mongoalchemy on an Ubuntu server with several different wsgi applications. Each has a different MongoAlchemy(app) instance, and each runs perfectly... Until one of the others runs. At that point, one or both generates an error (in the apache log):

[error] class 'mongoalchemy.exceptions.BadValueException' [error] Bad value for field of type "mongo_id". Reason: "Value is not an instance of <class 'bson.objectid.ObjectId'> (got: ObjectId)".

The only option is to touch the broken app's .wsgi file, at which point the broken app works, but the other one breaks. I have been able to find very little online about this error.

Suspecting it might be a question of wsgi processes, I've restricted my wsgi daemon processes to 1 process per app, with 25 threads, also tried 2 processes, but the error is so terse I'm having trouble even figuring out what to do next. Thoughts? Thanks,

Chris.

csik commented 12 years ago

Solved! After a week of searching I found this: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/bwjBHs94mDc%5B1-25%5D