Jorey Bump
list at joreybump.com
Thu Sep 15 12:43:31 EDT 2005
Steve Bergman wrote: > I have a possibly related question. I'm new to mod_python, but I have > already noticed that if I have a module with a class that has a method > that returns, say, a list to a calling function in main, and then change > it to pass back, say, a dictionary, the interpretter sometimes wants to > continue to act like a list was passed, when the main program is > expecting a dictionary. The behavior is inconsistent in that sometimes > it works right and sometimes not. I think this might be covered in > question 3.1 of the FAQ, but I'm not sure I quite understand what it is > saying. > > Could someone enlighten me? Imported modules are cached for each interpreter created for a child process. In a prefork MPM, this may result in multiple interpreters for a single virtual host. Children created after an edit will import the new version of a module, while preexisting children continue to use the old version until they die. Currently, one of the most reliable ways to force a clean import for all processes is to restart apache (or even stop/start it). Although this is an inconvenience, module caching offers important performance gains. The situation is further complicated by different MPMs, different platforms, different versions of both apache & mod_python, different programming backgrounds, and, of course, differing expectations. Much discussion and work has centered around this issue, so there are likely to be significant changes on the horizon. No solution is without its disadvantages, but this gotcha poses problems for newbies and large scale environments alike. You may want to test your applications thoroughly against new versions of mod_python to ensure that they continue to work as expected.
|