-
Notifications
You must be signed in to change notification settings - Fork 964
Open
Labels
Description
Version
1.30.0
What happened?
When using pgx driver (at least), if using sql.[].database.uri, sqlc will crash like below when using the docker image sqlc/sqlc because pgx builds upon the default config which requires calling "os/user" user.Current().
Removing that config param avoids the crash.
I believe it can be fixed by having a slightly bigger image with libc (I believe -tags osusergo can be used to avoid this dependency), still, you would need /etc/passwd for this to work.
SIGFPE: floating-point exception
PC=0x7f3e703abe8b m=13 sigcode=1
signal arrived during cgo execution
instruction bytes: 0x49 0xf7 0xf0 0x48 0x29 0xd1 0x48 0x89 0xf2 0x48 0x8d 0x84 0xe 0x0 0x8 0x0
goroutine 15 gp=0xc000520700 m=13 mp=0xc000880008 [syscall]:
runtime.cgocall(0x16dab20, 0xc0004cf958)
/usr/local/go/src/runtime/cgocall.go:167 +0x4b fp=0xc0004cf930 sp=0xc0004cf8f8 pc=0x48848b
os/user._Cfunc_mygetpwuid_r(0x0, 0xc000b2c000, 0x400, 0xc000b16048, 0xc000b1604c)
_cgo_gotypes.go:166 +0x5c fp=0xc0004cf958 sp=0xc0004cf930 pc=0xad35bc
os/user._C_getpwuid_r(0x0, 0xc000b2c000, 0x400)
/usr/local/go/src/os/user/cgo_lookup_cgo.go:91 +0x9a fp=0xc0004cf9f8 sp=0xc0004cf958 pc=0xad37da
os/user.lookupUnixUid.func1({0xc000b2c000?, 0x42a3b7?, 0x7f3e7043d008?})
/usr/local/go/src/os/user/cgo_lookup_unix.go:57 +0x55 fp=0xc0004cfaa0 sp=0xc0004cf9f8 pc=0xad2ff5
os/user.retryWithBuffer(0xb16040?, 0xc0004cfb90)
/usr/local/go/src/os/user/cgo_lookup_unix.go:171 +0x69 fp=0xc0004cfb00 sp=0xc0004cfaa0 pc=0xad3389
os/user.lookupUnixUid(0x0)
/usr/local/go/src/os/user/cgo_lookup_unix.go:55 +0x7d fp=0xc0004cfbc0 sp=0xc0004cfb00 pc=0xad2e5d
os/user.current()
/usr/local/go/src/os/user/cgo_lookup_unix.go:19 +0x45 fp=0xc0004cfc00 sp=0xc0004cfbc0 pc=0xad2dc5
os/user.Current.func1()
/usr/local/go/src/os/user/lookup.go:22 +0xf fp=0xc0004cfc10 sp=0xc0004cfc00 pc=0xad388f
sync.(*Once).doSlow(0x1cad183?, 0x4?)
/usr/local/go/src/sync/once.go:78 +0xac fp=0xc0004cfc68 sp=0xc0004cfc10 pc=0x49dfcc
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:69
os/user.Current()
/usr/local/go/src/os/user/lookup.go:22 +0x30 fp=0xc0004cfca0 sp=0xc0004cfc68 pc=0xad3470
github.com/jackc/pgx/v5/pgconn.defaultSettings()
/go/pkg/mod/github.com/jackc/pgx/v5@v5.7.5/pgconn/defaults.go:21 +0xe5 fp=0xc0004cfe10 sp=0xc0004cfca0 pc=0xadbf85
github.com/jackc/pgx/v5/pgconn.ParseConfigWithOptions({0xc000b26040, 0x35}, {0x61d9ec?})
/go/pkg/mod/github.com/jackc/pgx/v5@v5.7.5/pgconn/config.go:248 +0x3a fp=0xc0004d0500 sp=0xc0004cfe10 pc=0xad691a
github.com/jackc/pgx/v5.ParseConfigWithOptions({0xc000b26040, 0x35}, {{0x2?}})
/go/pkg/mod/github.com/jackc/pgx/v5@v5.7.5/conn.go:165 +0x2f fp=0xc0004d05a0 sp=0xc0004d0500 pc=0xc2726f
github.com/jackc/pgx/v5.ParseConfig(...)
/go/pkg/mod/github.com/jackc/pgx/v5@v5.7.5/conn.go:236
github.com/jackc/pgx/v5/pgxpool.ParseConfig({0xc000b26040?, 0xc0004a44b0?})
/go/pkg/mod/github.com/jackc/pgx/v5@v5.7.5/pgxpool/pool.go:310 +0x2a fp=0xc0004d0668 sp=0xc0004d05a0 pc=0xc3ebca
github.com/sqlc-dev/sqlc/internal/engine/postgresql/analyzer.(*Analyzer).Analyze(0xc0002a0780, {0x204d568, 0x3add900}, {0x2035a40, 0xc0003520e0}, {0xc000826d80, 0x1e5}, {0xc0003af1f0, 0x1, 0x1}, ...)
/workspace/internal/engine/postgresql/analyzer/analyze.go:217 +0x216 fp=0xc0004d0818 sp=0xc0004d0668 pc=0xf9a9f6
github.com/sqlc-dev/sqlc/internal/analyzer.(*CachedAnalyzer).Analyze(0xc000628700, {0x204d568, 0x3add900}, {0x2035a40, 0xc0003520e0}, {0xc000826d80, 0x1e5}, {0xc0003af1f0, 0x1, 0x1}, ...)
/workspace/internal/analyzer/analyzer.go:45 +0x16f fp=0xc0004d08a0 sp=0xc0004d0818 pc=0xcce36f
github.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).parseQuery(0xc00047f908, {0x2035a40, 0xc0003520e0}, {0xc000826d80, 0xd08}, {{0x0, 0x0, {0x0, 0x0}, 0x0, ...}})
/workspace/internal/compiler/parse.go:83 +0x456 fp=0xc0004d0a68 sp=0xc0004d08a0 pc=0x1119a36
github.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).parseQueries(0xc00047f908, {{0x0, 0x0, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0}})
/workspace/internal/compiler/compile.go:81 +0x478 fp=0xc0004d0c90 sp=0xc0004d0a68 pc=0x11101d8
github.com/sqlc-dev/sqlc/internal/compiler.(*Compiler).ParseQueries(...)
/workspace/internal/compiler/engine.go:76
github.com/sqlc-dev/sqlc/internal/cmd.parse({_, _}, {_, _}, {_, _}, {{0x0, 0x0}, {0xc0004a4470, 0xa}, ...}, ...)
/workspace/internal/cmd/generate.go:322 +0x2f6 fp=0xc0004d11c0 sp=0xc0004d0c90 pc=0x1662e96
github.com/sqlc-dev/sqlc/internal/cmd.processQuerySets.func1()
/workspace/internal/cmd/process.go:107 +0x857 fp=0xc0004d1f78 sp=0xc0004d11c0 pc=0x1665577
golang.org/x/sync/errgroup.(*Group).Go.func1()
/go/pkg/mod/golang.org/x/sync@v0.16.0/errgroup/errgroup.go:93 +0x50 fp=0xc0004d1fe0 sp=0xc0004d1f78 pc=0x1256970
runtime.goexit({})
/usr/local/go/src/runtime/asm_amd64.s:1693 +0x1 fp=0xc0004d1fe8 sp=0xc0004d1fe0 pc=0x493a41
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
/go/pkg/mod/golang.org/x/sync@v0.16.0/errgroup/errgroup.go:78 +0x95
[.....]
rax 0xffffffffffffffff
rbx 0x0
rcx 0xffffffffffffffff
rdx 0x0
rdi 0x800000
rsi 0x1000
rbp 0x7f3e437fd450
rsp 0x7f3e437fd0f0
r8 0x0
r9 0x0
r10 0x7f3e437fd0f0
r11 0x246
r12 0x32a45c0
r13 0x3
r14 0x7f3e34002eb0
r15 0x1
rip 0x7f3e703abe8b
rflags 0x10297
cs 0x33
fs 0x0
gs 0x0
Exception: docker exited with 2
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go