Dir.mktmpdir intermittently getting "permission denied" on JRuby #312

myronmarston opened this Issue Nov 14, 2011 · 6 comments


None yet

4 participants

I use Dir.mktmpdir in some tests to have an isolated directory where files are written so that each test is isolated and doesn't affect the others. I've been getting intermittent JRuby build failures with a "permission denied" error (see the output below).

Interestingly, enough, half of the last 10 JRuby builds have failed with this error, and half have passed--so it's very intermittent.

  • 264: failed (ruby1.worker.travis-ci.org:worker-3)
  • 265: passed (ruby1.worker.travis-ci.org:worker-2)
  • 266: passed (ruby1.worker.travis-ci.org:worker-5)
  • 267: passed (ruby3.worker.travis-ci.org:worker-4)
  • 268: passed (ruby3.worker.travis-ci.org:worker-5)
  • 269: passed (ruby1.worker.travis-ci.org:worker-4)
  • 270: failed (ruby1.worker.travis-ci.org:worker-1)
  • 271: failed (ruby3.worker.travis-ci.org:worker-3)
  • 272: failed (ruby1.worker.travis-ci.org:worker-3)
  • 273: failed (ruby2.worker.travis-ci.org:worker-2)

The fact that it's a permissions error suggests to me that maybe it's an issue with certain vagrant VMs?

701) VCR::Cassette::Migrator migrates a cassette from the 1.x to 2.x format
71Failure/Error: Dir.mktmpdir do |dir|
73Permission denied - /tmp/d20111114-30641-133j25z/.
74# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
762) VCR::Cassette::Migrator ignores files that are empty
77Failure/Error: Dir.mktmpdir do |dir|
79Permission denied - /tmp/d20111114-30641-16fznsu/.
80# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
823) VCR::Cassette::Migrator ignores URIs that have sensitive data substitutions
83Failure/Error: Dir.mktmpdir do |dir|
85Permission denied - /tmp/d20111114-30641-1bd1a6t/.
86# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
884) VCR::Cassette::Migrator ignores files that do not contain arrays
89Failure/Error: Dir.mktmpdir do |dir|
91Permission denied - /tmp/d20111114-30641-rcyzvn/.
92# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
945) VCR::Cassette::Migrator ignores files that contain YAML arrays of other things
95Failure/Error: Dir.mktmpdir do |dir|
97Permission denied - /tmp/d20111114-30641-12rff5/.
98# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
1006) VCR::Cassette::Migrator with syck behaves like ignoring invalid YAML ignores files that cannot be parsed as valid YAML (such as ERB cassettes)
101Failure/Error: Dir.mktmpdir do |dir|
103Permission denied - /tmp/d20111114-30641-1hy17ye/.
104Shared Example Group: "ignoring invalid YAML" called from ./spec/vcr/cassette/migrator_spec.rb:171
105# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
1077) VCR::Cassette::Migrator with psych behaves like ignoring invalid YAML ignores files that cannot be parsed as valid YAML (such as ERB cassettes)
108Failure/Error: Dir.mktmpdir do |dir|
110Permission denied - /tmp/d20111114-30641-pr5x56-1/.
111Shared Example Group: "ignoring invalid YAML" called from ./spec/vcr/cassette/migrator_spec.rb:180
112# ./spec/vcr/cassette/migrator_spec.rb:90:in `(root)'
114Finished in 28.73 seconds
115720 examples, 7 failures, 1 pending

We set JRUBY_OPTS to "cext.enabled=false". It used to be "native.enabled=false". If this was a permission issue, all your Rubies would fail with exactly the same exception, not just JRuby. Please report this to the JRuby team.


Looking at the log it may be that

  1. JRuby implementation of Dir.mktmpdir fails to create temp directory
  2. JRuby implementation of Dir.mktmpdir does create a new temp directory but sets incorrect permissions on it so one of the subsequent operations fails.
  • JIRA issue 5678 seems related, September 2011
  • JIRA issue 6178 seems to be the same as yours (we also use standard /tmp mount without any modifications on Ruby workers)

Thanks, it looks like those issues are indeed related. I can manage my test directly sandbox in a different way, and that should fix it.

ldonnet commented Jul 10, 2013


I use travis to build an opensource project https://travis-ci.org/dryade/chouette2.
But my spec fails in jruby18mode and ruby 1.8.7 when I created a temporary directory () :

  1) Chouette::Kml::Exporter#export should return a zip file with nothing inside with no objects in arguments
     Failure/Error: subject.export(zip_file_path, {:export_id => 1, :o => "line"} )
       cannot generate tempfile `/home/travis/build/dryade/chouette2/tmp/exports/test.zip20130710-5705-1r5zdus-9'
     # ./app/exporters/chouette/kml/exporter.rb:81:in `export'
     # ./app/exporters/chouette/kml/exporter.rb:27:in `export'
     # ./spec/exporters/chouette/kml/exporter_spec.rb:22

On my laptop with a debian testing ( jessy ) the spec don't failed. Have you find a way to avoid or bypass this problem?

Thanks for your help


Does the directory tmp/exports exists in your repository or is it created during the build?

@BanzaiMan BanzaiMan pushed a commit to travis-ci/apt-package-whitelist that referenced this issue Jul 23, 2015
Travis CI APT package tester Add python-ldap to ubuntu-precise; resolves travis-ci/travis-ci#312 29549e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment