You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Michael Herrmann (Updated) (JIRA)" <se...@james.apache.org> on 2011/10/07 16:21:29 UTC

[jira] [Updated] (JAMES-1327) FileSystemBlobStrategy#getFile(ActiveMQBlobMessage) is not thread safe (throws "java.io.IOException: Unable to create directory")

     [ https://issues.apache.org/jira/browse/JAMES-1327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Herrmann updated JAMES-1327:
------------------------------------

    Attachment: JAMES-1327.patch

Patch attached :)
                
> FileSystemBlobStrategy#getFile(ActiveMQBlobMessage) is not thread safe (throws "java.io.IOException: Unable to create directory")
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JAMES-1327
>                 URL: https://issues.apache.org/jira/browse/JAMES-1327
>             Project: JAMES Server
>          Issue Type: Bug
>          Components: Queue
>    Affects Versions: 3.0-beta3
>         Environment: At least Windows and Linux. 
>            Reporter: Michael Herrmann
>         Attachments: JAMES-1327.patch
>
>
> Consider org.apache.james.queue.activemq.FileSystemBlobStrategy#getFile(ActiveMQBlobMessage):
>     protected File getFile(ActiveMQBlobMessage message) throws JMSException, IOException {
>         ...
>         // check if we need to create the queue folder
>         if (queueF.exists() == false) {
>             if (!queueF.mkdirs()) {
>                 throw new IOException("Unable to create directory " + queueF.getAbsolutePath());
>             }
>         }
>         ...
>     }
> Suppose this method is called from two threads. If both threads get past the condition
>         if (queueF.exists() == false),
> then the first one will create queueF. For the second, queueF.mkdirs() will then return false, which leads to an IOException even though everything is fine. I think the condition should be replaced by
>         if (!queueF.mkdirs() && !queueF.exists()).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org