On 24 août, 13:04, mdipierro <[email protected]> wrote: > when you do "python web2py.py" you do not start the wsgi app. You > start the rocket web server which makes a number of threads. When a > new http request arrives it is assigned to a free thread (or a new > thread is created) and the wsgi is run in that thread to server that > request and only that request. > >
I guess that each time a thread is put in service the model is executed again. So, for the model, a version of the instance exist for each thread. Right? > > So, as a web2py developer, what do I have to do to avoid > > synchronization problems in my application. Where is the danger of > > having multiple threads for the web2py developers? What are the > > instances shared my multiple threads? What are the instances living in > > their own threads? > > You do have to do anything because every concurrency issue is taken > care automatically. There are some DO NOTs: > - do not ever call os.chdir > - do not import third party modules that are not thread safe > - do not use thread.start_new_thread and threading.Thread.start() > - if you open a file that is not uniquely associate to this http/ > request/client/session lock the file. OK

