Thank you for bringing this up. It is a serious issue. I think I have fixed this in trunk in anyserver. Can you check my solution is acceptable?
On Wednesday, 23 January 2013 01:09:48 UTC-6, JimK wrote: > > Since gluon.main and gluon.fileutils are being imported before > gevent's monkey.patch_all() is run, the sessions were getting mixed up. > > Here's the code I used that verified the issue (found on this forum): > > def index(): > import time > from gluon import current > print current.request.uuid > time.sleep(10) > print current.request.uuid > return dict(done='done!') > > Load this method in 2 different browsers within 10 seconds and you'll see > that the uuids are out of sync. > > It should be: > A > B > A > B > > But instead you get: > A > B > B > B > > To fix this, I created a separate file that just starts the gevent server. > Essentially, before importing the gluon modules, I run: > from gevent import monkey > monkey.patch_all() > > After running the test again, I get: > A > B > A > B > > So, should we remove gevent from anyserver.py and add gevent_server.py? > This would save others from encountering the same issue that I did. > --