API call to SetActiveRepositoryID hangs

If you are having a problem using Fortress, post a message here.

Moderator: SourceGear

Post Reply
dprothero
Posts: 44
Joined: Sun Mar 21, 2004 12:18 pm
Location: Stockton California
Contact:

API call to SetActiveRepositoryID hangs

Post by dprothero » Wed Jun 02, 2010 2:06 pm

Fortress version 1.1.3.18336.

I have an ASP.NET application that uses the API. It's running on Windows Server 2008, IIS 7. It's running using the "Classic" ASP.NET app pool. My app is hanging on the call to SetActiveRepositoryID. I can make it work if I make the identity of the app pool a domain user that is a member of Domain Admins. Below are all the variations I tried and the result:

App pool identity / Result
~~~~~~~~~~~~~~~~~~~
NETWORK SERVICE / Hangs
Domain user with only minimal privileges / Hangs
Domain user added to local Administrators group of web server / Hangs
Domain user added to Domain Admins domain group / Works

Can someone elaborate what permission I need to set on the user account to make this work. Our security policies won't allow the service to run as a Domain Admin.

Thanks!

David

P.S. Code in question:

Code: Select all

Public Sub Login()
  Dim reps As VaultRepositoryInfo() = Nothing
  Dim theRep As VaultRepositoryInfo

  _ci = New ClientInstance
  _ci.UseFileSystemWatchers = False
  _ci.UseUpdateThread = False
  _ci.Init(VaultConnection.AccessLevelType.Client)
  Try
    _ci.Login("http://Vault/VaultService", _UserName, _Password)
  Catch
    _ci = Nothing
  End Try

  If Not _ci Is Nothing Then
    _ci.ListRepositories(reps)
    theRep = Nothing
    For Each r As VaultRepositoryInfo In reps
      If r.RepName = "TherapeuticResearchNet2" Then
        theRep = r
        Exit For
      End If
    Next

    If Not (theRep Is Nothing) Then
      ' HERE IS WHERE IT HANGS (unless running as a Domain Admin)
      _ci.SetActiveRepositoryID(theRep.RepID, _UserName, theRep.UniqueRepID, True, True)
    End If

    _ci.WorkingFolderOptions.RequireCheckOutBeforeCheckIn = True
    _ci.WorkingFolderOptions.DefaultLocalCopyType = LocalCopyType.Replace

    _ci.Refresh()

    _uid = GetUID()
  End If
End Sub

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by Beth » Wed Jun 02, 2010 3:59 pm

Try using the call to ClientInstance.Init that also takes a disk path and make sure that the account this is running under has full permission to edit that folder.

How large is your repository?
Beth Kieler
SourceGear Technical Support

dprothero
Posts: 44
Joined: Sun Mar 21, 2004 12:18 pm
Location: Stockton California
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by dprothero » Wed Jun 02, 2010 4:17 pm

Adding the path to the call to Init worked! Thanks a lot.

To answer your question about the repository size:

Repository Information:
Revisions: 35930
Folders: 1450 (+2116 deleted)
Files: 18710 (+24012 deleted)
Tree Size: 2.5 GB
Disk Space Needed: 4.99 GB
Database Size: 4.91 GB

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by Beth » Thu Jun 03, 2010 7:13 am

Thanks for the update.
Beth Kieler
SourceGear Technical Support

dprothero
Posts: 44
Joined: Sun Mar 21, 2004 12:18 pm
Location: Stockton California
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by dprothero » Thu Jun 03, 2010 9:35 am

Also, FYI, I can now run the app pool as NETWORK SERVICE again, so long as I grant it access to the folder I pass to the Init function call.

dprothero
Posts: 44
Joined: Sun Mar 21, 2004 12:18 pm
Location: Stockton California
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by dprothero » Thu Jun 03, 2010 9:41 am

Out of curiosity, without specifying the work folder with Init(), where was it trying to create this folder?

dprothero
Posts: 44
Joined: Sun Mar 21, 2004 12:18 pm
Location: Stockton California
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by dprothero » Thu Jun 03, 2010 12:58 pm

OK, the application appears to be working, but since making this change, I'm now seeing the error below in the Windows Application EventLog:

Code: Select all

Log Name:      Application
Source:        Vault Client Simple Logger
Date:          6/3/2010 11:40:54 AM
Event ID:      0
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      [servername omitted by poster]
Description:
Error writing message "After loading from disk on startup, _cmRepository.Repository.Root is null.
   at VaultClientOperationsLib.TreeCache.Load()
   at VaultClientOperationsLib.TreeCache..ctor(Int32 repID, String username, String uniqueRepositoryID, String localStoreBasePath, ClientInstance ci)
   at VaultClientOperationsLib.ClientInstance.SetActiveRepositoryID(Int32 id, String username, String uniqueRepositoryID, Boolean doRefresh, Boolean updateKnownChangesAll)
   at TRC.Vault.Utilities.Login()
   at TRC.Vault.Folder.ConfirmLogin()
   at TRC.Vault.Folder.GetRelease()
   at TRC.UI.Controls.VaultFiles.LoadRootFolder()
   at TRC.UI.Controls.VaultFiles.Init(String IntranetUserID, Boolean LoginVault)
   at WebRoot.OurTeam.Page_Init(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnInit(EventArgs e)
   at System.Web.UI.Page.OnInit(EventArgs e)
   at TRC.UI.BasePage.OnInit(EventArgs e)
   at TRC.UI.IntraNetBasePage.OnInit(EventArgs e)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.intranet_ourteam_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
   at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
   at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
" to log file .  Exception was: Path cannot be null.
Parameter name: path

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: API call to SetActiveRepositoryID hangs

Post by Beth » Thu Jun 03, 2010 3:19 pm

I think it's the appdata folder it was trying to write to before.

The current error looks like it wants to write to a client-log and doesn't have permissions. If it's trying to write under network service, then it's trying to write to %systemroot%\ServiceProfiles\NetworkService.
Beth Kieler
SourceGear Technical Support

Post Reply