From: Colin M. <co...@ch...> - 2004-10-16 09:20:46
|
Hi Brent, Some code in cookie.tcl relies on the global Cookie array to stage cookie data before passing it to Httpd_ files which actually send the cookies. The procs in question are called by template and direct modules. I think that the intention is to allow data to be passed back to the main interpreter when it has been set in a slave interpreter, because that's the only reason I can imagine for them to be set up and called the way they are. There's a bug in this approach, because the data can be corrupted by a page interrupting another page. (Incidentally, there's another bug hiding in the way we use global page to pass back the dynamic status of generated templates ... although this is probably less dangerous than cookies being overwritten by interloping pages.) Perhaps this is the cause of "[760802] data(mime,cookies) - Cookie_Get out of sync" at http://snipurl.com/9t7n ... I don't know. Can you help me by telling me what you understand to be the purpose of the Cookie_* setting and getting commands, so I can try to change the implementation to avoid the race, by using the data array to store cookies. I would have done this already, but I noticed that the Httpd_ cookie stuff already does it, and am puzzled by there being two ways to do (almost) the same thing. Also, should one of the interfaces be deprecated, or is there some subtle difference between them, which eludes me? This is quite possible. More generally ... would it be worth adding an optional quasi-semaphore to the Httpd protocol stack which just increments a global on receipt of a protocol request and decrements it on completion of processing, to detect interleaving of requests? It'd have to take account of Suspend/Resume too. If the counter ever had a value other than 0 or 1, it would signal a potential race, which could be logged. Such a facility could be used for early detection of some of the race conditions we're seeing reported. -- Colin McCormack <co...@ch...> |