magnusbaeck / logstash-filter-verifier

Apache License 2.0
191 stars 27 forks source link

panic: not found: plugin stdin does not contain an id attribute #131

Closed jgough closed 2 years ago

jgough commented 2 years ago

When running tests using daemon mode in Beta 1, with several pipelines including this one:

input { stdin {} }
output { stdout {} }

The daemon exited abruptly with this error:

panic: not found: plugin stdin does not contain an id attribute

goroutine 66 [running]:
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/daemon/logstashconfig.replaceInputsWalker.replaceInputs(0xab40190, 0x8, 0xaccf480, 0xab286f0)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/daemon/logstashconfig/file.go:87 +0x7b1
github.com/breml/logstash-config/ast/astutil.ApplyPlugins(0xacd44d0, 0x1, 0x1, 0xacc5b70, 0xffffffe1, 0x0, 0x1f)
        /go/pkg/mod/github.com/breml/logstash-config@v0.4.5/ast/astutil/apply.go:45 +0xf0
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/daemon/logstashconfig.(*File).ReplaceInputs(0xacc5c50, 0xab40190, 0x8, 0xab3d0b0, 0x1, 0x1)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/daemon/logstashconfig/file.go:67 +0xa0
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/daemon/session.(*Session).setupTest(0xab26460, 0xacd15f0, 0x3, 0x4, 0xab26370, 0x2, 0x3, 0xab26460, 0x200)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/daemon/session/session.go:86 +0x380
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/daemon/session.(*Controller).Create(0xa8b4270, 0xab26410, 0x2, 0x2, 0xab26370, 0x2, 0x3, 0x0, 0x0, 0x0)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/daemon/session/controller.go:72 +0x264
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/app/daemon.(*Daemon).SetupTest(0xaa7e310, 0x88136dc, 0xab28168, 0xab4a0c0, 0xaa7e310, 0xab5e701, 0xab28168)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/app/daemon/daemon.go:300 +0x149
github.com/magnusbaeck/logstash-filter-verifier/v2/internal/daemon/api/grpc._Control_SetupTest_Handler(0x86f9940, 0xaa7e310, 0x88136dc, 0xab28168, 0xab3c150, 0x0, 0x88136dc, 0xab28168, 0xab5e700, 0x304)
        /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/internal/daemon/api/grpc/api_grpc.pb.go:134 +0x199
google.golang.org/grpc.(*Server).processUnaryRPC(0xa8c6480, 0x8816774, 0xac56000, 0xab2a3f0, 0xa89c330, 0x8bbe50c, 0x0, 0x0, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:1210 +0x4ea
google.golang.org/grpc.(*Server).handleStream(0xa8c6480, 0x8816774, 0xac56000, 0xab2a3f0, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:1533 +0xa71
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xac16050, 0xa8c6480, 0x8816774, 0xac56000, 0xab2a3f0)
        /go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:871 +0x92
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /go/pkg/mod/google.golang.org/grpc@v1.34.0/server.go:869 +0x1b0

Sadly I've been unable to reproduce this again so I can't provide more info on repro steps. If this stack trace is not helpful then feel free to close as not reproduceable.

breml commented 2 years ago

I created a PR to fix this problem. That being said, an input without an ID will not be testable, because the test definition will not be able to state the correct input_plugin.

jgough commented 2 years ago

Aware that this will be untestable. When this happend it left the daemon socket file in place so I had to manually remove it which is not ideal as it didn't clean up properly after the unclean exit. Thanks for the PR!

breml commented 2 years ago

@jgough The panic and with this the issue, that the socket file as well as the other temporary files are not cleaned up, is intentional, because it is the programmers fault, if the daemon gets a config, where the Logstash config does not contain an ID for every plugin. This is what is fixed by the PR.

breml commented 2 years ago

@jgough If you like, you can checkout #135 , which contains the fixed version of github.com/breml/logstash-config, which should resolve this issue.