Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21738

Build plan build summary page gets extremely slow when commits have large messages

    XMLWordPrintable

Details

    Description

      Issue Summary

      The Bamboo plan build summary page gets extremely slow when large commit messages are used on builds

      This is reproducible on Data Center: Yes

      Steps to Reproduce

      1. Create a plan and add a VCS repository to it
      2. Add test.txt
      3. Enable repository trigger
      4. Add some quiet period to the repository (I used 10 x 6)
      5. Run this script. It will commit a small file with a huge commit message many times in a short period of time
        $ for i in {1..10} ; do 
            for i in {1..5} ; do 
              date > test.txt ; git commit -q -m "$(shuf -n 90000 /usr/share/dict/words | fmt -w 72)" test.txt ; sleep 1 ; 
            done ; 
          git push ; done
        
      6. Test Bamboo UI interaction whilst accessing the Build summary page and notice slowness
        18 seconds do load the page
        2022-05-12 22:35:14,793 INFO [https-jsse-nio-45821-exec-3] [AccessLogFilter] ealvarenga GET https://bamboo821.mydomain.net/chain/viewChain.action?planKey=GB-GB 1375658kb
        (...)
        2022-05-12 22:35:43,244 DEBUG [https-jsse-nio-45821-exec-29] [AccessLogFilter] END: 200 ealvarenga GET https://bamboo821.mydomain.net/ajax/planStatusHistoryNeighbouringSummaries.action?planKey=GB-GB&_=1652358839372 1540260kb-448509kb 18165ms
        

      Expected Results

      The page should load within an acceptable period of time (a few seconds only). Large commit messages should be suppressed/trimmed when retrieved and shown on the UI.

      Actual Results

      The page load is very slow. Browser locks up when hovering the mouse over "Change by" whilst accessing "<Bamboo_URL>/build/ajax/viewBuildCommits.action?buildKey=PROJ-KEY&buildNumber=16" due to the large results

      Workaround

      This will alter the database and modify commit messages on the USER_COMMIT table. This workaround will only change the Bamboo Database. It will not modify the original commits stored on the Repository. Make sure to have a full backup of your Bamboo DB and <bamboo_home> and <bamboo_install> folders before attempting any changes. The following instructions are for PostgreSQL. Queries may vary depending on your Database product.

      1. Build key used on this example = GB-GB. You need to replace it with your equivalent PROJ-PLAN key
      2. Select the large commit messages so you know what commits are impacting your system
        SELECT BRS.BUILD_KEY,
               Length(UC.COMMIT_COMMENT_CLOB),
               Substring(UC.COMMIT_COMMENT_CLOB FROM 0 FOR 50) commit_comment_clob,
               UC.COMMIT_ID,
               UC.REPOSITORY_CHANGESET_ID,
               UC.AUTHOR_ID,
               UC.COMMIT_DATE,
               UC.COMMIT_REVISION
        FROM   USER_COMMIT UC
               JOIN REPOSITORY_CHANGESET RS
                 ON RS.REPOSITORY_CHANGESET_ID = UC.REPOSITORY_CHANGESET_ID
               JOIN BUILDRESULTSUMMARY BRS
                 ON BRS.BUILDRESULTSUMMARY_ID = RS.BUILDRESULTSUMMARY_ID
        WHERE  BRS.BUILD_KEY LIKE 'GB-GB%'
        ORDER  BY Length(UC.COMMIT_COMMENT_CLOB) DESC
        
      3. Add a temporary table that will be used as the new commit message. In this case, I am keeping the first 1000 characters of the commit message by using the PostgreSQL Substring function. Users can choose to remove even more (or less) characters by adjusting the Substring function call, or simply add a static text or even an empty string
        CREATE TEMPORARY TABLE TEMP_UC_LARGER_THAN_1000_CHARS AS
          (SELECT BRS.BUILD_KEY,
                  Substring(UC.COMMIT_COMMENT_CLOB FROM 0 FOR 1000) COMMIT_COMMENT_CLOB,
                  UC.COMMIT_ID
           FROM   USER_COMMIT UC
                  JOIN REPOSITORY_CHANGESET RS
                    ON RS.REPOSITORY_CHANGESET_ID = UC.REPOSITORY_CHANGESET_ID
                  JOIN BUILDRESULTSUMMARY BRS
                    ON BRS.BUILDRESULTSUMMARY_ID = RS.BUILDRESULTSUMMARY_ID
           WHERE  Length(COMMIT_COMMENT_CLOB) > 1000
                  AND BRS.BUILD_KEY LIKE 'GB-GB%') 
        
      4. Check the results in the temporary table and visualise the new suggested commit messages
        SELECT *
        FROM   TEMP_UC_LARGER_THAN_1000_CHARS
        
      5. Update the USER_COMMIT table with the updated commit messages
        UPDATE USER_COMMIT
        SET    COMMIT_COMMENT_CLOB = TEMP_UC_1000.COMMIT_COMMENT_CLOB
        FROM   TEMP_UC_LARGER_THAN_1000_CHARS TEMP_UC_1000
        WHERE  TEMP_UC_1000.COMMIT_ID = USER_COMMIT.COMMIT_ID 
        
      6. Drop the temporary table
        DROP TABLE TEMP_UC_LARGER_THAN_1000_CHARS
        
      7. Validate the Bamboo UI and confirm the responsiveness of the build results page loading

      Attachments

        Issue Links

          Activity

            People

              mgardias Marcin Gardias
              73868399605e Eduardo Alvarenga
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: