Forum OpenACS Q&A: Response to Template corruption?

Collapse
Posted by Reuven Lerner on
Well, our failures are global, which leads me to believe that

Things are a bit complicated on our server, since we've implemented (don't shudder too much, now) an HTTP-based chat client that updates its list of currently online users with every HTTP request to the server.  With each request, we're thus performing some database work *and* writing to an XML file on disk that lists the currently available users.  (There is some method to this madness, trust me.)

In going over things with the programmer who implemented this, I saw that with each HTTP request, we were opening a filehandle (named file) that was declared to be global at the top of a Tcl proc.  (I know, I know, global variables are evil.  You don't have to tell me.)  In any event, some of the corruption that took place in other pages on the system looked identical to what was supposed to be dumped into the disk file.  My guess, although I can't prove it, is that the combination of global variables and threads meant that the filehandle wrote to the user's Web browser rather than to the disk file.  This would account for many of the errors we've seen so far, but not all of them.

I'll send more questions or answers to the forum, as they arise!