Open akshah123 opened 9 years ago
What happens if you use the 'direct' spawning method? Does that fix the problem?
Same issue.
Try setting reconnect: true
in your database.yml (or other configuration file / connection code). I suspect that, for indirectly related reasons, in the rackup case you're getting a fresh database handle whereas passenger is keeping the same application process alive and thus you have a broken handle.
Hello,
I have run into a problem where once its triggered, all subsequent calls that make query fail with " closed MySQL connection" error.
Here are the condition/steps to reproduce it.
Stack: nginx, passenger, mysql
Have an api/webserver that uses activerecord with mysql2 adapter. Issue a call to the api that generates a db query larger than max_allowed_packet size for your database.
The query fails with the error. The connection is no longer valid. All subsequent api/webserver calls that make db query and use that connection from connection pool fail with error " Mysql2::Error: closed MySQL connection".
This only happens when passenger is in play. When I use rackup, the first query fails as it should, however subsequent queries are just fine.
I am certainly going to fix the first error but it is possible that such an error could be triggered by other actions and so would like to avoid a situation where one call could potentially take down other calls as well.
Any help is greatly appreciated.