-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
buffer: Avoid to process discarded chunks in write_step_by_step
#4342
Conversation
It would be better to add a test for it. |
It fixes following error when many `chunk bytes limit exceeds` errors are occurred: ``` 2020-07-28 14:59:26 +0000 [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location="/fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer/file_chunk.rb:82:in `pos'" tag="cafiscode-eks-cluster.default" 2020-07-28 14:59:26 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer/file_chunk.rb:82:in `pos' 2020-07-28 14:59:26 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer/file_chunk.rb:82:in `rollback' 2020-07-28 14:59:26 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer.rb:339:in `rescue in block in write' 2020-07-28 14:59:26 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer.rb:332:in `block in write' 2020-07-28 14:59:26 +0000 [warn]: #0 /fluentd/vendor/bundle/ruby/2.6.0/gems/fluentd-1.11.1/lib/fluent/plugin/buffer.rb:331:in `each' ... ``` Fix #3089 Signed-off-by: Takuro Ashie <[email protected]>
415c963
to
5265fb5
Compare
Done. |
b2c65b9
to
7e981ce
Compare
#3089 Signed-off-by: Takuro Ashie <[email protected]>
7e981ce
to
fb37f08
Compare
Thanks! I'm seeing this. |
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.
Thanks! LGTM.
I have commented on my concern about the code, but I think it can go either way.
(It would be more readable to make get_next_chunk()
just focus on returning the next chunk, I think.)
Now I understand this bug.
The problem is that the chunks remains in operated_chunks
of Buffer::write()
after retrying write_step_by_step()
.
And this PR fixes it completely.
It seems that this also causes the following error.
Signed-off-by: Takuro Ashie <[email protected]>
Need to backport to v1.16 branch. |
After 95438b2 (fluent#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: emit transaction failed: error_class=IOError error= "closed stream" location=... send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
After 95438b2 (fluent#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: ``` [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... ``` Signed-off-by: Daijiro Fukuda <[email protected]>
After 95438b2 (fluent#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to \@error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
After 95438b2 (fluent#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
After 95438b2 (fluent#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
After 95438b2 (#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
Backported from 13a5199. After 95438b2 (#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
Backported from 13a5199. After 95438b2 (#4342), there is a section where chunks do not have a lock in `write_step_by_step()`. `write_step_by_step()` must ensure their locks until passing them to the block. Otherwise, race condition can occur and it can cause emit error by IOError. Example of warning messages of emit error: [warn]: #0 emit transaction failed: error_class=IOError error="closed stream" location=... [warn]: #0 send an error event stream to @error: error_class=IOError error="closed stream" location=... Signed-off-by: Daijiro Fukuda <[email protected]>
Which issue(s) this PR fixes:
Fix #3089
What this PR does / why we need it:
It fixes following error when many
chunk bytes limit exceeds
errors are occurred:Please see #3089 (comment) for the detail.
Docs Changes:
N/A
Release Note:
Same with the title