-
Notifications
You must be signed in to change notification settings - Fork 984
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Version
1.27.0
What happened?
sqlc throws a SIGSEGV when a WASM plugin fails to load.
That's caused by https://github.com/sqlc-dev/sqlc/blob/main/internal/ext/wasm/wasm.go#L226 where sqlc calls result.Close() on a wazero module, but wazero already closes modules on error.
Relevant log output
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb0 pc=0x1140027]
goroutine 8 [running]:
github.com/tetratelabs/wazero/internal/wasm.(*ModuleInstance).setExitCode(...)
github.com/tetratelabs/[email protected]/internal/wasm/module_instance.go:142
github.com/tetratelabs/wazero/internal/wasm.(*ModuleInstance).CloseWithExitCode(0x8?, {0x1dce8a0?, 0xc00036dc20?}, 0x1?)
github.com/tetratelabs/[email protected]/internal/wasm/module_instance.go:101 +0x27
github.com/tetratelabs/wazero/internal/wasm.(*ModuleInstance).Close(0xc0007bc090?, {0x1dce8a0?, 0xc00036dc20?})
github.com/tetratelabs/[email protected]/internal/wasm/module_instance.go:96 +0x1f
github.com/sqlc-dev/sqlc/internal/ext/wasm.(*Runner).Invoke(0xc0009cf3c0, {0x1dce8a0, 0xc00036dc20}, {0x1aa58a8, 0x1f}, {0x19991e0?, 0xc0007fa630?}, {0x18e1f80, 0xc0009cf400}, {0x0, ...})
github.com/sqlc-dev/sqlc/internal/ext/wasm/wasm.go:229 +0x1039
github.com/sqlc-dev/sqlc/internal/plugin.(*codegenServiceClient).Generate(0xc0005f8ad8, {0x1dce8a0, 0xc00036dc20}, 0xc0007fa630, {0x0, 0x0, 0x0})
github.com/sqlc-dev/sqlc/internal/plugin/codegen_grpc.pb.go:42 +0xc8
github.com/sqlc-dev/sqlc/internal/cmd.codegen({_, _}, {{{0x33eb9d0, 0x1}, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...}, ...)
github.com/sqlc-dev/sqlc/internal/cmd/generate.go:410 +0x552
github.com/sqlc-dev/sqlc/internal/cmd.(*generator).ProcessResult(_, {_, _}, {{{0x33eb9d0, 0x1}, {{0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...}, ...}, ...}, ...)
github.com/sqlc-dev/sqlc/internal/cmd/generate.go:203 +0xa5
github.com/sqlc-dev/sqlc/internal/cmd.processQuerySets.func1()
github.com/sqlc-dev/sqlc/internal/cmd/process.go:113 +0x8f0
golang.org/x/sync/errgroup.(*Group).Go.func1()
golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x96Database schema
NASQL queries
NAConfiguration
NAPlayground URL
No response
What operating system are you using?
No response
What database engines are you using?
No response
What type of code are you generating?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working