Confused about restart/upgrade w. bundler and symlinks

Carlos Peñas theistian at
Wed Oct 23 08:35:19 UTC 2013


I'm having an issue using unicorn with bundler on a rails ap deployed by

Im using bundler 1.3.5 (tried 1.4rc0 also) I'm deploying with
capistrano, version is irrelevant, the issue hit me when keep releases
is reached and 'current' symlink where "bundle unicorn" process was
initially started.

Im using also unicorn 4.6.3 and ruby 2.0.0, it is a Rails 4 app runing
on linux 3.2 64

I'm restarting with a init.d script which sends a HUP to master (restart) or USR2 (upgrade)

bundled gems are vendorized and stored in a shared location between
deploys. pids and logs also.

In the config have lines for:

Unicorn::HttpServer::START_CTX[0] pointing to the binary in the bundle

and ENV["BUNDLE_GEMFILE"] pointing to "current" path of the gemfile

When a capistrano deploy reach the :keep_releases and deletes a release
directory where unicorn was previously started the master kills all the
workers an the new worker get in a death loop telling that they can not
locate 'rack/builder'.

I traced the process and the diying worker threads are looking for files
in the deleted release directory.

Problem is crystal clear to me. Unix dereferences 'current' directory
and store it in the proc environment so when the referenced directory
dissapear unicorn workers aren't able to locate cwd. But I can't find a
workarround which let me use a deploy tool and bundle to keep project

So What i'm missing? is there a best practice I'm not following?.


Carlos Peñas San José
carlos at

More information about the mongrel-unicorn mailing list