infinyon / fluvio

Lean and mean distributed stream processing system written in rust and web assembly. Alternative to Kafka + Flink in one.
https://www.fluvio.io/
Apache License 2.0
3.88k stars 491 forks source link

Detect TCP connection termination in CLI #678

Closed sehz closed 3 years ago

sehz commented 3 years ago

Both produce and consumer has continuous way to fetch producer and consumer. If connection to server goes down, it should immediately terminate it to give user good experience

Scope: If a Fluvio operation (e.g. consume) would stay open, but the connection is terminated, the CLI should gracefully exit and print a message describing what happened.

sehz commented 3 years ago

It seems it is possible by turning on client side keep alive and check for error.

https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die https://stackoverflow.com/questions/722240/instantly-detect-client-disconnection-from-server-socket

nicholastmosher commented 3 years ago

Test if this is still a problem

simlay commented 3 years ago

https://github.com/infinyon/fluvio-socket/pull/22 should have helped with this but because there's a new enum in FlvSocketError, the auth workspace doesn't like it due to the map_err. I didn't think it was a breaking change with https://github.com/infinyon/fluvio-socket/pull/22 but maybe I was wrong.

nicholastmosher commented 3 years ago

We need some lower-level machinery updates in order to gracefully handle the producer case of this issue. For now it should be sufficient for the CLI to timeout and print a message which is what happens today.