Dan Eloff
dan.eloff at gmail.com
Fri Jun 17 15:09:43 EDT 2005
Well this is the biggest problem in my otherwise threadsafe code. From what I've read, importing/reloading modules in a threaded environment is just plain dangerous. There could be any number of requests executing code from and accessing global variables in a module when it changes and gets reloaded. Then you have the two level problem of what happens to the executing requests, as well as what happens when multiple incoming requests all spot that the module has changed, and reload it multiple times in quick succession, re-executing code in the module scope (this is pretty much worst case) I know Graham knows a lot more about this than I do (help!). I do have a lot of flexibility here, since I'm using my own publisher I do not have to use apache.import_module. In fact I would prefer to not have the whole importing/reloading business affect my code outside of the publisher, that way I can change things internally at will. Clearly one option is to create a simple import function that imports once only in a production environment, and every time in a development env, but I'm still interested in exploring the options. -Dan
|