Cannot run shell scripts (cannot allocate memory)

I’m running a Rails application with Tomcat and I keep getting this
error:

IOError in Admin/profilesController#update

Cannot run program “/bin/sh” (in directory
“/opt/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF”): java.io.IOException:
error=12, Cannot allocate memory

It doesn’t happen all the time, but keeps coming back if the app has
been
running for some time. I run Tomcat with the following options:
‘-Xmx384M
-Xms384M -XX:MaxPermSize=192M’. I tried to give it more memory but it
doesn’t help much. And when this happens there’s still a couple hundred
MB
free memory on the system.

The app runs external tools on a regular basis (imagemagick (paperclip),
indexer (sphinx), new relic rpm) so its essential for me to get this
working. Are there any magical ways to let java run these programs?

LacKac

László Bácsi wrote:

I’m running a Rails application with Tomcat and I keep getting this error:

IOError in Admin/profilesController#update

Cannot run program “/bin/sh” (in directory
“/opt/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF”): java.io.IOException:
error=12, Cannot allocate memory

This error means that it’s unable to open a new IO. Is it possible
you’re leaking IO instances and not closing them? Be sure to close them
yourself, since otherwise they won’t close until GC runs, which may not
be soon enough if you’re spinning up lots of IOs.

If you’re sure you’re closing them, there could be a leak in something
outside your code.

Can you mail the full trace as well? Maybe we can add better logging for
these cases.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email