Skip to content

Comments

Fixes infinite loop triggered by oversized metrics#33

Open
qxjit wants to merge 1 commit intoiand675:masterfrom
qxjit:fix_infinite_loop_on_large_metrics
Open

Fixes infinite loop triggered by oversized metrics#33
qxjit wants to merge 1 commit intoiand675:masterfrom
qxjit:fix_infinite_loop_on_large_metrics

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