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

Fixes infinite loop triggered by oversized metrics #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qxjit
Copy link

@qxjit qxjit commented May 15, 2019

Adds a length check to send that checks whether the metric being sent
is longer than the max buffer size. An exception is raised to the caller
(not in the reaper thread) if the metric is too large. In order to
check the length before adding the item to the reaper thread, the UTF8
building had to move to be done in the calling thread rather than the
background.

Prior to this, if a chunk larger than the max buffer size made it into
builderAction it would cause an infinite loop. It would try to flush
existing chunks to make room for the new one, but would then get stuck
because the oversize chunk was still too big. The exact same thing
would happen on the next builderAction iteration (and so forth).

Fixes #32.

Adds a length check to `send` that checks whether the metric being sent
is longer than the max buffer size. An exception is raised to the caller
(*not* in the reaper thread) if the metric is too large. In order to
check the length before adding the item to the reaper thread, the UTF8
building had to move to be done in the calling thread rather than the
background.

Prior to this, if a chunk larger than the max buffer size made it into
`builderAction` it would cause an infinite loop. It would try to flush
existing chunks to make room for the new one, but would then get stuck
because the oversize chunk was still too big. The exact same thing
would happen on the next `builderAction` iteration (and so forth).

Fixes iand675#32.
@dfithian
Copy link
Collaborator

@iand675 I just noticed this. Any thoughts? I'm not using datadog much these days so I'm not sure of the context.

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 this pull request may close these issues.

Sending an item larger than the buffer size leads to infinite loop
2 participants