Unicorn tempfile chown problem with Ruby 1.9

Andreas Neuhaus zargony at gmail.com
Sat Jun 19 09:38:36 EDT 2010

Hi Eric,

>> /usr/local/rvm/gems/ruby-1.9.2-preview3/gems/unicorn-1.0.0/lib/unicorn.rb:189:in
>> `chown': No such file or directory - /tmp/0.8216141026704238
>> (Errno::ENOENT)

> This is a bug in Ruby and I've filed a report and patch in Redmine:
>  http://redmine.ruby-lang.org/issues/show/3451

Thanks. I started to watch that ticket to see where it goes. In the
meantime, I tried to workaround the problem by telling unicorn to
chown the tempfile before it's unlinked (which looks like it works
fine for now). http://gist.github.com/444901

> Unicorn needs to fchmod(2) it as the regular user for the heartbeat
> functionality to work (master process continues to run as root
> if started as root).
> Is Unicorn actually able to serve requests when you removed tmp.chown?
> Under Linux, fchmod() doesn't work without ownership of the file.

You're right, it doesn't work if tmp.chown is removed. For
convenience, I always tried it on my local machine as a user and
chown'ed to my own user to trigger the problem. This way I could test
things without running it as root. When running unicorn with tmp.chown
removed as root, it throws EPERM errors as you expected.

Andreas Neuhaus

More information about the mongrel-unicorn mailing list