Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-5454

Cannot checkout a new branch on another node right after its creation

    XMLWordPrintable

    Details

      Description

      Overview

      Reproduction steps:

      1. The project is on branch master
      2. Create new branch "topic", and observe that a new branch is created as feature/topic
      3. Checkout new branch feature/topic, the checkout is successful
      4. Open a new private browsing window and ensure not landing on the same node.
      5. Go to the same Studio project
      6. Observe error: "The branch "feature/topic" was not found for the current project. Falling back to default branch".

      Datadog Logs:

      • There's no logs available.

      Investigation

      Right after the checkout action at step 3, the user-preference for Mincong Huang is on branch "feature/topic", as we can see in Studio Project document:

      document.xml
          <sp:prefsPerUser>
            <prefs>
              <commitOnSave><![CDATA[false]]></commitOnSave>
              <activeBranch><![CDATA[feature/topic]]></activeBranch>
              <mergeOnCommit><![CDATA[true]]></mergeOnCommit>
              <username><![CDATA[mhuang]]></username>
            </prefs>
          </sp:prefsPerUser>
      

      And the new branch is available in Git server, because I see it in my desktop via Git Access:

      mhuang-SANDBOX (master u=) $ git fetch prod
      remote: Finding sources: 100% (177/177)
      remote: Getting sizes: 100% (136/136)
      remote: Total 177 (delta 0), reused 177 (delta 0)
      Receiving objects: 100% (177/177), 54.28 KiB | 610.00 KiB/s, done.
      From https://connect.nuxeo.com/nuxeo/git/mhuang-SANDBOX
       * [new branch]      feature/topic -> prod/feature/topic
      

      Impact

      If the HTTP request go to a Nuxeo node containing out-dated workspace, it leads to:

      1. Hot reload failure
      2. Nuxeoctl failure
      3. Studio project not loading

      Cause

      In our workspace service, we create WIP branch if not existing. However, it requires that the existence of its feature branch. In our case, the feature branch does not exist.

      WorkspaceServiceImpl.java
          @Override
          public Workspace getWorkspace(String projectId, String branchName)
                  throws ProjectNotFoundException, WorkspaceCreationException, BranchNotFoundException {
              Workspace workspace = getRawWorkspace(projectId);
      
              Branch asBranch = Branch.ofInternalName(branchName);
              if (asBranch.isWorkingBranch()) {
                  Framework.getService(GitService.class).createWIPBranchIfNonExisting(workspace, asBranch);
              }
              return workspace.checkoutOnBranch(asBranch);
          }
      

      Proposals

      Git service should perform a git-fetch when querying the existence the feature branch, to ensure information is up-to-date.

      Framework.getService(GitService.class).createWIPBranchIfNonExisting(workspace, asBranch);
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 30 minutes
                5h 30m