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

SEGV when incorrectly attempting to "from" a pool with zq #4935

Closed
philrz opened this issue Dec 13, 2023 · 1 comment · Fixed by #4936
Closed

SEGV when incorrectly attempting to "from" a pool with zq #4935

philrz opened this issue Dec 13, 2023 · 1 comment · Fixed by #4936
Labels
bug Something isn't working

Comments

@philrz
Copy link
Contributor

philrz commented Dec 13, 2023

Repro is with Zed commit 40639dc, which is associated with the changes in #4808 (cc: @mattnibs).

I mistakenly invoked zq instead of zed query and happened to bump into this stack trace.

$ zq -version
Version: v1.10.0-17-g40639dce

$ zq 'from TestPool | count()'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x223709f]

goroutine 1 [running]:
github.com/brimdata/zed/compiler/data.(*Source).IsLake(...)
	/Users/phil/work/zed/compiler/data/source.go:32
github.com/brimdata/zed/compiler/semantic.(*analyzer).semSource(0xc00041f9c8, {0x284b100?, 0xc000054600?})
	/Users/phil/work/zed/compiler/semantic/op.go:160 +0x79f
github.com/brimdata/zed/compiler/semantic.(*analyzer).semTrunk(0xdb?, {{0xc00075b6d0, 0x5}, {0x284b100, 0xc000054600}, {0x0, 0x0, 0x0}}, {0x0, 0x0, ...})
	/Users/phil/work/zed/compiler/semantic/op.go:66 +0xf1
github.com/brimdata/zed/compiler/semantic.(*analyzer).semFrom(0x24ba820?, 0xc0007334a0?, {0x0?, 0x23f39a0?, 0xc00041f2c0?})
	/Users/phil/work/zed/compiler/semantic/op.go:42 +0x125
github.com/brimdata/zed/compiler/semantic.(*analyzer).semOp(0x60?, {0x284b0e0?, 0xc000770660?}, {0x0?, 0xc00041f960?, 0x1011045?})
	/Users/phil/work/zed/compiler/semantic/op.go:412 +0x79
github.com/brimdata/zed/compiler/semantic.(*analyzer).semSeq(0x100?, {0xc00076c120?, 0x2, 0xc000718fd8?})
	/Users/phil/work/zed/compiler/semantic/op.go:29 +0x85
github.com/brimdata/zed/compiler/semantic.Analyze({0x285f918?, 0x3625e40}, {0xc00076c120, 0x2, 0x2}, 0x0, 0x0)
	/Users/phil/work/zed/compiler/semantic/analyzer.go:19 +0x1db
github.com/brimdata/zed/cli/queryflags.(*Flags).ParseSourcesAndInputs(0xc0001384d8, {0xc000040050, 0x1, 0x1})
	/Users/phil/work/zed/cli/queryflags/flags.go:40 +0x1d9
github.com/brimdata/zed/cli/zq.(*Command).Run(0xc000138380, {0xc000040050, 0x1, 0x1})
	/Users/phil/work/zed/cli/zq/command.go:132 +0x24a
github.com/brimdata/zed/pkg/charm.path.run({0xc000638290?, 0x1, 0x1}, {0xc000040050?, 0x1, 0x0?})
	/Users/phil/work/zed/pkg/charm/path.go:11 +0x79
github.com/brimdata/zed/pkg/charm.(*Spec).ExecRoot(0x100874b?, {0xc000040050, 0x1, 0x1})
	/Users/phil/work/zed/pkg/charm/charm.go:63 +0x3f
main.main()
	/Users/phil/work/zed/cmd/zq/main.go:11 +0x5b

I confirmed via binary search that this doesn't happen at the commit right before that.

$ zq -version
Version: v1.10.0-16-gef9695f2

$ zq 'from TestPool | count()'
semantic analyzer: from pool cannot be used without a lake
@philrz
Copy link
Contributor Author

philrz commented Dec 14, 2023

Verified in Zed commit 59b72d8.

Repeating the repro attempt, now instead of a SEGV and stack trace we see an brief error message.

$ zq -version
Version: v1.11.1-27-g59b72d88

$ zq 'from TestPool | count()'
zq: no such file: from TestPool | count()

i.e., what's between the quotes is interpreted as a filename. As discussed in #4936 we might improve on this error message at some point, but for now we're banking the improvement of no longer dumping a stack trace.

Thanks @mattnibs!

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

Successfully merging a pull request may close this issue.

1 participant