The most common problem is a connection timeout, causing the server to close it. The solution is very trivial - increasing the wait_timeout in the configuration file.
it could also be related to memory
P.S. don't forget to restart the database after making changes