Mysql2 3.0.x: Waiting for a result... 26 Sep 2011
Upgrading a Rails 3.0.x app to Rails 3.1 uncovered an issue with the mysql2 gem when it comes to running features that rely on an external process like Selenium or Webkit. You can install the activerecord-mysql2-retry-ext gem to work around it until it gets resolved in mysql2 itself.

Liquid error: No such file or directory - posix_spawnp

The error we got intermittently got with mysql2 and Rails 3.1 was this:

Liquid error: No such file or directory - posix_spawnp

Sadly, this issue with the mysql2 gem has been known about since December 2010. It appears it may have been fixed as the issue was closed on June 17, 2011, but it needs to be re-opened as it is happening again. This issue has also been reported against capybara-webkit.

This issue is with mysql2 version 3.0.7 (if failed with other 3.0.x gems I could get my hands on as well). I tried downgrading to the previous mysql2 gem we had installed, but it is not compatible with ActiveRecord 3.1.0.

The activerecord-mysql2-retry-ext gem is a quick work around until the actual issue can be fixed in the mysql2 gem. Update your Gemfile:

Liquid error: No such file or directory - posix_spawnp

The work around in the gem retries executed queries up to 5 times if they raise an exception before giving up and re-raising the exception to your code. You do not need to change any of your code, just install the gem. It has worked great on our project, but YMMV.

This gem should not be used run in production.