yysun/Git-Web-Access — Issue #6: Temp files are not cleaned properly
Author: ivan-danilov
Created: 2012-01-23 11:11:57+00:00
State: open

After some time of using Git-Web-Access I encountered strange problem at my dev machine which was configured to look at Git-Web-Access' URL:
$ git fetch
fatal: Couldn't find remote ref refs/heads/master

Web-interface look normal. But TeamCity reported that server returns 500 (Internal Server Error). So I went to server and looked to Event Log. Where I found bunch of warning reports that process w3wp.exe logged exception inside GetTempFileName() method. Actually it reported that such name already exists! When I took a look at %WinDir%\Temp I found 65500+ files with content evidently belongs to git. After I cleaned them - everything returned to work.

The problem is that for every operation in the temp dir appears several more files. And nobody cleans them :(
I tried to look at the Git-Web-Access sources, but there seems to be fair cleaning.

I don't have much time right now to investigate the problem :(

Git-Web-Access should be more careful to cleaning resources as it is meant to run for weeks and months without intervention. Some logging so admin could determine if the cleaning was successful or not or second try after some time if first fails for some reasons (e.g. if file is still used by some other process). Other thoughts why this situation could happen?