The File Exists- IOException, monitoring file creation and Atom
Last week was interesting. I spent 5 hours debugging my laptop after having several problems with it. Upside is that I have a few things to share with you :) Let’s start with the first problem.
My laptop is new, it’s a work laptop and I hadn’t installed much more than my usual dev things. So when Visual Studio started acting up big time I was surprised. It wouldn’t let me make any design time changes, or save anything. Needless to say that’s a big problem as a developer since it’s my main tool. I kept getting a ‘The File Exists’ message box, before VS would stop responding and crash after recommending a log file.
It wasn’t the only thing causing problems. I was unable to install drivers or updates, for example when I tried to update my graphics card driver. Using the Intel utility or doing a manual install gave same results. No results. I’ll explain next week about the drivers for my graphic cards and the problems I had there and why I had to install new drivers (actually do a rollback).
The log file gave me more information, which I was happy about as the eventlog on my computer had no new errors despite the crashes. Path.GetTempFileName threw IOException.
When a process creates temp files there is a max, 65535 is the magic number. I did a quick PowerShell query, and yup indeed my temp folder was packed.
I deleted the files and restarted my computer to be on the safe side. 10 minutes after restart I had problems again. What was up? In the temp folder there was mostly empty temp files, which made me suspicions. Friends on Twitter and Skype recommended Procmon (process monitor, system internal tools).
To find out which process is creating files run procmon (which is of course free), on the right hand menu select files only, then under filter add a filter for the path you want to monitor. Under Edit select clear display to empty previous happenings and make sure the magnifying glass icon is on. I saw one process in particular that was creating files, and the naming convention was similar to the ones I had seen. I added another filter for that process name and soon I saw that within 10 minutes it had filled up my temp folder and things stopped working.
Funny thing, when I looked at the process a friends name popped up. Paul Betts at GitHub.
It was the update process for the Atom editor that was doing something wacky and causing all these problems. We started talking on Twitter (Paul and I) and turns out this was an issue he had recently solved but hadn’t made it in the latest release. He made a pull request a few minutes later. Until I can do a fresh install of Atom I’m just killing the process as soon as it starts with PowerShell and now Visual Studio, Intel Utility and updates etc. are working fine.
It took me a few hours to find the problem, but I learned to use procmon (my first time), and the second day I taught the client I’m doing some work for how to use it as we had to debug some install package problem on an off-site computer.
All in all, worth it. Big thanks to Paul for being so awesome, and everybody else that recommended various tools and solutions. Love you all!
Comments
I wish you had too :) Really frustrating, isn't it! Glad you got it sorted :))
Last modified on 2015-03-14