Having an issue going from my local environment to my production one. It works fine locally but when I upload my flask app to my server and connect it to my MySql instance I’m getting the following error:
RuntimeError: Second simultaneous read on fileno 27 detected. Unless you really know what you're doing, make sure that only one greenthread can read any particular socket. Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<function select.<locals>.on_read at 0x7f7b4a222a20>; THAT THREAD=FdListener('read', 27, <function select.<locals>.on_read at 0x7f7b4a221a80>, <built-in method throw of GreenThread object at 0x7f7b4a1994c0>)
I am making several API calls simultaneously which is causing this error. if I test the api calls individually in postman, they work just fine, but when I try to load it from my web app, I get the simultaneous connection error.
I have pools enabled
SQLALCHEMY_ENGINE_OPTIONS = {
'pool_size': 10,
'pool_recycle': 120,
'pool_pre_ping': True
}
and I have verified that they are active (db.engine.pool.status() gives me 10 pools)
I’m making the db calls as follows simultaneously from two inbound api endpoints:
class UsersApi(Resource):
def get(self):
users = db.session.query(Users).all()
return users_schema.dump(users)
and
class LocationsApi(Resource):
def get(self):
locations = db.session.get(Locations).all()
return locations_schema.dump(locations)
do I need to change how I call for the data? Does it not automatically use the pool connections?