Not all mongrel starting (Errno:EEXIST)

I’m playing with the mongrel clustering, and am having a problem getting
2
mongrels to start up reliably.

This should be a pretty simple cluster, with just 2 instances running.
My
mongrel config (mongrel_cluster.yml) looks like:

cwd: /deployment/installed/myapp/current
log_file: log/mongrel.log
port: “8000”
environment: production
address: 127.0.0.1
pid_file: tmp/pids/mongrel.pid
servers: 2

When I start up the pack with the command:

mongrel_rails cluster::start -C
/deployment/installed/myapp/current/config/mongrel_cluster.yml

I see (with a quick ps) two mongrels, one of which then dies with the
follow
error in the log file:

** Daemonized, any open files are closed. Look at
tmp/pids/mongrel.8000.pid
and log/mongrel.8000.log for info.
** Starting Mongrel listening at 127.0.0.1:8000
** Starting Rails with production environment…
deployment/installed/ruby/lib/ruby/1.8/fileutils.rb:243:in `mkdir’: File
exists -
/deployment/installed/myapp/releases/20080130211150/public/bundles
(Errno::EEXIST)

    from /deployment/installed/ruby/lib/ruby/1.8/fileutils.rb:243:in

fu_mkdir' from /deployment/installed/ruby/lib/ruby/1.8/fileutils.rb:172:inmkdir’
from /deployment/installed/ruby/lib/ruby/1.8/fileutils.rb:171:in
each' from /deployment/installed/ruby/lib/ruby/1.8/fileutils.rb:171:inmkdir’
from
/deployment/installed/myapp/releases/20080130211150/vendor/plugins/bundled_resource-
0.9/lib/bundled_resource.rb:38:in `create_public_bundle_directory’

    from /deployment/installed/myapp/

/releases/20080130211150/vendor/plugins/bundled_resource-0.9/init.rb:57:in
`evaluate_init_rb’

    from 

deployment/installed/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/rails/plugin.rb:79:in
evaluate_init_rb' from /deployment/installed/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/core_ext/kernel/reporting.rb:11:insilence_warnings’

     ... 21 levels...
    from 

/deployment/installed/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/command.rb:212:in
run' from /deployment/installed/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3 /bin/mongrel_rails:281 from /deployment/installed/ruby/bin/mongrel_rails:19:inload’
from /deployment/installed/ruby/bin/mongrel_rails:19

It looks to me as if both mongrels are starting up, but the deployment
of
the “bundled_resource” from each mongrel is ending up with the app
stomping
on itself.

I’ve not found any indication of a similar problem searching the net, or
the
forums (or the bug tracker).
Has anybody else seen similar behavior? Is there a workaround
available?

Thanks!

john

BTW: my currently isntalled gems include:

bash-2.05b$ gem list

*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
capistrano (2.1.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.9)
fastthread (1.0.1)
gem_plugin (0.2.3)
highline (1.4.0)
mongrel (1.1.3)
mongrel_cluster (1.0.5)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (2.0.2)
rake (0.8.1)

Sounds like an issue with the bundled_resource plugin, not mongrel.

The plugin should probably be checking for the existence of a directory
before trying to create it.

==
Will G.

I used bundled resources sometimes ago and I have same problem (I
think).

I read init.rb and I commented lines 54…57 (create bundle directory and
copy resources).

Regards!

John Woodward escribió:

Thanks for the replies; late yesterday, I went digging some more and it
really is an issue with bundle_resources (does anyone still use this? …
I’m
pretty new to Ruby on Rails). bundle_resources attempts to create a
directory and then copy jsps, etc., to that directory, at every startup
of
the app. So … with multiple Mongrel processes, of course it fails on
the
second process when it collides with the first. Nasty.

I’ll either remove bundle_resources, or apply some sort of patch to it.

Thanks!

john

2008/1/31 Rafael G. [email protected]: