modules and web.py threads (just confused)

48 views
Skip to first unread message

NSC

unread,
May 9, 2012, 3:59:54 PM5/9/12
to we...@googlegroups.com
OK, I'm seeing some strange behavior with multiple asychronous calls to my web.py service.  I'm wondering if I just don't understand something about Python/web.py coming from ASP.NET.

My html page has some complex content, populated by five ajax calls.  If I make the calls sychronous (slow!), I seem to be ok.  But, as soon as I let them go asynch, I have random issues.

More detail:
In the handler for each ajax "request" to web.py, I make a database connection.  But, because my application is so huge, I'm putting the connection in an instance of a common module class, so no matter where I branch, the connection is available.

Here's my question/suspicion:
For multiple, simultaneous requests, how does web.py handle the "threads"?  Are class instances created in the "scope" of a request actually thread safe?  Is it possible that my common module class instance is actually being shared by all the active threads?

I can't really post code, there's just too much.  An explanation of threading, whether or not instances are segregated, etc would help me a lot.

Thanks tons!
NSC
Reply all
Reply to author
Forward
0 new messages