Wednesday, November 21, 2007


We got caught in the production system yesterday.

Turns out the problem is that we use System.IO.Path.GetTempFileName() to, well, get a temporary file name to use in a directory. This method, if you read the documentation (which I did not), states that

Creates (emphasis mine) a uniquely named, zero-byte temporary file on disk and returns the full path of that file.

So there is a side-effect by calling this method. But that's not all. In the remarks it said:

The GetTempFileName method will raise an IOException if it is used to create more than 65535 files.

So the production system failed because this method has been called more than 65535 times.

Lessons learned:
(1) RTFM!
(2) the method should be renamed CreateTempFile.

No comments:

Listed on BlogShares