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
Rework pool lock logic to handle new connections context switches #109
Conversation
@bcardiff Hey, great to know you worked on this PR, I will try it tomorrow to see it under pressure |
@Xosmond were you able to check if this PR works for you? |
@bcardiff I'm back 2 years after that 😀 . I apologize. I remember I tested and I was still having the same problem on high concurrent environment (Unknown why it was happening, I would need to debug). Btw I will give it a shot again. I have to test it with mysql because postgres shard on high concurrent scenario fails for some reason (SSL error IRCC). Its kinda tricky to test, you have to configure everything to work on a high concurrent scenario and get a group of servers to hit each other 😄 |
Fixes #77
I was able to make a spec to repro the issue in crystal-lang/crystal-mysql@325493b#diff-f41a8330fda8a5ae668e7e17638aef40R40-R57
A couple of things I considered during this PR:
SetConnMaxLifetime
that would be good to have in order to limit the timespan of the whole connection. It's a good policy.For now, this PR should fix the issue but there are some ideas to improve the logic.