Huzaifa Tapal
huzaifa at hostway.com
Wed Feb 23 10:16:13 EST 2005
Hello All, I have a custom handler that i have built that calls instantiates a web application framework I have written and asks it process the request. Since this web app framework originally was designed for CGI and was used in CGI, I am calling the apache.setup_cgi() to make the env seamless for the framework. I am running this under a multithreaded mpm apache configuration and am running into problems with race conditions with multiple threads accessing shared resources in memory. Since my customer handler kind of resembles the provided cgihandler which is not suited for a multithreaded env, I am wondering I am right in doing the apache.setup_cgi() like I am. My handler code looks like as follows: def handler(req): #_lock.acquire() #try: # setup the cgi environment env, si, so = apache.setup_cgi(req) # write the content type for testing purposes #sys.stdout.write("content-type: text/html\r\n\r\n") cache = req.get_options().get("CACHE", "Off") if cache == "Off": cache = 0 try: # load the driver driver = GlobalCache.getCachedItem("Driver") if not driver: driver = Driver(["./Driver.py"], cache_projects=cache, modpy_req=req) # cache if we have caching objects turned if cache: GlobalCache.setCachedItem("Driver",driver) # process the request driver.process() except: pass apache.restore_nocgi(env, si, so) return apache.OK #finally: # _lock.release() Any help would be appreciated. Hozi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050223/0b800428/attachment.html
|