-
-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Mysql Server Resets When Connecting Immediately After Launch #8131
Comments
Thanks. This seems like we're accepting the connection in a state where we can't service it and then never getting back to it. Good repro. We'll get started debugging this in the next day or so. |
Thanks for providing such easy repro steps @farhanhubble! 🙏 I've been digging into this one this morning, and I can repro the behavior you're seeing. I'm pretty sure this is a timing issue... when I'm going to experiment with adding a Thanks for helping us identify this issue. I'll have another update for you soon. |
I dug into this one some more... I'm not a Docker expert, so this was fun for me to get deeper into what's going on with various container commands and container startup...
I noticed that the MySQL Docker image (which we use an example for Dolt's sql-server image) does not define healthchecks and I also saw in the documentation that it has the same behavior with initialization taking a few seconds. (See the "No connections until MySQL init complete" section in the MySQL Docker image documentation). That's specifically around initializing a brand new MySQL install, but it illustrates that the same behavior is happening with The standard approach for this with Docker containers seems to be to poll the container to check for readiness. We provide an example of doing this with Kubernetes in our docs in case that's helpful. For your example, I think a good approach would be to have a small loop in your Python code that checks to see if Let us know if any of that doesn't make sense, or if you just think I'm misunderstanding something that's going on here. We're open to adding more of this info to our docs if you think that might have been helpful for you, too. Python
|
Thank you so much @fulghum! I'm no docker expert myself. The interesting thing is that I noticed this issue because I had written a I wasn't aware of the subtleties of |
My pleasure! This was a fun one to dig into. 😄 I'm glad you found a way to poll for the server readiness and verify that the server has started up successfully. For others who may read this issue... polling for a successful read is a much more resilient approach than a static sleep since startup times can change for a variety of reasons such as load on the host or the size of the database. I'll go ahead and resolve since we got this figured out, but don't hesitate to let us know if there's anything else we can do to help you build with Dolt! |
Scenario:
pymysql.err.OperationalError - Lost connection to MySQL server during query
MRE:
Additional Info:
The text was updated successfully, but these errors were encountered: