Go version: go1.26.0 linux/amd64
Bun version: latest (v1.2.17)
This looks pretty similar to #1306 but is much easier to replicate - simply select more columns than you're scanning into and the query never returns.
To replicate, make a small change to the basic example:
if err := db.NewSelect().
ColumnExpr("id, name"). // select 2 columns
Model((*User)(nil)).
OrderExpr("id ASC").
Scan(ctx, &ids); err != nil { // scan into a single slice of scalars
panic(err) // never reached!
}
Stack trace:
runtime.gopark (proc.go:463) runtime
runtime.goparkunlock (proc.go:468) runtime
runtime.semacquire1 (sema.go:192) runtime
sync.runtime_SemacquireRWMutex (sema.go:105) sync
sync.(*RWMutex).Lock (rwmutex.go:155) sync
sql.(*Rows).close (sql.go:3443) database/sql
sql.(*Rows).Close (sql.go:3439) database/sql
bun.(*baseQuery)._scan.deferwrap1 (query_base.go:622) github.com/uptrace/bun
runtime.gopanic (panic.go:860) runtime
runtime.panicBounds64 (panic.go:236) runtime
runtime.panicBounds (asm_amd64.s:2129) runtime
bun.(*sliceModel).Scan (model_slice.go:77) github.com/uptrace/bun
sql.convertAssignRows (convert.go:394) database/sql
sql.(*Rows).scanLocked (sql.go:3399) database/sql
sql.(*Rows).Scan (sql.go:3374) database/sql
bun.(*sliceModel).ScanRows (model_slice.go:64) github.com/uptrace/bun
bun.(*baseQuery)._scan (query_base.go:624) github.com/uptrace/bun
bun.(*baseQuery).scan (query_base.go:606) github.com/uptrace/bun
bun.(*SelectQuery).scanResult (query_select.go:904) github.com/uptrace/bun
bun.(*SelectQuery).Scan (query_select.go:862) github.com/uptrace/bun
main.main (main.go:75) main
runtime.main (proc.go:290) runtime
runtime.goexit (asm_amd64.s:1771) runtime
- Async Stack Trace
<autogenerated>:2
runtime.gopark (proc.go:463) runtime
runtime.goparkunlock (proc.go:468) runtime
runtime.semacquire1 (sema.go:192) runtime
sync.runtime_SemacquireRWMutex (sema.go:105) sync
sync.(*RWMutex).Lock (rwmutex.go:155) sync
sql.(*Rows).close (sql.go:3443) database/sql
sql.(*Rows).Close (sql.go:3439) database/sql
bun.(*baseQuery)._scan.deferwrap1 (query_base.go:622) github.com/uptrace/bun
runtime.gopanic (panic.go:860) runtime
runtime.panicBounds64 (panic.go:236) runtime
runtime.panicBounds (asm_amd64.s:2129) runtime
bun.(*sliceModel).Scan (model_slice.go:77) github.com/uptrace/bun
sql.convertAssignRows (convert.go:394) database/sql
sql.(*Rows).scanLocked (sql.go:3399) database/sql
sql.(*Rows).Scan (sql.go:3374) database/sql
bun.(*sliceModel).ScanRows (model_slice.go:64) github.com/uptrace/bun
bun.(*baseQuery)._scan (query_base.go:624) github.com/uptrace/bun
bun.(*baseQuery).scan (query_base.go:606) github.com/uptrace/bun
bun.(*SelectQuery).scanResult (query_select.go:904) github.com/uptrace/bun
bun.(*SelectQuery).Scan (query_select.go:862) github.com/uptrace/bun
main.main (main.go:75) main
The underlying panic is an index out of range here.
Go version: go1.26.0 linux/amd64
Bun version: latest (v1.2.17)
This looks pretty similar to #1306 but is much easier to replicate - simply select more columns than you're scanning into and the query never returns.
To replicate, make a small change to the basic example:
Stack trace:
The underlying panic is an index out of range here.