Timeouts uploading bits to drop folder from on-prem build controller connected to VSO

Had an interesting case recently. Customer was using an on-prem build controller connected to VSO. His Team Project was backed by Git and he had a team build using the GitTemplate.12.xaml Build Template. Problem was the build definition was failing about 78% of the time. The build itself completed, but the final phase failed.  The error was:

Exception Message: The HTTP request timed out after 00:01:40. (type TimeoutException)
Exception Stack Trace: at Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.EndCopyDirectory(IAsyncResult result)
   at Microsoft.TeamFoundation.Build.Workflow.Activities.CopyDirectory.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
 
Inner Exception Details:
 
Exception Message: A task was canceled. (type TaskCanceledException)
Exception Stack Trace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.<SendAsync>d__0.MoveNext()

 

- We tested building a simple Hello World VS project and that built 100% (no errors).
- The failing build had the “Copy build output to the server” option selected on the “Build defaults” tab. We changed this to both “Copy build output to the following drop folder“ and “This build does not copy output files to a drop folder” and the build succeeded in each case.

FIX:

Finally came to find a fix. In tfsbuildservicehost.exe.config* add the appSettings key of ServerDrop.MaxRequestTimeInSeconds with an int value for seconds. As an example add this... 

    <appSettings>
        <add key="ServerDrop.MaxRequestTimeInSeconds" value="300"/>
    </appSettings>

 

...and now the timeout is 5 minutes.

HTH,
Trevor

 

*C:\Program Files\Microsoft Team Foundation Server 12.0\Tools is where you’ll usually find tfsbuildservicehost.exe.config. You may need to turn on “FILE NAME EXTENSIONS” in File Explorer.