A <secondary> output cannot roll back a chunk: rollback_write always raises ArgumentError
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 88/100
Direzione di ricerca
Leggi in lib/fluent/plugin/output.rb la sezione intorno a acts_as_secondary e la definizione di rollback_write. La correzione segnalata consiste nel passare update_retry come argomento con nome nella delega. Controlla i test esistenti per gli output secondari e aggiungi una copertura che mostri che un chunk con commit ritardato viene ripristinato; il lavoro è completato quando la delega non genera più un'eccezione e il chunk può essere ritentato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When an output is used as <secondary>, Output#acts_as_secondary defines rollback_write on it to delegate to the primary:
define_method(:rollback_write){ |chunk_id, update_retry: true| @primary_instance.rollback_write(chunk_id, update_retry) }
https://github.com/fluent/fluentd/blob/d2c7287a/lib/fluent/plugin/output.rb#L256
Output#rollback_write takes update_retry as a keyword argument (def rollback_write(chunk_id, update_retry: true), line 1178). So this call always raises ArgumentError: wrong number of arguments (given 2, expected 1). rollback_write became a keyword argument in 59a47a19 (v0.14.25 and v1.0.0), and this delegation was not updated.
A delayed commit output, such as out_forward with require_ack_response true, calls rollback_write when the ack does not arrive. When this output is a <secondary>, the call raises, and AckHandler#collect_response logs unexpected error while receiving ack. The chunk is not rolled back, so it is not sent again. In the test below, it stayed in the delayed commit state until the shutdown.
To Reproduce
- Make nothing listen on port 24224, so the primary fails.
- Run a server on port 24225 that reads the data but never sends an ack:
ruby -rsocket -e 's = TCPServer.new("127.0.0.1", 24225); loop { c = s.accept; Thread.new(c) { |x| loop { x.readpartial(65536) } rescue nil } }'
- Run Fluentd with the configuration below for about 20 seconds.
Results on master (d2c7287a):
- After the primary fails, the secondary sends the chunk. Each time the ack times out, the error below is logged, about every 2 seconds.
- The chunk is not sent again. The silent server received 1014 bytes in 20 seconds.
With @primary_instance.rollback_write(chunk_id, update_retry: update_retry) instead, the error is gone. The chunk is sent again after each ack timeout, and the silent server received 3096 bytes in the same time.
Expected behavior
rollback_write on a <secondary> output rolls back the chunk, as on the primary. Passing update_retry as a keyword argument fixes it, as above.
Your Environment
- Fluentd version: master (d2c7287a). v1.20.1 and v1.19.4 have the same line (not run).
- Package version: -
- Operating system: Linux
- Kernel version: -
Your Configuration
<source>
@type sample
tag test
size 1
rate 1
</source>
<match test>
@type forward
heartbeat_type none
require_ack_response true
<server>
host 127.0.0.1
port 24224
</server>
<buffer>
@type memory
flush_interval 1s
retry_type periodic
retry_wait 1s
retry_timeout 60s
retry_secondary_threshold 0.05
</buffer>
<secondary>
@type forward
heartbeat_type none
require_ack_response true
ack_response_timeout 2
<server>
host 127.0.0.1
port 24225
</server>
</secondary>
</match>
Your Error Log
[error]: unexpected error while receiving ack error_class=ArgumentError error="wrong number of arguments (given 2, expected 1)"
[error]: lib/fluent/plugin/output.rb:256:in 'block (2 levels) in acts_as_secondary'
Additional context
I found this while reviewing #5627.
- Lingua principale
- Ruby
- Stelle
- 13.6k
- Fork
- 1.4k
- Merge medio
- 17h 39m
- PR unite (30g)
- 67
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fluent/fluentd
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
fluent/fluentd#5632 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
parser_syslog: message_format auto parses RFC 3164 messages with an RFC 3339 timestamp as RFC 5424Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
fluent/fluentd#5631 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
fluent/fluentd#5630 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
out_forward: unacknowledged chunks are resent forever with heartbeat_type none, ignoring retry limits and secondaryForse già presa @SahinurDEV l’ha presa 2 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
fluent/fluentd#5619 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di fluent/fluentd
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
FinanceFlash/unvibecode#699 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
chat
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
I maintainer di solito rispondono entro 9 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100