Hey,
This problem is due to the fact you are caching the database connection. If the db connection is lost the cached connection is invalid and results, in my case in a mysql error 'server has gone away'.
my $database = $self->plugin_database($self->db_connection_name);
fixes the problem.
Cheer,
Kiel