[ARVADOS] created: 1.1.0-45-gea929fb

Git user git at public.curoverse.com
Wed Oct 18 15:38:29 EDT 2017


        at  ea929fb925acea37ca13542569cc183e7170e395 (commit)


commit ea929fb925acea37ca13542569cc183e7170e395
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Oct 18 15:37:54 2017 -0400

    12461: Avoid race bug in Rails file cache.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/api/config/application.rb b/services/api/config/application.rb
index 1fb1189..c09a8e5 100644
--- a/services/api/config/application.rb
+++ b/services/api/config/application.rb
@@ -78,6 +78,9 @@ module Server
       STDERR.puts("Defaulting to memory cache, " +
                   "because #{default_cache_path} #{why}")
       config.cache_store = :memory_store
+    else
+      require Rails.root.join('lib/safer_file_store')
+      config.cache_store = ::SaferFileStore.new(default_cache_path)
     end
   end
 end
diff --git a/services/api/lib/safer_file_store.rb b/services/api/lib/safer_file_store.rb
new file mode 100644
index 0000000..d87b980
--- /dev/null
+++ b/services/api/lib/safer_file_store.rb
@@ -0,0 +1,16 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class SaferFileStore < ActiveSupport::Cache::FileStore
+  private
+  def delete_empty_directories(dir)
+    # It is not safe to delete an empty directory. Another thread or
+    # process might be in write_entry(), having just created an empty
+    # directory via ensure_cache_path(). If we delete that empty
+    # directory, the other thread/process will crash in
+    # File.atomic_write():
+    #
+    # #<Errno::ENOENT: No such file or directory @ rb_sysopen - /.../tmp/cache/94F/070/.permissions_check.13730420.54542.801783>
+  end
+end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list