redpanda-data / redpanda-data/benthos

Concurrent access issues with plugins

Open
#90 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation plugin api
Dominant language
Go
Stars
571
Forks
120
Avg merge
2d 1h
Merged PRs (30d)
18

Description

Using go routine to frequently call this method causes the service to crash.

package main
import (
"context"

"github.com/benthosdev/benthos/v4/public/service"

// Import only required Benthos components, switch with `components/all` for
// all standard components.
_ "github.com/benthosdev/benthos/v4/public/components/io"
_ "github.com/benthosdev/benthos/v4/public/components/pure"

)

func main() {
panicOnErr := func(err error) {
if err != nil {
panic(err)
}
}

builder := service.NewStreamBuilder()

// Set the full Benthos configuration of the stream.
err := builder.SetYAML(`

input:
generate:
count: 1
interval: 1ms
mapping: 'root = "hello world"'

processors:
- mapping: 'root = content().uppercase()'

output:
stdout: {}

logger:
level: none
`)
panicOnErr(err)

// Build a stream with our configured components.
stream, err := builder.Build()
panicOnErr(err)

// And run it, blocking until it gracefully terminates once the generate
// input has generated a message and it has flushed through the stream.
err = stream.Run(context.Background())
panicOnErr(err)

}

How to solve this problem?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Go example and inspect the service.NewStreamBuilder and stream.Run entry points, then reproduce the crash under concurrent access. Identify the relevant plugin or service lifecycle behavior and establish a regression test; done means repeated concurrent calls no longer crash the service.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.