I need validation

Yesterday I ran across an interesting problem.  I say interesting with a sort of snarky tone that might also include the use of air quotes.  We are a Coldfusion shop (generally speaking) with one of our two servers running version 7 (the other is 8, yay).  For years we have had problems here and there with badly optimized code and things just going crazy at points due to whatever bad code we had written, everything from sharp memory spikes to gradual memory leaks.  Yesterday I found another one.  With so much traffic on our server, I generally keep a constant eye on our usage using the SeeFusion application.  I haven’t been able to unlock all of its secrets but I can see which queries are huge, which pages are taking too long and how much memory is being consumed — enough to make adjustments where necessary and fine tune applications.  Yesterday there was a point where there were multiple pages stacked up and sucking up memory.  As I looked through them, one thing was constant, they were all pages that generated a PDF.

Finding good resources online isn’t always easy, a lot of people have problems that seem to be something similar to what we might have, but in reality it’s very different.  In the case yesterday, there were similar problems, each taking different approaches but it gave me a place to start looking for problems.  I started with one of our latest projects, the page gives the user a print option for the page by generating a pdf using the cfdocument tag.  After some time of scouring the various message boards and then scouring the page itself, I found an interesting mistake.  I had forgotten an open table row tag (<tr>).  Since the html was then not properly validating, the coldfusion cfdocument tag was bombing (but only under certain circumstances, which is why it was hard to pinpoint).  Once that was fixed, the page ran just as it should.  So the lesson to be learned is — run your pdf html code through a validator before wrapping with the cfdocument tags.