Skip to content

Connections not properly closed on errors #250

Description

@chr1sjf0x

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:

** (UndefinedFunctionError) function :crypto.hash/2 is undefined (module :crypto is not available)
    (crypto) :crypto.hash(:sha, "REDACTED")
    (mariaex) lib/mariaex/protocol.ex:1097: Mariaex.Protocol.mysql_native_password/2
    (mariaex) lib/mariaex/protocol.ex:212: Mariaex.Protocol.handle_handshake/3
    (mariaex) lib/mariaex/protocol.ex:171: Mariaex.Protocol.handshake_recv/2
    (db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

With the auto-recovery feature of our environment, repeated attempts to connect to the database resulted in our AWS RDS running out of connections:

** (RuntimeError) connect raised CaseClauseError exception.The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true if you wish to see all of the details
    (mariaex) lib/mariaex/protocol.ex:1245: Mariaex.Protocol.abort_statement/3
    (mariaex) lib/mariaex/protocol.ex:232: Mariaex.Protocol.handle_handshake/3
    (mariaex) lib/mariaex/protocol.ex:171: Mariaex.Protocol.handshake_recv/2
    (db_connection) lib/db_connection/connection.ex:66: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Seems failures in the first code path to not result in proper termination of connections.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions