-
Notifications
You must be signed in to change notification settings - Fork 754
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
WriteBatch Method in BatchOutput Interface Does Not Return Errors Anymore #2549
Comments
I'm facing a similar problem when using the input:
generate:
mapping: 'root = {"hello": "world"}'
interval: 1s
count: 1
pipeline:
processors:
- log:
level: INFO
message: "processing event: ${!content()}"
output:
broker:
pattern: fan_out_sequential_fail_fast
outputs:
- elasticsearch:
urls:
- https://localhost:1234
index: "my-index"
id: ${!timestamp_unix()}
max_retries: 1
tls:
enabled: true
skip_cert_verify: true
basic_auth:
enabled: true
username: elastic
password: admin
healthcheck: false
sniff: false
processors:
- mapping: '{"message": "elasticsearch preprocessor", "timestamp": timestamp_unix()}'
- stdout:
codec: lines
processors:
- mapping: '{"message": "stdout preprocessor", "timestamp": timestamp_unix()}' Output
As the problem seems related to the |
@mohitmarwal when you say "previously", do you mean version 4.26.0? And is there a an example you can provide where this behaviour shows up? For example, the following config behaves as I'd expect: input:
http_server: {}
output:
http_client:
url: example.com/not/going/to/work Running @FerroEduardo this is a separate issue, unfortunately for some components when they are failing during a connection loop they will block traffic even when a DLQ is configured. There's an existing issue for this: #1210 |
@Jeffail Issue occured when i updated from version V 4.24.0 and 4.25.1. |
@Jeffail l here is the suedo code where the issue occurs func (m *myBatchOutput) WriteBatch(ctx context.Context, batch service.MessageBatch) error { func (m *myBatchOutput) Close(ctx context.Context) error { func (m *myBatchOutput) Connect(ctx context.Context) error {
} func main() { func newMyBatchOutput(conf *service.ParsedConfig, mgr *service.Resources) (
} input: pipeline: output: output: |
@Jeffail in my setup even this doesnt return the hello world but gives me request time out error input: MINGW64 ~/Downloads/benthos_4.27.0_windows_amd64.tar/benthos_4.27.0_windows_amd64 |
@Jeffail any updates on this please let me know if you want more |
Discussed in #2548
Originally posted by mohitmarwal April 29, 2024
Previously, when using the BatchOutput interface in Benthos, the WriteBatch method used to return an error if delivery was not possible. This was crucial for handling error scenarios and responding appropriately, especially in HTTP server contexts where the client expects meaningful error responses.
Earlier for example we were getting message error in the input - httpServer: . But now this error is not returned back to http server instead we get request time out with error printed in console in loop.
func (o *BatchOutput) WriteBatch(ctx context.Context, batch types.MessageBatch) error {
return fmt.Errorf("message error: %w", err)
}
However, with the latest update, it seems that the WriteBatch method does not return errors anymore. Instead, when an error occurs, the client receives a request timeout response, which is misleading and does not provide useful information about the actual error.
Expected Behavior:
The WriteBatch method in the BatchOutput interface should return an error if delivery is not possible, as it did before. This error should be propagated back to the caller so that appropriate error handling can be performed, such as returning meaningful HTTP responses with error details.
Steps to Reproduce:
Impact:
This change affects users who rely on the BatchOutput interface for writing batches of messages, especially in scenarios where error handling and response generation are critical, such as HTTP servers.
Proposed Solution:
Restore the previous behavior of the WriteBatch method to return errors when delivery is not possible. This ensures consistency and enables users to handle error scenarios appropriately.
The text was updated successfully, but these errors were encountered: