You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Maria Iracheta (JIRA)" <ji...@apache.org> on 2011/03/18 15:10:29 UTC

[jira] Created: (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
-----------------------------------------------------------------------------------------------

                 Key: CAMEL-3789
                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.6.0
            Reporter: Maria Iracheta


MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 

The MarkerFileExclusiveReadLockStrategy uses global variables: 
private File lock; 
private String lockFileName; 
and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 

If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-3789:
----------------------------------

    Assignee: Claus Ibsen

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>            Assignee: Claus Ibsen
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch, MarkerFileExclusiveReadLockStrategyTest.java
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Patch Info: [Patch Available]

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch, MarkerFileExclusiveReadLockStrategyTest.java
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Attachment: MarkerFileExclusiveReadLockStrategy.java.patch

This readLockStrategy was not thread-safe. It was unlocking the last File that had been locked. Now each of the methods recreates the lock file based on the input attributes

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: MarkerFileExclusiveReadLockStrategy.java.patch
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Attachment: FileOperations.java.patch

The method buildDirectory was not Thread Safe at the point of trying to create the directory.

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: FileOperations.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Attachment: GenericFileDeleteProcessStrategy.java.patch

The method begin was calling super.begin and passing the original File instead of the renamed File. But in the rollback and the commit methods the file passed is the renamed File. So in the begin method we are using the original file but in rollback and commit we are using the renamed File.

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Attachment: GenericFileRenameProcessStrategy.java.patch

The method begin was calling super.begin and passing the original File instead of the renamed File. But in the rollback and the commit methods the file passed is the renamed File. So in the begin method we are using the original file but in rollback and commit we are using the renamed File.

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Maria Iracheta (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maria Iracheta updated CAMEL-3789:
----------------------------------

    Attachment: MarkerFileExclusiveReadLockStrategyTest.java

Junit class to test the MarkerFileExclusiveReadLockStrategy in a multithreaded scenario

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch, MarkerFileExclusiveReadLockStrategyTest.java
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3789.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.8.0

Thanks for the patch.

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>            Assignee: Claus Ibsen
>             Fix For: 2.8.0
>
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch, MarkerFileExclusiveReadLockStrategyTest.java
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAMEL-3789) org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CAMEL-3789:
-------------------------------

    Fix Version/s: 2.7.3

> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3789
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3789
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.6.0
>            Reporter: Maria Iracheta
>            Assignee: Claus Ibsen
>             Fix For: 2.7.3, 2.8.0
>
>         Attachments: FileOperations.java.patch, GenericFileDeleteProcessStrategy.java.patch, GenericFileRenameProcessStrategy.java.patch, MarkerFileExclusiveReadLockStrategy.java.patch, MarkerFileExclusiveReadLockStrategyTest.java
>
>
> MarkerFileExclusiveReadLockStrategy is not thread-safe. When I run  a File endpoint with more than one thread the MarkerFileExclusiveReadLockStrategy only deletes the last file to start being processed. 
> The MarkerFileExclusiveReadLockStrategy uses global variables: 
> private File lock; 
> private String lockFileName; 
> and gives them values on the acquireExclusiveReadLock method. When another thread calls the releaseExclusiveReadLock method it uses the global variables to delete the locked file. That means that if another thread came and called the acquireExclusiveReadLock it would have changed the values on the global variables. 
> If lock and lockFileName are not global variables the problem seems to disappear and I can a multithreaded File endpoint and not locked file is left undeleted. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira