Carson Reinke's (🚗☀☔🔑) Blog

mysql2 - undefined method `each' for nil:NilClass Within Resque

Came across this problem, and finally figured out what is causing this (well in my case).  Sending a SIGUSR1 to the worker, terminates the child process, however, it seems to leave mysql2 connection sometimes in a bad state.  The next job that is started by the worker cannot use mysql2 properly, but the job after works without issue.  I just switched to using a SIGTERM instead, so the entire worker will be restarted fresh.

resque - mysql2