RMagick loading EPS files, trouble with Ghostscript?

Hi,

I have GraphicsMagick and RMagick installed on OS X along with
ghostscript to act as the postscript delegate for GM. All latest
versions.

If I run…

im = Magick::Image::read("/testbarcode.eps").first

within script/console it returns fine. However the same line in my
rails controller only seems to work very intermittently. Usually in
small consecutive runs but then broken for the next however many
requests until it decides it wants to work again.

When it fails, the output in the browser advise “Postscript delegate
failed” and Mongrel running the app in development mode outputs the
following to the console.

/usr/local/lib/ruby/gems/1.8/gems/transaction-simple-1.4.0/lib/
transaction/simple.rb:46: warning: already initialized constant
Messages
/usr/local/lib/ruby/gems/1.8/gems/transaction-simple-1.4.0/lib/
transaction/simple.rb:53: warning: already initialized constant
TRANSACTION_SIMPLE_VERSION
/usr/local/lib/ruby/gems/1.8/gems/transaction-simple-1.4.0/lib/
transaction/simple.rb:436: warning: already initialized constant
SKIP_TRANSACTION_VARS

Magick: “gs” -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=pnmraw
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -g147x100 -r72x72 -
sOutputFile=/var/tmp/gmmrDOYU – “/var/tmp/gmspCKzg” -c quit
(terminated due to signal 26).

Magick: “gs” -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=pnmraw
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -g147x100 -r72x72 -
sOutputFile=/var/tmp/gmmrDOYU – “/var/tmp/gmspCKzg” -c quit
(terminated due to signal 26).

It seems as if something is being locked or some resource is tied up
and it only starts working again when something times out. It is also
strange that outside of the ActionController it seems to work as
expected. Closing and restarting Mongrel seems to have little effect.

Does anyone have any ideas why this might be happening?

Thanks, Andrew.