Skip to content
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

Panic when attempting to write primitive Zed values as Zeek TSV #5107

Open
philrz opened this issue Apr 12, 2024 · 0 comments
Open

Panic when attempting to write primitive Zed values as Zeek TSV #5107

philrz opened this issue Apr 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@philrz
Copy link
Contributor

philrz commented Apr 12, 2024

tl;dr

$ zq -version
Version: v1.15.0-7-g0db1b737

$ echo 'error("hello")' | zq -f zeek -
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x116cb73]

goroutine 1 [running]:
github.com/brimdata/zed.Value.Fields({{0x28c8688?, 0xc000713e18?}, 0xc00072e000?, 0xc00063b3b0?})
	/Users/phil/work/zed/value.go:354 +0x33
github.com/brimdata/zed/runtime/sam/expr.(*Flattener).Flatten(0xc000508d20, {{0x28c8688?, 0xc000713e18?}, 0xc00072e000?, 0xc00041fa68?})
	/Users/phil/work/zed/runtime/sam/expr/flattener.go:67 +0x8e
github.com/brimdata/zed/zio/zeekio.(*Writer).Write(0xc00053cb60, {{0x28c8688, 0xc000713e18}, 0xc00072e000, 0x5})
	/Users/phil/work/zed/zio/zeekio/writer.go:33 +0x51
github.com/brimdata/zed/zbuf.WriteBatch({0x4ab262b0, 0xc00053cb60}, {0x28d5d30?, 0xc00051aa40?})
	/Users/phil/work/zed/zbuf/batch.go:41 +0x84
github.com/brimdata/zed/zbuf.CopyPuller({0x4ab262b0, 0xc00053cb60}, {0x28c2380, 0xc000541440})
	/Users/phil/work/zed/zbuf/batch.go:166 +0x76
github.com/brimdata/zed/cli/zq.(*Command).Run(0xc0004caa80, {0xc0000400b0, 0x1, 0x1})
	/Users/phil/work/zed/cli/zq/command.go:162 +0x79e
github.com/brimdata/zed/pkg/charm.path.run({0xc0005a62f8?, 0x1, 0x1}, {0xc0000400b0?, 0x1, 0x0?})
	/Users/phil/work/zed/pkg/charm/path.go:11 +0x79
github.com/brimdata/zed/pkg/charm.(*Spec).ExecRoot(0x100874b?, {0xc000040090, 0x3, 0x3})
	/Users/phil/work/zed/pkg/charm/charm.go:63 +0x3f
main.main()
	/Users/phil/work/zed/cmd/zq/main.go:11 +0x5b

$ echo '"hello"' | zq -f zeek -
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x2194499]

goroutine 1 [running]:
github.com/brimdata/zed/zio/zeekio.(*Writer).writeHeader(0xc0000b9040, {{0x28c84d0?, 0x36dfb60?}, 0xc000780000?, 0xc00041fa68?}, {0x0, 0x0})
	/Users/phil/work/zed/zio/zeekio/writer.go:91 +0x3d9
github.com/brimdata/zed/zio/zeekio.(*Writer).Write(0xc0000b9040, {{0x28c84d0, 0x36dfb60}, 0xc000780000, 0x5})
	/Users/phil/work/zed/zio/zeekio/writer.go:39 +0x185
github.com/brimdata/zed/zbuf.WriteBatch({0x4ab38298, 0xc0000b9040}, {0x28d5d30?, 0xc00074a940?})
	/Users/phil/work/zed/zbuf/batch.go:41 +0x84
github.com/brimdata/zed/zbuf.CopyPuller({0x4ab38298, 0xc0000b9040}, {0x28c2380, 0xc00076d170})
	/Users/phil/work/zed/zbuf/batch.go:166 +0x76
github.com/brimdata/zed/cli/zq.(*Command).Run(0xc000139a40, {0xc0000400b0, 0x1, 0x1})
	/Users/phil/work/zed/cli/zq/command.go:162 +0x79e
github.com/brimdata/zed/pkg/charm.path.run({0xc0006a42f8?, 0x1, 0x1}, {0xc0000400b0?, 0x1, 0x0?})
	/Users/phil/work/zed/pkg/charm/path.go:11 +0x79
github.com/brimdata/zed/pkg/charm.(*Spec).ExecRoot(0x100874b?, {0xc000040090, 0x3, 0x3})
	/Users/phil/work/zed/pkg/charm/charm.go:63 +0x3f
main.main()
	/Users/phil/work/zed/cmd/zq/main.go:11 +0x5b

Details

Repro is with Zed commit 0db1b73.

I totally expected that Zed tooling would refuse to output primitive Zed values in Zeek TSV since as far as I know the Zeek TSV log format assumes everything must fit into a record. That said, we'd ideally not want to panic.

I happened to try the error value first, then found the simpler string value also created a panic. Since the panics look a bit different I've included both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant