Jorge Godoy wrote: > "Ben Sizer" <[EMAIL PROTECTED]> writes: > > > You were probably clear, but I don't know much about the detail of > > database transactions and so on. But even if I drop down to the > > database level and make the update directly, can I be sure that the > > correct values propagated up to SQLObject in the other threads? > > In a standard TG application, the way it is designed in 1.0+ you should be > safe on every exposed method. It starts a transaction that reads data from > the DB. > > I believe that the only way you'll guarantee that it works for you is writing > a small test case. One thread modifies data and the other reads it.
It's not really possible to use test cases for synchronisation problems though. They might work 10000 times in testing and then fail the 10001st time when the instruction interleaving differs slightly, due to the system load being higher, or some cache being more or less full, etc. If you know which methods are synchronised and which ones aren't, then it's possible to prove whether it will always work or not. Unfortunately I don't have this sort of information and I was hoping someone here would. > > This all worries me... threads are surely a pretty fundamental part of > > many long-running process models, yet nobody except yourself is able to > > tell me what is safe and what is not. I at least need to know what sort > > of exceptions I need to be able to catch and which circumstances they > > may arise in, and which objects in the Turbogears system I can pass > > between Python threads and those which I can't. > > Hmmm... Due to the nature of web applications -- several concurrent accesses > -- much of TG is thread safe. In fact there's even some code to prevent that > a developer do some unsafe operations. But I need to know what it does to prevent it; does it use mutual exclusion to ensure that certain operations happen atomically? If so, which ones? If not, does it throw exceptions when an operation will fail and back out or roll back; if so, from where, and which exceptions? Someone posted a recipe involving an sqlobject thread-local method and nobody seems to know what it does or how important it is. It may be that I'm worrying about nothing, but it's also not possible for me to exhaustively test every possible interleaving of Python bytecode to see if that is the case. -- Ben Sizer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

