[Swift-devel] Re: some racelike condition on file stagein

Mihael Hategan hategan at mcs.anl.gov
Wed Feb 27 09:33:36 CST 2008


Right. The same problem likely applies to gridftp.

On Wed, 2008-02-27 at 14:07 +0000, Ben Clifford wrote:
> File.mkdirs() is not thread-safe, according to typing "threadsafe java 
> mkdirs" into google.
> 
> I applied the below patch to my cog checkout and the error goes away for 
> me. However, I'm not a cog developer, so someone else needs to fix this in 
> the CoG SVN.
> 
> Index: cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java
> ===================================================================
> --- cog.orig/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java	2007-08-27 09:30:23.000000000 +0100
> +++ cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java	2008-02-27 13:51:42.000000000 +0000
> @@ -146,15 +146,19 @@
>          }
>      }
>  
> +static Object mkdirlock = new Object();
> +
>      public void createDirectories(String directory)
>              throws FileResourceException {
>          if (directory == null || directory.equals("")) {
>              return;
>          }
>          File f = resolve(directory);
> +        synchronized(mkdirlock) {
>          if (!f.mkdirs() && !f.exists()) {
>              throw new FileResourceException("Failed to create directory: " + directory);
>          }
> +        }
>      }
>  
>      public void deleteDirectory(String dir, boolean force) throws FileResourceException {
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> 




More information about the Swift-devel mailing list