Unicorn tempfile chown problem with Ruby 1.9

Andreas Neuhaus zargony at gmail.com
Fri Jun 18 20:19:18 EDT 2010

Hi everybody,

I ran into a problem with unicorn today. Using Ruby 1.9.2-preview3
(compiled by rvm) and a unicorn config that has a "user" statement to
let workers run under a different user, unicorn fails to start any
worker process:

`chown': No such file or directory - /tmp/0.8216141026704238
	from /usr/local/rvm/gems/ruby-1.9.2-preview3/gems/unicorn-1.0.0/lib/unicorn.rb:189:in
	from /usr/local/rvm/gems/ruby-1.9.2-preview3/gems/unicorn-1.0.0/lib/unicorn.rb:664:in
	from /usr/local/rvm/gems/ruby-1.9.2-preview3/gems/unicorn-1.0.0/lib/unicorn.rb:681:in
	from /usr/local/rvm/gems/ruby-1.9.2-preview3/gems/unicorn-1.0.0/lib/unicorn.rb:598:in
`block (2 levels) in spawn_missing_workers'

>From what I see, Worker#user tries to chown the unlinked worker
tempfile (in unicorn.rb:189), which fails with Ruby 1.9.2, but seems
to work fine with Ruby 1.8.7. The problem happened to me on an Ubuntu
server, but I was able to reproduce it locally on OSX.

How to reproduce:
- create a simple rack app, like
class Hello; def call (env); [200, { 'Content-Type' => 'text/plain' },
['Hello!']]; end; end
run Hello.new
- create a unicorn.conf.rb with a user statement that switches to the
current user
user 'andy'
- run "unicorn -c unicorn.conf.rb" on Ruby 1.9.2
- watch workers failing to start

I'm not that deep into unicorn's internals, but since the worker
tempfile is unlinked anyway, does it actually make sense to still call
chown on it? Removing tmp.chown in Worker#user solved this for me.

Please cc replies since I'm not subscribed to the list, thanks.

Andreas Neuhaus

More information about the mongrel-unicorn mailing list