katja-beam / katja

A simple Riemann client written in Erlang.
https://hex.pm/packages/katja
ISC License
27 stars 19 forks source link

Katja silently drops one event when riemann server is restarted. #17

Open prashantndls opened 8 years ago

prashantndls commented 8 years ago

When Riemann is restarted on the server side, then the first event sent using katja:send_event returns {error/closed}. Second time the send_event is successful. At the first call of katja:send_event after restart of riemann, line number 233 of katja_connection.erl is triggered because first ok is returned by gen_tcp:send at line 229. Then line 231, receive_reply_tcp returns {error,closed}. When katja:send_event is called second time after Riemann restart, line number 229 straight away returns {error,closed} after which line number 235 is triggered. The tcp connection gets closed at line 238 and maybe_connect_and_send_tcp is called at line number 239. Therefore, second time the call gets successful. Connection failure needs to be handled right first time when {error,closed} is received as return from line 231's receive_reply_tcp.