Build Machine上的大型TFSUser \ AppData \ Local \ Temp目录 [英] Large TFSUser\AppData\Local\Temp Directory on Build Machine

查看:98
本文介绍了Build Machine上的大型TFSUser \ AppData \ Local \ Temp目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Server 2008 R2上使用TFS 2012 Update 1.我们有在帐户TFSUser下运行的TFS构建.前几天,我们的构建机器空间不足.经过调查,我发现文件夹C:\ Users \ TFSUser \ AppData \ Local \ Temp中包含超过50GB的文件,有些文件的历史可以追溯到2012年10月.这些文件都没有太大,但它们没有似乎曾经被清理过.

今天的调查表明,在自动生成过程中,文件夹被写入很多内容.为什么不清理这些文件?如何确保我的构建计算机不会由于此问题而再次用完空间?

更新2013-03-13
我创建了一个小型的powershell脚本,该脚本每晚运行一次以删除temp目录的内容.这是Powershell脚本:

Stop-Service TFSBuildServiceHost.2012
Remove-Item Drive:\Path\To\TFSUser\AppData\Local\Temp\* -recurse -exclude Build*
Start-Service TFSBuildServiceHost.2012

我以TFSUser帐户的身份以每晚特权运行任务.需要提升的特权,因为我们需要启动和停止服务.

解决方案

这是TFS2010问题,我想他们在2012年还没有解决.构建系统会创建临时文件,并且永远不会对其进行清理,最终会导致失败,因为磁盘已满,或者因为它们将有限数量的数字用作唯一ID,并且用完了可以使用的新ID(IIRC,它崩溃了).包含65536个文件,通常我们在运行磁盘空间之前就已经击中了很长的时间)

解决方案是定期删除临时文件.我每年大约要手动进行2-4次.最安全的方法可能是禁用构建代理,然后清理temp文件夹,然后重新启用代理(如果已经运行了几个月,则同时重新引导服务器可能不是一个坏主意)./p>

另一种选择是每天/每周设置一个小的计划任务,以清除早于几天的任何临时文件,并在深夜运行,而您一无所知(例如通宵构建)正在运行.

或者,如果您的服务器每年每年重启几次,那么在构建代理启动之前清除temp文件夹的启动脚本可能是干净的&整洁的解决方案.

这完全取决于磁盘填充的速度-您可能会发现它是数月累积的碎片,而不是短时间后会碰到的碎片,在这种情况下,您不需要非常激进的方法使事情顺利进行.

I'm using TFS 2012 Update 1 on Windows Server 2008 R2. We have the TFS build running under the account TFSUser. The other day we ran out of space on our build machine. Upon investigation I found that the folder C:\Users\TFSUser\AppData\Local\Temp had over 50GB of files in it, some dating back as far as October of 2012. None of the files are overly large, but they don't ever seem to get cleaned up.

Investigating today shows that folder gets written to a lot during an automated build. Why aren't these files getting cleaned up and what can I do to ensure my build machine doesn't run out of space again due to this issue?

Update 2013-03-13
I created a small powershell script that runs nightly to delete the temp directory contents. Here's the powershell script:

Stop-Service TFSBuildServiceHost.2012
Remove-Item Drive:\Path\To\TFSUser\AppData\Local\Temp\* -recurse -exclude Build*
Start-Service TFSBuildServiceHost.2012

I have the task run with elevated privileges nightly as the TFSUser account. The elevated privileges are needed because we need to start and stop services.

解决方案

This is a TFS2010 issue that I guess they haven't addressed in 2012 yet. The build system creates temp files and never cleans them up, leading eventually to failures because the disk is full or because they use a limited number of digits for the unique IDs and run out of new ids that can be used (IIRC, it falls over at 65536 files, which we usually hit long before we run of disk space)

The solution is to delete the temp files periodically. I just do this manually about 2-4 times a year. The safest approach is probably to disable your build agents and then clean out the temp folder, then re-enable the agents (and it may not be a bad idea to reboot the server at the same time if it's been running for months).

An alternative may be to set up a small scheduled task daily/weekly that cleans away any temp files older than a few days old, and run it in the middle of the night when you know nothing else (like overnight builds) will be running.

Or if your server is rebooted several times a year anyway, a start-up script that cleans out the temp folder before the build agents start up may be a clean & tidy solution.

It all depends how quickly your disk is filling up - you'll probably find that it's many months of accumulated cruft rather than something that hits you after a short time, in which case you don't need a very aggressive approach to keep things running smoothly.

这篇关于Build Machine上的大型TFSUser \ AppData \ Local \ Temp目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