Hello everyone! I am currently working with a webserver (Grok) that starts different threads (automatically) for the requests that arrive to it.
The information is serialized in a MySQL database (which is acceded through SqlAlchemy). The users' information is stored in that MySQL database. The plugin that said server uses to check if a user is logged in or not is called very often. The way it is programmed now (I'll improve that in the future) is: it goes to the database, tries to extract the user whose "username" matches with the logged (or the one trying to log) one and checks if the password stored in the database matches with the one provided by the user. For some reason, if a user cancels the login process (hits Esc in his browser) and tries to login again, something (I don't know what) crashes: 2010-12-23 13:45:50,841 WARNING [sqlalchemy.pool.QueuePool.0x...5450] Error closing cursor: (2014, "Commands out of sync; you can't run this command now") I'm not sure if is is because the cancelling/reloading starts a new thread (and messes up the transactions that were pending) or because when the user cancels the loading, the username provided gets "corrupted" (empty or something) or what. This is what I do (as I said, very often) to load the user: @staticmethod def getByName(userName): retval = None try: retval = Database.session.query(User.User).filter(User.User.userName == userName).scalar() finally: Database.session.commit() return retval The session is a "global" object created in the Database.py file this way: Session = scoped_session(sessionmaker(bind="...")) session = Session() I've tried restarting the server (to get a new session) flushing, expunging, commiting... Even dropping and re-creating the schema. Nothing seems to work. I don't know if it's because I'm trying to access the database too often, or because if userName is None, it leaves the session in a "weird" state... (as you can see, I don't catch any exceptions... yet) Does anyone have any idea of what can be going wrong? I know it's a long shot, and that I'm not providing much information, but who knows... maybe any of you has a hint or a "why don't you try this?..." idea. Anything would be appreciated. Thank you. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.