TFS Deployer runs multiple instances of deployment script

Jul 23, 2010 at 1:14 PM
Edited Jul 26, 2010 at 1:56 PM

Hi all.

Jul 23, 2010 at 1:39 PM
Edited Jul 26, 2010 at 12:58 PM

Hi all.

Last few days I have very strange behavior of TFSDeployer (version is 1.0.0.0). My deployment script writes some log. And I can't be sure when this issue starts, but I got duplicated messages in my log. It looks like TFS Deployer runs my script in multiple instances with the same parameters. There are no errors in TFS Deployer event log in that time. It's very strange, because before all worked fine and now it crash. My deployment script wasn't changed for a long time.

Here is a part of my log:

[2010 07 23 06:05 AM] : Script started
[2010 07 23 06:05 AM] : Script Parameters: [parameters list]
[2010 07 23 06:05 AM] : Check input parameters
[2010 07 23 06:05 AM] : Check Gallio snapin
[2010 07 23 06:05 AM] : Script started <--------- duplicated part
[2010 07 23 06:05 AM] : Script Parameters: [parameters list] <--------- duplicated part
[2010 07 23 06:05 AM] : Check input parameters <--------- duplicated part
[2010 07 23 06:05 AM] : Check Gallio snapin <--------- duplicated part
[2010 07 23 06:05 AM] : Check config file
[2010 07 23 06:05 AM] : Write values to config file
[2010 07 23 06:05 AM] : Check config file <--------- duplicated part
[2010 07 23 06:05 AM] : Write values to config file <--------- duplicated part
[2010 07 23 06:05 AM] : Create test files array
[2010 07 23 06:05 AM] : Run tests
[2010 07 23 06:05 AM] : Create test files array <--------- duplicated part
[2010 07 23 06:05 AM] : Run tests <--------- duplicated part
[2010 07 23 06:05 AM] : An error occured when try to run tests: Error Category: NotSpecified, Error Type: System.IO.IOException, ID: An unexpected error occurred during execution of the Gallio task.,Gallio.PowerShellCommands.RunGallioCommand, Message: The process cannot access the file '\\sdsidev04\BuildLogs\WebSecure_Mainline_CI_20100723.14\TestResult\test-report-20100723-060549.html' because it is being used by another process. <--------- error because 2 instances try to get the same file
[2010 07 23 06:05 AM] : Update Build Quality to AAT Failed
[2010 07 23 06:05 AM] : Create mail recipients array
[2010 07 23 06:05 AM] : Create Reports package
[2010 07 23 06:05 AM] : Script finished
[2010 07 23 06:06 AM] : Update Build Quality to Rejected <--------- duplicated part
[2010 07 23 06:06 AM] : Script finished <--------- duplicated part

Any ideas what happens?

Jul 26, 2010 at 11:09 AM
Edited Jul 27, 2010 at 8:44 AM

I analized EventLog a bit and found that TFSDeployer got 3 notifications from TFS. Two of them looks like this:

<?xml version="1.0" encoding="utf-16"?>
<BuildStatusChangeEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TeamFoundationServerUrl>http://MyServer:8080/</TeamFoundationServerUrl>
<TeamProject>MyProject</TeamProject>
<Title>MyBuild Quality Changed To Unit Test Passed</Title>
<Subscriber>MyDomain\MyUser</Subscriber>
<Id>MyBuildNumber</Id>
<Url>http://MyServer:8080/Build/Build.aspx?artifactMoniker=10977</Url>
<TimeZone>Pacific Daylight Time</TimeZone>
<TimeZoneOffset>-07:00:00</TimeZoneOffset>
<ChangedTime>7/26/2010 6:44:27 AM</ChangedTime>
<StatusChange>
<FieldName>Quality</FieldName>
<NewValue>Unit Test Passed</NewValue>
</StatusChange>
<ChangedBy>MyDomain\MyUser</ChangedBy>
</BuildStatusChangeEvent>

And the last one looks like this:

<?xml version="1.0" encoding="utf-16"?>
<BuildStatusChangeEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TeamFoundationServerUrl>http://MyServer:8080/</TeamFoundationServerUrl>
<TeamProject>MyProject</TeamProject>
<Title>MyBuild Quality Changed To Unit Test Passed</Title>
<Subscriber>MyDomain\MyUser</Subscriber>
<Id>MyBuildNumber</Id>
<Url>http://MyServer:8080/Build/Build.aspx?artifactMoniker=10977</Url>
<TimeZone>Pacific Daylight Time</TimeZone>
<TimeZoneOffset>-07:00:00</TimeZoneOffset>
<ChangedTime>7/26/2010 6:44:27 AM</ChangedTime>
<StatusChange>
<FieldName>Quality</FieldName>
<OldValue>Unit Test Passed</OldValue>
<NewValue>Unit Test Passed</NewValue>
</StatusChange>
<ChangedBy>MyServer\MyUser</ChangedBy>
</BuildStatusChangeEvent>

I think, it may be the reason why my script runs in multiple instances.

P.S. Build Quality changed from my build script by "<SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Quality="Unit Test Passed" />" task.

Aug 27, 2010 at 6:58 AM
Edited Aug 27, 2010 at 7:04 AM

Hi

I'm getting the same issue. I'm updating the build quality using the <SetBuildProperties>. But the deployer runs the deployment script multiple times. If I try to update the quality from the build explorer, then the script is only executed once.

Any help/ideas would be appreciated.

Regards

Binu

Apr 21, 2011 at 10:27 AM

Still have this problem.

Coordinator
Apr 26, 2011 at 11:28 PM

Hi,

Are you still using TFS Deployer v1.0.0.0?

Regards,

Jason

Apr 27, 2011 at 1:46 PM

Yes. But I think it is not a TFS Deployer problem. Because TFS Server generates multiple duplicated events when you use SetBuildProperties task and TFS Deployer reacts to all of them :(

Coordinator
Apr 28, 2011 at 1:35 AM

Newer versions of TFS Deployer explicitly check for multiple notifications of the same quality change in quick succession (within 5 seconds) and ignores them as duplicates. However, upgrading may not be an option if you are not using TFS 2010 yet.

Apr 28, 2011 at 6:37 AM

Yes. Upgrade is not a solution im my case because we still use TFS 2008.

Apr 28, 2011 at 5:14 PM
Edited Apr 28, 2011 at 5:32 PM

I'm getting a similar issue with TFS Deployer 1.4.0 using TFS 2010 SP1.  For example, I have 3 build qualities: A, B, C.  I want them to be mutually exclusive so if A->C then I set the BQ to A in the script. 

What I get is a message for A->C,  C->A and A->C (again). 

 --------------------------------

I put a breakpoint on the IsUnique() in OnListenerBuildStatusChangeEventReceived().  And it is NOT getting executed.  when the "duplicate" event is processing.  It is almost as if it is being queued again internally.

Apr 28, 2011 at 5:52 PM

As a followup.  I put the call to the duplicate message processing in the MappingProcessor and that did eliminate the problem.  I don't think this is the final solution however.

Aug 23, 2012 at 5:31 PM

edgelandtech - could you share, how did you put call to duplicate message processing? I am facing similar issue. thx.