Skip to content

FunctionClauseError in Messages.decode_msg/2 #257

@sigurdsa

Description

@sigurdsa

Hey, ran into this issue, seems like there is a missing match on :running in the decode_msg? Right before I also had some timeouts. The app processes events from a kafka queue and does some processing on each event, which can result in many requests to the DB, so the timeouts is probably just the queue overflowing.

2019-11-04 08:55:48.493 [error] Mariaex.Protocol (#PID<0.1404.0>) disconnected: ** (DBConnection.ConnectionError) tcp recv: timeout

2019-11-04 08:55:48.493 [error] Mariaex.Protocol (#PID<0.1404.0>) disconnected: ** (DBConnection.ConnectionError) tcp recv: timeout

2019-11-04 08:55:49.574 [error] GenServer #PID<0.1404.0> terminating ** (FunctionClauseError) no function clause matching in Mariaex.
Messages.decode_msg/2 (mariaex) lib/mariaex/messages.ex:265: 
Mariaex.Messages.decode_msg(<<1>>, :running) (mariaex) lib/mariaex/messages.ex:229: 
Mariaex.Messages.decode/2 (mariaex) lib/mariaex/protocol.ex:1197: 
Mariaex.Protocol.msg_decode/2 (mariaex) lib/mariaex/protocol.ex:1165: 
Mariaex.Protocol.msg_recv/4 (mariaex) lib/mariaex/protocol.ex:268: Mariaex.Protocol.disconnect/2 
(db_connection) lib/db_connection/connection.ex:136: DBConnection.Connection.disconnect/2 
(connection) lib/connection.ex:767: Connection.disconnect/3 (stdlib) 
gen_server.erl:637::gen_server.try_dispatch/4 Last message: {
    :"$gen_cast",
    {
        :disconnect,
        #Reference<0.2840312852.1241645057.11631>,
        %DBConnection.ConnectionError {
            message: "tcp recv: timeout", severity: : error
        }
        ,
        %Mariaex.Protocol {
            binary_as::field_type_var_string,
            buffer: "",
            cache: #Reference<0.2840312852.1241382913.240767>,
            catch_eof: false,
            connection_id: #PID<0.1404.0>,
            cursors: % {}
            ,
            datetime::structs,
            deprecated_eof: false,
            json_library: Poison,
            lru_cache: {
                100,
                #Reference<0.2840312852.1241382913.240768>
            }
            ,
            opts: [socket_options: [],
            sock_type::tcp,
            cache_size: 100,
            timeout: 5000,
            port: 3306,
            password: nil,
            hostname: 'something',
            username: 'something',
            skip_database: true,
            pool_size: 5,
            name::pool_connection],
            seqnum: 0,
            sock: {
                Mariaex.Connection.Tcp,
                #Port<0.3299>
            }
            ,
            ssl_conn_state::not_used,
            state::running,
            state_data: nil,
            timeout: 5000,
            transaction_status::idle
        }
    }
}

State: {
    Mariaex.Protocol,
    %Mariaex.Protocol {
        binary_as::field_type_var_string,
        buffer: "",
        cache: #Reference<0.2840312852.1241382913.240767>,
        catch_eof: false,
        connection_id: #PID<0.1404.0>,
        cursors: % {}
        ,
        datetime::structs,
        deprecated_eof: false,
        json_library: Poison,
        lru_cache: {
            100,
            #Reference<0.2840312852.1241382913.240768>
        }
        ,
        opts: [socket_options: [],
        sock_type::tcp,
        cache_size: 100,
        timeout: 5000,
        port: 3306,
        password: nil,
        hostname: 'something',
        username: 'something',
        skip_database: true,
        pool_size: 5,
        name::pool_connection],
        seqnum: 0,
        sock: {
            Mariaex.Connection.Tcp,
            #Port<0.3299>
        }
        ,
        ssl_conn_state::not_used,
        state::running,
        state_data: nil,
        timeout: 5000,
        transaction_status::idle
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions