title: `Errno::EExist` error with sprockets when running rails in dev
body: <p>This has happened to me on multiple occassions now and I was hoping someone could provide some insight into the the following error:</p>
  
  <blockquote>
    <p>Errno::EEXIST at / 
    File exists @ dir_s_mkdir - tmp/cache/assets/sprockets/v3.0/Pd</p>
  </blockquote>
  
  <p>Here's the associated stack trace:</p>
  
  <pre><code>Errno::EEXIST - File exists @ dir_s_mkdir - /home/dev/keithgw-dev/code/myapp/tmp/cache/assets/sprockets/v3.0/Pd:
  () opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
  () opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
  () opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
  () opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
  sprockets (3.6.0) lib/sprockets/cache/file_store.rb:85:in `set'
  sprockets (3.6.0) lib/sprockets/cache.rb:212:in `set'
  sprockets (3.6.0) lib/sprockets/cache.rb:136:in `set'
  sprockets (3.6.0) lib/sprockets/loader.rb:321:in `fetch_asset_from_dependency_cache'
  sprockets (3.6.0) lib/sprockets/loader.rb:44:in `load'
  sprockets (3.6.0) lib/sprockets/cached_environment.rb:20:in `block in initialize'
  sprockets (3.6.0) lib/sprockets/cached_environment.rb:47:in `load'
  sprockets (3.6.0) lib/sprockets/base.rb:66:in `find_asset'
  sprockets (3.6.0) lib/sprockets/base.rb:73:in `find_all_linked_assets'
  sprockets (3.6.0) lib/sprockets/manifest.rb:142:in `block in find'
  sprockets (3.6.0) lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
  sprockets (3.6.0) lib/sprockets/path_utils.rb:223:in `block in stat_tree'
  sprockets (3.6.0) lib/sprockets/path_utils.rb:207:in `block in stat_directory'
  sprockets (3.6.0) lib/sprockets/path_utils.rb:204:in `stat_directory'
  sprockets (3.6.0) lib/sprockets/path_utils.rb:222:in `stat_tree'
  sprockets (3.6.0) lib/sprockets/legacy.rb:105:in `block in logical_paths'
  sprockets (3.6.0) lib/sprockets/legacy.rb:104:in `logical_paths'
  sprockets (3.6.0) lib/sprockets/manifest.rb:140:in `find'
  sprockets-rails (3.0.4) lib/sprockets/railtie.rb:49:in `precompiled_assets'
  sprockets-rails (3.0.4) lib/sprockets/railtie.rb:34:in `asset_precompiled?'
  sprockets-rails (3.0.4) lib/sprockets/railtie.rb:214:in `block (3 levels) in &lt;class:Railtie&gt;'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:345:in `precompiled?'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:349:in `raise_unless_precompiled_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:334:in `find_debug_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:216:in `block in lookup_debug_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:229:in `block in resolve_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:228:in `resolve_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:215:in `lookup_debug_asset'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:157:in `block in stylesheet_link_tag'
  sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:156:in `stylesheet_link_tag'
  () home/dev/keithgw-dev/code/myapp/app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb__3086746537636264556_24830040'
  </code></pre>
  
  <p>It appears it's failing to create a random subdirectory in <code>tmp/cache</code> in order to cache the on the fly compiled assets (I'm running in <code>development</code> mode). However, the directory shown in the error message does <em>not</em> exist. </p>
  
  <p>Clearing the temp cache and restarting rails doesn't resolve the issue. The only way I've been able to get around this is to start another rails application on the same system somewhere else. After that comes up, I kill it and restart the failing app and it works again. There's no real evidence to suggest that's an actual work around or if it's just a coincidence. </p>
  
  <p>Anyways, I would love to hear from anyone else who has experienced this before or if someone might be able to shed some light on why this is happening.</p>
  
  <p>Thanks. </p>
  
  <ul>
  <li>Rails - 4.2.6</li>
  <li>Ruby - 2.2.2</li>
  </ul>