-
Notifications
You must be signed in to change notification settings - Fork 89
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
Connections not properly closed on errors #250
Comments
Maybe a similar root cause as issue 230. |
We had DB troubles this morning, resulting in the following error, which bubbled up and crashed our app eventually (even though we have designed the app to be able to function in the absence of the database).
By the time I got |
I have looked at the code to try to understand what is going on here. This is where I lose the plot a little bit, but the case statement on line 1245 is not set up to handle I can't tell if it's supposed to get to |
@derekkraan we had a very similar issue on myxql and I believe you're on the right track. I'm able to reproduce it like this:
# run this a few times:
iex> Mariaex.start_link(database: "myxql_test", show_sensitive_data_on_connection_error: true) eventually will crash with:
|
@wojtekmach thanks for commenting. I will take a look to see if I can write a test case for this scenario for my PR. |
Yeah, this is tricky since triggering the condition using max_connections can negatively affect other tests and ideally you'd restore this global state after the test. I couldn't think of another way of testing this scenario so because of this we unfortunately ended up leaving this untested. |
The version of mariadb I'm using to test doesn't allow setting max_connections to less than 10 😂 |
I added a test to the PR based on your idea @wojtekmach. Fails on master, passes in my branch. Thanks for the help, it'll be nice to get this fixed! |
MariaEX: 0.9.1
Elixir: 1.8.1
Erlang: 21.2
Run on Alpine:3.6 (OpenSSL 1.0.2k-fips 26 Jan 2017)
In our deployment, we had an incorrect version of OpenSSL, which resulted in this error:
With the auto-recovery feature of our environment, repeated attempts to connect to the database resulted in our AWS RDS running out of connections:
Seems failures in the first code path to not result in proper termination of connections.
The text was updated successfully, but these errors were encountered: