Skip to content
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

Not handling possible error when calling :gen_tcp.send/2 in Romeo.Transports.TCP.send/2 #27

Open
alakra opened this issue Apr 11, 2017 · 0 comments · May be fixed by #32
Open

Not handling possible error when calling :gen_tcp.send/2 in Romeo.Transports.TCP.send/2 #27

alakra opened this issue Apr 11, 2017 · 0 comments · May be fixed by #32

Comments

@alakra
Copy link

alakra commented Apr 11, 2017

Sometimes when Romeo.Transports.TCP.send/2 gets called in my application, my socket returns {:error, :closed}, and thus, a pattern match is not found.

11:38:56.986 [error] GenServer #PID<0.674.0> terminating
** (MatchError) no match of right hand side value: {:error, :closed}
    (romeo) lib/romeo/transports/tcp.ex:197: Romeo.Transports.TCP.send/2
    (romeo) lib/romeo/transports/tcp.ex:73: Romeo.Transports.TCP.start_stream/2
    (romeo) lib/romeo/transports/tcp.ex:62: Romeo.Transports.TCP.start_protocol/1
    (romeo) lib/romeo/connection.ex:90: Romeo.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: %Romeo.Connection{component: false, features: %Romeo.Connection.Features{amp?: false, compression?: false, mechanisms: [], registration?: false, stream_management?: false, tls?: false}, host: nil, jid: "test@localhost", legacy_tls: false, nicknam
e: "", owner: #PID<0.673.0>, parser: nil, password: "password", port: nil, preferred_auth_mechanisms: [], require_tls: false, resource: "", rooms: [], socket: nil, socket_opts: [], ssl_opts: [], stream_id: nil, timeout: 5000, transport: Romeo.Transports
.TCP}

The line in question is here.

What do you think we should do to handle this?

lmarlow added a commit to lmarlow/romeo that referenced this issue Oct 13, 2017
When connecting many clients to an XMPP server quickly, closed streams
can occur. Let those errors through instead of blowing up due to
FunctionClauseError.

Fixes scrogson#27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant