Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6069

java.io.IOException: Permission denied from MarkerFileExclusiveReadLockStrategy.acquireExclusiveReadLock on NAS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.10.3
    • 2.10.4, 2.11.0
    • camel-core
    • None
    • Unknown

    Description

      We recently upgraded to 2.10.x and discovered that the file poller no longer works on our NAS. We have hit similar issues with other open source libraries in the past.

      The problem occurs when MarkerFileExclusiveReadLockStrategy.acquireExclusiveReadLock is called and tries to create the new file. This actually works but also results in a Permission denied IOException (strange but true).

      A simple fix for this is to change the acquireExclusiveReadLock method as follows.

          public boolean acquireExclusiveReadLock(GenericFileOperations<File> operations,
                                                  GenericFile<File> file, Exchange exchange) throws Exception {
              String lockFileName = getLockFileName(file);
              LOG.trace("Locking the file: {} using the lock file name: {}", file, lockFileName);
      
              // create a plain file as marker filer for locking (do not use FileLock)
              File lock = new File(lockFileName);
              boolean acquired = false;
              try
              {
                  acquired = lock.createNewFile();
              }
              catch (IOException e)
              {
                  if (lock.exists())
                  {
                      acquired = true;
                  }
                  else
                  {
                      throw e;
                  }
              }
      
              return acquired;
          }
      

      Note the same problem occurring with Spring Batch can be found here

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            andersmholmgren Anders Holmgren
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: