locked
tf get intermittently reports unable to determine workspace RRS feed

  • Question

  • We use Jenkins in combination with TFS 2013 for continuous integration. Jenkins has a TFS plugin that will use the TF command line tool to talk to the TFS server.

    Everything was working fine until we got a faster Jenkins 'server' (running Windows 8.1 instead of Windows 7 x64, 8 cores vs 4 and 8 Jenkins build executors vs 3). Every couple of builds one of the jobs will fail with an 'unable to determine workspace' error. When the job is either restarted manually or by another change in TFS, the job succeeds.

    Four build jobs are triggered in parallel - each getting the latest version of sources from TFS.

    I have enabled the tftrace options in tf.exe.config, the following is the result of a failure:

    [, PID 10108, TID 4596, 2015/04/10 10:03:17.597] Command: get
    [, PID 8184, TID 4872, 2015/04/10 10:03:17.600] Web method running: [https://<tfsserver>:8088/tfs/BSCollection/VersionControl/v4.0/repository.asmx] QueryWorkspaces[VersionControl]
    [, PID 4908, TID 684, 2015/04/10 10:03:17.601] # Team Foundation Trace for component TFTrace started at 04/10/2015 10:03:17 [note all date/time values are in UTC].
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.602] # Team Foundation Trace for component TFTrace started at 04/10/2015 10:03:17 [note all date/time values are in UTC].
    [, PID 4908, TID 684, 2015/04/10 10:03:17.609] Begin: 4/10/2015 12:03:17 PM ================================
    [, PID 4908, TID 684, 2015/04/10 10:03:17.609] Command line: tf get . -recursive -version:D2015-04-10T10:03:17Z -noprompt -login:<user>,<password>
    [, PID 4908, TID 684, 2015/04/10 10:03:17.609] Current directory: C:\Program Files (x86)\Jenkins\jobs\7.12 - work - bp - 11.4\workspace
    
    [, PID 4908, TID 684, 2015/04/10 10:03:17.609] CommandLine Assembly.Location: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\tf.exe
    [, PID 4908, TID 684, 2015/04/10 10:03:17.609] CommandLine Assembly.Version: 12.0.0.0
    
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.609] Begin: 4/10/2015 12:03:17 PM ================================
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.609] Command line: tf get . -recursive -version:D2015-04-10T10:03:17Z -noprompt -login:<user>,<password>
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.609] Current directory: C:\Program Files (x86)\Jenkins\jobs\7.12 - work - bl - 11.4 - openedge\workspace
    
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.609] CommandLine Assembly.Location: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\tf.exe
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.609] CommandLine Assembly.Version: 12.0.0.0
    
    [, PID 4908, TID 684, 2015/04/10 10:03:17.611] Command: get
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.611] Command: get
    [, PID 10108, TID 4596, 2015/04/10 10:03:17.625] Session ID: d1334728-41dc-4734-a827-ae30944b016c
    [, PID 8184, TID 4872, 2015/04/10 10:03:17.631] Web method response: [https://<tfsserver>:8088/tfs/BSCollection/VersionControl/v4.0/repository.asmx] QueryWorkspaces[VersionControl] 30 ms
    [, PID 8184, TID 4872, 2015/04/10 10:03:17.633] End: 426 ms
    [, PID 8184, TID 4872, 2015/04/10 10:03:17.633] Process time stats: 265.625 ms total, 140.625 ms user code, 125 ms OS code
    
    [, PID 4908, TID 684, 2015/04/10 10:03:17.638] Session ID: 2b27e188-e4e4-4dd6-915f-0eeeba3de659
    [, PID 10108, TID 4596, 2015/04/10 10:03:17.677] Web method running: [https://<tfsserver>:8088/tfs/BSCollection/VersionControl/v5.0/repository.asmx] Get[VersionControl]
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.678] 
    Microsoft.TeamFoundation.Client.CommandLine.Command+ArgumentListException: Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
       at Microsoft.TeamFoundation.VersionControl.CommandLine.VersionControlCommand.GetCurrentWorkspace()
       at Microsoft.TeamFoundation.VersionControl.CommandLine.CommandGet.Run()
       at Microsoft.TeamFoundation.VersionControl.CommandLine.VersionControlCommandLine.RunCommand(String commandName, String[] args, Boolean& showExitCode)
       at Microsoft.TeamFoundation.Client.CommandLine.CommandLine.RunCommand(String[] args)
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.678] End: 73 ms
    [, PID 1828, TID 5412, 2015/04/10 10:03:17.679] Process time stats: 109.375 ms total, 78.125 ms user code, 31.25 ms OS code

    Note the two 'gets' from two process in the same millisecond (PID 1828 and PID 4908) - 1828 fails.

    Friday, April 10, 2015 10:29 AM

