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
Fix incomplete flush in the sender when flushing the client #163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should address most cases of incomplete flushes, but in ChannelMode
I don't think it guarantees that, when Flush
is called, a previous metric submission call (e.g. Gauge()
) has gone as far as a worker's writeMetricUnsafe
call here
A larger refactoring might be necessary so that the pipeline of client -> workers -> sender can be fully flushed in order, by passing a "flush" message down from the client to the workers and ultimately to the sender, each step confirming that it has processed all data that was available before the flush started.
Indeed the For the |
60b7418
to
308138d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, for now in ChannelMode
it sounds reasonable to document that the Flush
function doesn't offer guarantees that everything that was submitted is actually flushed.
Left a suggestion inline
In some case, the sender 'sendLoop' would pop a buffer from its queue as we are calling its 'flush' method. Since the input queue is empty it would return instantly without waiting for the current buffer own by the sender to be sent. This would result in partial flush. We now synchronize 'flush' and 'sendLoop' to make sure flushing the client will send everything to the wire. The side effect of this is that the workers are lock for longer as we keep them locked when flushing the sender.
308138d
to
1df04d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📦
In some case, the sender 'sendLoop' would pop a buffer from its queue
as we are calling its 'flush' method. Since the input queue is empty it
would return instantly without waiting for the current buffer own by the
sender to be sent. This would result in partial flush.
We now synchronize 'flush' and 'sendLoop' to make sure flushing the
client will send everything to the wire. The side effect of this is that
the workers are lock for longer as we keep them locked when flushing the
sender.