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

Sending an item larger than the buffer size leads to infinite loop #32

Open
qxjit opened this issue Apr 22, 2019 · 0 comments · May be fixed by #33
Open

Sending an item larger than the buffer size leads to infinite loop #32

qxjit opened this issue Apr 22, 2019 · 0 comments · May be fixed by #33

Comments

@qxjit
Copy link

qxjit commented Apr 22, 2019

Using send with an item that encodes to bytes longer than the maximum buffer size results causes withDogStatsD to never return. It looks like builderAction has no case for dealing with an individual chunk that is larger than the buffer size. Instead it dutifully flushes the chunks it has and tries to send the oversized chunk on the next iteration. Since the chunk is still too big, this leads to an infinite loop. withDogStatsD will then get stuck when it tries to send the remaining unsent items.

qxjit added a commit to qxjit/datadog that referenced this issue May 14, 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 iand675#32.
qxjit added a commit to qxjit/datadog that referenced this issue 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 iand675#32.
@qxjit qxjit linked a pull request May 15, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant