Uploaded image for project: 'Confluence Server and Data Center'
  1. Confluence Server and Data Center
  2. CONFSERVER-16765

Spurious error message in the logs when generating thumbnails

    XMLWordPrintable

Details

    Description

      A lot of entries of the following error message being logged in the Confluence log file:

      2009-08-05 05:57:53,778 ERROR [TP-Processor125] [confluence.pages.thumbnail.DefaultThumbnailManager] getThumbnailsFolder Containing folders /sbclocal/confluence-data/xldn1324pap/confluence-2.10.2-home/thumbnails/147733919 for the attachment FXLM TB.jpeg could not be created

      The thumbnail folders referenced in the error messages do exist on the server and contain the thumbnails.

      As per Don's comment:

      The code producing the error message is like this:

      //...
              File thumbnailsFolder = new File(getThumbnailPath() + attachment.getContent().getId());
      
              if (!thumbnailsFolder.exists())
              {
                  boolean result = thumbnailsFolder.mkdirs();
                  if (!result)
                      log.error("Containing folders " + thumbnailsFolder.getAbsolutePath() + " for the attachment " + attachment.getFileName() + " could not be created");
              }
      

      I've noticed that in at least some cases of the error message there are multiple occurrences, for different files, in the same page. Note that the folder for the attachment is the folder for the page the attachment is on not necessarily the page being viewed.

      My theory is that there's a race condition happening here and hence a spurious error message. I'll comment the code appropriately.

      //...
              // Two threads get here at about the same time.
              File thumbnailsFolder = new File(getThumbnailPath() + attachment.getContent().getId());
      
              // Both threads get here and the folder doesn't exist.
              if (!thumbnailsFolder.exists())
              {
                  // So both threads get here and the folder doesn't exist.  So they both try to create the directory.
                  boolean result = thumbnailsFolder.mkdirs();
                  // One thread creates the folder successfully, so we never hear about that one.  
                  // The other thread hasn't created the folder though.  It was already created before it tried.  So it logs an error.
                  if (!result)
                      log.error("Containing folders " + thumbnailsFolder.getAbsolutePath() + " for the attachment " + attachment.getFileName() + " could not be created");
              }
      

      The spurious error message could be dropped by modifying the code to :

      //...
              File thumbnailsFolder = new File(getThumbnailPath() + attachment.getContent().getId());
      
              if (!thumbnailsFolder.exists())
              {
                  boolean result = thumbnailsFolder.mkdirs();
                  if (!result && !thumbnailsFolder.exists())
                      log.error("Containing folders " + thumbnailsFolder.getAbsolutePath() + " for the attachment " + attachment.getFileName() + " could not be created");
              }
      

      Or it could just be dropped. Note that this error would not be given if the confluence user had no filesystem permission. A SecurityException would be thrown instead.

      Attachments

        Issue Links

          Activity

            People

              sday@atlassian.com Samuel Day (Inactive)
              ganand Gurleen Anand [Atlassian]
              Votes:
              17 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: