MatchError in MyXQL.Client.com_stmt_close/2
devonestes opened this issue · 2 comments
I'm seeing cases in production where there's a MatchError
in MyXQL.Client.com_stmt_close/2
. The stacktrace looks like this:
MatchError: no match of right hand side value: {:error, :closed}
File "lib/myxql/client.ex", line 137, in MyXQL.Client.com_stmt_close/2
File "lib/myxql/connection.ex", line 451, in MyXQL.Connection.close/2
File "lib/myxql/connection.ex", line 109, in MyXQL.Connection.handle_execute/4
File "lib/db_connection/holder.ex", line 316, in DBConnection.Holder.holder_apply/4
File "lib/db_connection.ex", line 1255, in DBConnection.run_execute/5
File "lib/db_connection.ex", line 1342, in DBConnection.run/6
File "lib/db_connection.ex", line 539, in DBConnection.parsed_prepare_execute/5
File "lib/db_connection.ex", line 532, in DBConnection.prepare_execute/4
It's pretty clear where it is, but I have no idea how this should be handled properly which is why I'm opening the issue instead of just fixing it myself. I'd love if there was some way to handle this that didn't result in an exception being thrown, but I'm not really sure if there is.
Thank you for the report. {:error, :closed}
means the socket got closed so the connection is now in an invalid state and we need to return {:disconnect, exception, state}
from the dbconnection callback that triggered it. I should have a fix by Monday but if you want to give it a go, by all means!
Clearly I didn't get to this myself, so thank you very much @wojtekmach for being so quick in fixing this over the weekend!