All replies

  • Hi Stefan,  

    Thanks for your post.

    As you’re using Jenkins integrate with TFS 2013 Server, I moved this post to TFS Eclipse and Cross Platform for the better response.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 13, 2015 2:23 AM
    Moderator
  • On this server I just had the same false unable to determine workspace, this time from a non-Jenkins session. In this case four parallel processes are talking to TFS, when two perform actions in the same millisecond something gets mixed up:

    [, PID 8612, TID 4832, 2015/04/23 13:55:00.856] # Team Foundation Trace for component TFTrace started at 04/23/2015 13:55:00 [note all date/time values are in UTC].
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.859] # Team Foundation Trace for component TFTrace started at 04/23/2015 13:55:00 [note all date/time values are in UTC].
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.867] Begin: 2015-04-23 15:55:00 ================================
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.867] Command line: tf  checkout "c:/tfs/ef71/2/work/bl/project/ifallgen/gprdtrs.p" 
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.867] Current directory: C:\Users\<user>\AppData\Local\Temp
    
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.867] CommandLine Assembly.Location: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\TF.exe
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.867] CommandLine Assembly.Version: 12.0.0.0
    
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.867] Begin: 2015-04-23 15:55:00 ================================
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.867] Command line: tf  checkout "c:/tfs/ef71/2/work/bl/project/ifallinc/tt/prhtrs.i" 
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.867] Current directory: C:\Users\<user>\AppData\Local\Temp
    
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.867] CommandLine Assembly.Location: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\TF.exe
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.867] CommandLine Assembly.Version: 12.0.0.0
    
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.869] Command: edit
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.869] Command: edit
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.891] Session ID: 13720317-fd45-41c8-8e0e-52e5edefc576
    [, PID 1988, TID 7504, 2015/04/23 13:55:00.953] Web method running: [https://<tfsserver>:8088/tfs/BSCollection/VersionControl/v5.0/repository.asmx] PendChanges[VersionControl]
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.997] 
    Microsoft.TeamFoundation.Client.CommandLine.Command+ArgumentListException: Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
       at Microsoft.TeamFoundation.VersionControl.CommandLine.VersionControlCommand.GetCurrentWorkspace()
       at Microsoft.TeamFoundation.VersionControl.CommandLine.CommandCheckout.Run()
       at Microsoft.TeamFoundation.VersionControl.CommandLine.VersionControlCommandLine.RunCommand(String commandName, String[] args, Boolean& showExitCode)
       at Microsoft.TeamFoundation.Client.CommandLine.CommandLine.RunCommand(String[] args)
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.998] End: 134 ms
    [, PID 8612, TID 4832, 2015/04/23 13:55:00.998] Process time stats: 125 ms total, 109.375 ms user code, 15.625 ms OS code
    
    Note the two 'edits' from two processes in the same millisecond (PID 8612 and PID 1988).


    Where to go from here? Is this a tf client issue or a tfs server issue? 


    Thursday, April 23, 2015 8:19 PM
  • This issue is still occurring - maybe it's related to issues with GetCurrentDirectory / SetCurrentDirectory, maybe it's not.

    BUT to alleviate the pain, I stumbled across the Jenkins (ver. 1.630) advanced project option 'Retry Count' with the promising help text 'If a build fails to checkout from the repository, Jenkins will retry the specified number of times before giving up.'.

    This can also be configured globally in [ Manage Jenkins / Configure System ] - SCM checkout retry count.

    This is helping - bye bye failed builds due to intermittent nonsense!

    [workspace] $ tf get . -recursive -version:D2015-10-06T15:25:04Z -noprompt ********
    Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
    FATAL: Executable returned an unexpected result code [100]
    ERROR: null
    Retrying after 10 seconds


    Tuesday, October 6, 2015 3:46 PM