weird errors about not finding classes / objects when multiple simultaneous requests from different browsers/sessions.

42 views
Skip to first unread message

Carlos

unread,
Aug 15, 2011, 12:27:12 PM8/15/11
to web...@googlegroups.com
Hi,

I'm having some weird errors about web2py/python not finding classes / objects in my models when multiple simultaneous requests come from different browsers/sessions.

I'm still running locally (not in production), using the latest web2y trunk on windows 7 with postgresql and rocket.

My models are huge for the moment and all in root, which is ok for now. I know I can use the new model sub-folders, modules, etc., but that's not the issue here.

Is web2py (or rocket) actually capable of handling simultaneous / parallel web requests without mixing environments (data / models) from these multiple requests?.

In one of such cases, I have one class that gets instantiated in my very first model, and suddenly I get an error in my 3rd. model that such instance is None !, which makes no sense because I did instantiate that in my model # 1 and I never reset such var.

All these errors do NOT occur at all when I do one web request at a time.

Is it because I'm using rocket?, will these problems disappear as soon as I move to apache or nginx?, or is this directly related to web2py or python?.

Remember, this is specifically for handling *simultaneous* web requests (from different browsers/sessions) with a long execution time (big models).

Thanks for your input.

   Carlos

Marin Pranjic

unread,
Aug 15, 2011, 3:57:07 PM8/15/11
to web...@googlegroups.com
It should not be an issue with mixing environments.
Can you provide more information?


Marin

Carlos

unread,
Aug 15, 2011, 4:21:12 PM8/15/11
to web...@googlegroups.com
Hi,

I will provide more information in order to reproduce the problem, as soon as I can.

But I just want to make sure: are the environments created by web2py fully independent in every single web request (even with multiple concurrent requests) ?.

If anybody has more information or has experienced these kind of issues, please let me know.

Thanks again,

   Carlos

Massimo Di Pierro

unread,
Aug 16, 2011, 4:21:21 AM8/16/11
to web2py-users

> But I just want to make sure: are the environments created by web2py fully
> independent in every single web request (even with multiple concurrent
> requests) ?.

yes

Carlos

unread,
Aug 16, 2011, 10:04:34 AM8/16/11
to web...@googlegroups.com
Great to know, thanks Massimo for (re-)confirming this.

I'll share more information about these problems as soon as I can.

Take care,

   Carlos

Carlos

unread,
Aug 17, 2011, 10:56:40 AM8/17/11
to web...@googlegroups.com
Hi Massimo (or others),

This is one of the many errors I can get by executing concurrent web requests from different browsers ...

web2py™ Version 1.98.2 (2011-08-16 12:27:18)
Python Python 2.6.4: C:\Python26\python.exe
Traceback

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 194, in restricted
    exec ccode in environment
  File "C:/web2py/applications/nube/controllers/web.py", line 242, in <module>
  File "C:\web2py\gluon\globals.py", line 145, in <lambda>
    self._caller = lambda f: f()
  File "C:/web2py/applications/nube/controllers/web.py", line 28, in site
    def site(): return __web()
... many other calls to models ...
NameError: global name 'db' is not defined

<type 'exceptions.NameError'>(global name 'db' is not defined)


Note that NONE of these errors occur when there's no concurrency.

Remember that these concurrency errors are occurring in my local environment (not yet in server) on win7, with postgresql and rocket.

I am not ready yet to provide my complete web2py environment (models), they are huge, and I haven't had the chance to prepare something much smaller ... but I hope someone out there (Massimo?) can help me fix these show-stopper problems.

Any clues?, thanks,

   Carlos

Bruno Rocha

unread,
Aug 17, 2011, 11:01:48 AM8/17/11
to web...@googlegroups.com
BTW: where are you defining 'db' ? in db.py on the root of /models ?
--



--
Bruno Rocha
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]

Carlos

unread,
Aug 17, 2011, 11:44:01 AM8/17/11
to web...@googlegroups.com
Hi Bruno,

The 'db' is pretty much the first model to be defined, and never ever reset, and all of them in root.

And note that 'db' is just one specific example of the many other errors I could get during concurrency.

For reference, objects instantiated in the first model suddenly are NOT recognized global in subsequent models / controller, same as what occurred with 'db'.

And this occurs only during concurrency, i.e. everything works perfectly fine during non-concurrent web requests.

Remember that my models code (so much more than db definitions) are huge (which is not the point for this issue).

Thanks again,

   Carlos

Massimo Di Pierro

unread,
Aug 17, 2011, 2:09:35 PM8/17/11
to web2py-users
Can you email me the controller, privately? I am puzzled by this.
Reply all
Reply to author
Forward
0 new messages