magnusbaeck / logstash-filter-verifier

Apache License 2.0
192 stars 27 forks source link

Crash when using --sockets flag #54

Closed srilumpa closed 6 years ago

srilumpa commented 6 years ago

Hi,

I'm trying to use logstash-filter-verifier with the --sockets flag but it generates a crash. Here are the generated traces:

$ logstash-filter-verifier --sockets specs/ /etc/logstash/conf.d/*-filter.conf
Use Unix domain sockets.
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/magnusbaeck/logstash-filter-verifier/logstash.getSocketInOutPlugins(0xc42010ec70, 0x2, 0x2, 0x0, 0x10, 0x10, 0xc42010ec70, 0x0, 0x5d0c6d, 0xc420030c00, ...)
    /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/logstash/parallel_process.go:164 +0x815
github.com/magnusbaeck/logstash-filter-verifier/logstash.NewParallelProcess(0xc4200d8380, 0xc42010ec70, 0x2, 0x2, 0x774690, 0x1, 0x1, 0x2, 0xc4200fb7b8, 0x7f71b074f7f8)
    /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/logstash/parallel_process.go:184 +0x5d
main.runParallelTests(0xc4200d8380, 0xc420084dc0, 0x2, 0x2, 0xc420082fe0, 0x2, 0x2, 0x774690, 0x1, 0x1, ...)
    /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/logstash-filter-verifier.go:181 +0x62d
main.mainEntrypoint(0x0)
    /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/logstash-filter-verifier.go:325 +0x96d
main.main()
    /home/magnus/src/logstash-filter-verifier/src/github.com/magnusbaeck/logstash-filter-verifier/logstash-filter-verifier.go:339 +0x22

I am running on Ubuntu 17.10 with logstash-filter-verifier v1.4.1 installed from the DEB package.

magnusbaeck commented 6 years ago

That's odd; I thought I fixed that bug in commit db42e83a68d4dcc651a4f4e51e2ace2924fe9250. Would you be able to provide a minimal subset of your configuration and testcases that reproduces the problem?

srilumpa commented 6 years ago

So I digged a little more on the issue and it appears that there was one specific spec file that generated the crash. In the JSON was like the following:

{
  "codec": "json_lines",
  "fields": null,
  "ignore": [
    "host"
  ],
  "testcases": [
    {
      "input": [
        "{\"message\": \"[REDACTED]\"}"
      ],
      "expected": [
        {
          "message": "[REDACTED]"
        }
      ]
    }
  ]
}

Removing the "fields": null line fixed my issue.