Trinidad + “SEVERE: A child container failed during start”
If you're using Trinidad to run your JRuby/Rails application and you get SEVERE: A child container failed during start its likely that the JVM isn't getting enough memory. Maybe you're using Spring and a host of other jars that your application relies upon. You can get around this by running:
# shell jruby -J-Xmx1024m -S trinidad
So how do you do this in a production environment? You could of course pass along the same command line options, or for better configuration management you can use the Trinidad Daemon extension.
# ./Gemfile ⋮ gem 'trinidad' gem 'trinidad_daemon_extension' gem 'trinidad_logging_extension' # optional, hah! who're we kidding? ⋮
And then some configuration options:
# ./config/trinidad.yml jruby_max_runtimes: 1 # also enables threadsafe by convention libs_dir: lib # by default this is lib/jars - but if you're coming from Warbler you might be accustomed to /lib extensions: logging: # logging always a good idea config: lib/resources/log4j.properties logging_system: log4j daemon: jvm_args: '-Xmx1024m'
Now just jruby -S trinidad for your production environment or your dev workstations and the configuration environment will be the same. And if you've setup everything correctly you can still be rails s which also means your Spork/Guard/RSpec world will continue to function as well.