Describe the bug
The json encoder in sf-processor uses a pre-allocated buffer (t.buf) to avoid multiple memory allocations. The buffer re-use happens on line 271 in sf-processor/core/exporter/encoders/json.go (currently commented out).
The exporter module in sf-processor's pipeline configuration allows to specify a buffer parameter as a batch size (number of records to be encoded/transported at once). For buffer > 1, the buffer re-use causes corrupt json output because old records will be overwritten by new ones without flushing the buffer in between.
To reproduce
Steps to reproduce the behavior:
Change line 270-271 in sf-processor/core/exporter/encoders/json.go:
Indicate project sf-processor, json encoder
Describe the bug The json encoder in sf-processor uses a pre-allocated buffer (
t.buf
) to avoid multiple memory allocations. The buffer re-use happens on line 271 insf-processor/core/exporter/encoders/json.go
(currently commented out).The exporter module in sf-processor's pipeline configuration allows to specify a
buffer
parameter as a batch size (number of records to be encoded/transported at once). Forbuffer > 1
, the buffer re-use causes corrupt json output because old records will be overwritten by new ones without flushing the buffer in between.To reproduce Steps to reproduce the behavior:
sf-processor/core/exporter/encoders/json.go
:Files