Running a simple query results in bad gateway

I have to equal databases, 1 in production and 1 in test and in the test database every time it runs a query it brokes. It doesnt matter which query

@eharari

is there any more detail on

in the test database every time it runs a query it brokes

you get wrong results? you get different results? you get a stacktrace/error?