Back    
Priority:
Type:
State:
Assignee:
Subsystem:
Affected versions:
Fixed in:

TW-2796

Deleting directory before running build

0
Every time I run my build (newly created with version 2.1) I get this error:

[10:22:56]: Checking for changes
[10:22:56]: Building in /build/teamcity/agent/work/Server/4.1_Builds
[10:22:56]: Getting project sources
[10:22:57]: Loading changed files from server...
[10:22:57]: Updating directory /build/teamcity/agent/work/Server/4.1_Builds
[10:22:57]: Clean directory /build/teamcity/agent/work/Server/4.1_Builds
[10:22:59]: jetbrains.buildServer.RunBuildException: java.io.IOException: Cannot find build file by path specified in build configuration settings: '/build/teamcity/agent/work/Server/4.1_Builds/test.xml' (absolute path on agent). Please check that specified path is correct.

It seems like TeamCity is getting project sources and then deleting the directory. This same build works fine with version 2.0. I do not have the "clean all files before build" checked, but if I do it appears to do the more correct ordering of clean and then get latest.

I am using Peforce for the VCS and have one vcs root defined for this build. If it matters, I'm not using a specific client but using a custom client mapping with Perforce (the mapping is typed into the edit box in the TeamCity Web UI).

As for the files on disk, I have watched the agent working directory and it seems like the messages above match what is happening on disk. I see new files being gotten from Perforce, and then everything is deleted, and then the build fails because it can't find a file it just deleted.

Environment: Ubuntu Linux

Issue wasresolved
Comments (15)
History (1)
John Murph John Murph 06 Jun 2007 22:12 (2 years ago)
I just realized that this issue may be related to the new "clean sources" button on the build page. I have used that button in 2.1 before I ever saw the build working (I was trying to get it set up correctly). Just in case it helps.
Yegor Yarko Yegor Yarko 07 Jun 2007 14:56 (2 years ago)
Just a note: The log messages are confusing indeed (addressed by TW-2663), but alone are not indication of something wrong.
John Murph John Murph 07 Jun 2007 17:07 (2 years ago)
However, as I indicated in the initial report, I watched the agent working directory (by repeatedly performing "ls" command) and saw behavior consistent with the log messages. The agent was the default agent on the TeamCity server machine, so I could actually watch the TeamCity temp directory and the agent working directory (using two terminal windows). I saw the server getting sources from perforce into a huge temp file (>1GiB), then I saw the server extracting those files (I presume) into other temp files that quickly disappeared, then I saw the files from perforce show up in the agent working directory, and then I saw all the files in the agent working directory disappear, and then the build failed. The ordering of these operations seems to match the ordering in the log. Also, this happened every time I tried it (maybe 5 or 6 times, getting from Perforce takes about 20 minutes for our project).
Olesya Smirnova Olesya Smirnova 08 Jun 2007 13:27 (2 years ago)
How many vcs root do you use? Could you please attach TC server log files?
Thanks!
John Murph John Murph 08 Jun 2007 18:17 (2 years ago)
I am using Peforce for the VCS and have one vcs root.
Olesya Smirnova Olesya Smirnova 08 Jun 2007 20:26 (2 years ago)
Could you please attach agent-side logs please? Thanks!
Olesya Smirnova Olesya Smirnova 08 Jun 2007 20:35 (2 years ago)
BTW, could you enable 'clean build' option and attach build log after this? Or attach log after some build running more than 3 seconds. The log above shows that there were no changes loaded from server (because it should take more than 1second).
John Murph John Murph 08 Jun 2007 21:32 (2 years ago)
It appears that the logs I previously sent were from TeamCity 2.0. I've attached the 2.1 logs here. Hopefully this will help more. If you need "clean" logs let me know and I'll delete all the logs and reproduce the problem again.

Sorry for the confusion.
Olesya Smirnova Olesya Smirnova 08 Jun 2007 21:51 (2 years ago)
Hello John,

is it possible to attach logs (now I mean the same logs as in issue description) for the build which runs for some time, more than several seconds?
As I can see from logs
[10:22:57]: Loading changed files from server...
[10:22:57]: Updating directory /build/teamcity/agent/work/Server/4.1_Builds
changes were loaded for 0 seconds it means there were no changes.
And attach please agent logs, they also might contain something useful.

Thanks!
John Murph John Murph 08 Jun 2007 23:10 (2 years ago)
Olesya,

Here is what I did. We have a mostly functional 2.0 system, so I stopped the 2.0 server and started the 2.1 server (after removing all old logs from the server and agent) using the same directories for the .BuildServer and agent working dir and temp dirs and everything.

After starting 2.1, the agent working dir contained all files from VCS because of build running in 2.0 server. I started the build in 2.1 server and it immediately delete the directory and started getting everything from VCS. This seems reasonable.

After getting all from VCS, the build ran and failed "normaly" (due to a quirk in our build process, the first time it gets all from VCS is will fail. Thereafter, everything works fine).

I restarted the build in 2.1 server and saw it immediately delete all files from the agent working directory. One file had been changed by a developer after the previous build, and I saw this file get put into the agent working directory. Build then failed, because the only file in the directory was the one file changed by a developer since the last build.

I then stopped the 2.1 server and grabbed the log files that are attached. You should see both server and agent log files.
Olesya Smirnova Olesya Smirnova 09 Jun 2007 13:33 (2 years ago)
Is it possible to view your configs? (.BuildServer/config directory content). Without any authentication information, of course.
You can send it to me by email if you don't want to attach it here.
Thanks!
Olesya Smirnova Olesya Smirnova 09 Jun 2007 13:54 (2 years ago)
Just in case.
Please do clean sources for the agent and run the build. It has to get all sources and fail. After this
add system property agent.save.patch=true to the build configuration, change some file in vcs and run it. Loaded changed sources in temp file won't be deleted. Please attach (or send to me) this temp file also. I wont to check if delete working directory command is in patch. (Content of changed file will be inside temp file so please be sure the file does not contain any security information).

Thanks!
John Murph John Murph 14 Jun 2007 02:14 (2 years ago)
Olesya,

I followed the specified procedure, but the patch file was not left on the server. Just to repeat:

1) Do clean sources for the build
2) Run the build and let it fail (takes a while because it gets all from Perforce)
3) Add system property to build configuration called "agent.save.patch" set to value "true"
4) Change a file in Perforce and run the build

After this I do not have a patch file left on the machine. I then left the system property in place and did another build (which gets all files from Perforce again, apparently TeamCity knows that it deleted them) and I watched the patch file grow larger and larger, and then the patch file was deleted.

Here is a screenshot of the system property in the build configuration screen.
Olesya Smirnova Olesya Smirnova 15 Jun 2007 15:38 (2 years ago)
John,
It seems we found the problem. As a workaround you can configure perforce client with this mapping and use it instead of mapping. Please let us know if it helps.
Thanks for the help!
John Murph John Murph 16 Jun 2007 01:31 (2 years ago)
Olesya,
Using a normal perforce client instead of specifying the mappings in TeamCity did indeed work around the problem. Thanks.