Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-17951

TransientStore caching directory lazy initialization crashes if accessed by multiple threads

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.4

      Description

      Typically when using Drag and Drop just after server startup: caching directory has not been initialized and several threads will pass the data.exists() clause in the code below and try to simultaneously delete the directory.

          protected File getCachingDirectory() {
              if (cacheDir == null) {
                  File data = new File(Environment.getDefault().getData(), config.getName());
                  if (data.exists()) {
                      try {          
                          FileUtils.deleteDirectory(data);
                      } catch (IOException cause) {
                          throw new RuntimeException("Cannot create cache dir " + data, cause);
                      }
      
                  }
                  data.mkdirs();
                  return cacheDir = data.getAbsoluteFile();
              }
              return cacheDir;
          }
      

      This leads to errors like:

      ava.lang.IllegalArgumentException: /home/ataillefer/nuxeo/test/nuxeo-cap-7.4-SNAPSHOT-tomcat/nxserver/data/default/YmF0Y2gtMTQ0MjkzODkxNjM4NS02NDJfMw== is not a directory
             at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1642)
             at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
             at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
             at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
             at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
             at org.nuxeo.ecm.core.transientstore.AbstractTransientStore.getCachingDirectory(AbstractTransientStore.java:209)
      
      Caused by: java.io.FileNotFoundException: File does not exist: /var/lib/nuxeo/default/YmF0Y2gtMTQ0MjkzMDk1ODI3NC0zNzBfMA==
      at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2275)
      at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
      at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
      at org.nuxeo.ecm.core.transientstore.AbstractTransientStore.getCachingDirectory(AbstractTransientStore.java:206)
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: