libhoney-rust
libhoney-rust copied to clipboard
transmission freezes when response channel is full
Description
We noticed an issue where the response channel will fill up and freeze the transmission if responses are not consumed.
A send call is used to send information to the response channel. It seems that the response channel is a bounded crossbeam-channel, so the sender's send function will block if the channel is full.
With a default sized channel, this occurs after 40000 events.
Meanwhile, the README states:
You don’t have to process responses if you’re not interested in them—simply ignoring them is perfectly safe. Unread responses will be dropped.
Code
https://github.com/nlopes/libhoney-rust/blob/d98ffe3ea8a6660881f6b01acbc24017b9ae387b/src/transmission.rs#L152-L159
History
The bug seems to originate in this commit: https://github.com/nlopes/libhoney-rust/commit/2f004daa4378e96f91a55402e791db53a92e35fa
Potential ideas
I would propose a solution where everything regarding the responses is put behind a feature flag and then explicitly state that you must consume the response channel if you activate the feature.
I would be happy to implement a fix. Just let me know if you think the proposed idea would be a good fit for this project.
Other, easier to implement ideas for "just drop data if it's full":
- Check
sender.is_full() - Switch to
sender.try_send()
Thanks for sending. I'm about to do some work on merging a few PRs and then will look at this issue and consider a proposal.