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 while using sqlite rows.Next() - fatal error: unexpected signal during runtime execution #1245

Open
flolege opened this issue May 25, 2024 · 0 comments

Comments

@flolege
Copy link

flolege commented May 25, 2024

go version 1.19
go-sqlite3 version 1.14.21

I am using the import

"database/sql"

and open the DB like this:

db, err = sql.Open("sqlite3", dbPath)

and then in my program I use this connection every second or so for a query very fast, not really caring about concurrency since the slq.Open function says "The returned DB is safe for concurrent use by multiple goroutines and maintains its own pool of idle connections. Thus, the Open function should be called just once. It is rarely necessary to close a DB."

If someone had an idea in which direction this issue is going, I would appreciate it very much.

The error happens exactly at the

for rows.Next()

line. The amount of rows is over 5 Millions, maybe that is a hint.

Here is the call stack:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x482705]

runtime stack:
runtime.throw({0x186b4f8?, 0x7fe6627fb9d8?})
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0x7fe6627fb990 sp=0x7fe6627fb960 pc=0x463d1d
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:819 +0x369 fp=0x7fe6627fb9e0 sp=0x7fe6627fb990 pc=0x47a749
runtime: g 0: unexpected return pc for runtime.findfunc called from 0x1d05cfa83c9f6500
stack: frame={sp:0x7fe6627fb9e0, fp:0x7fe6627fba00} stack=[0x7fe661ffc1d8,0x7fe6627fbdd8)
0x00007fe6627fb8e0: 0x000000c000103040 0x0000000001b0dce0
0x00007fe6627fb8f0: 0x0000000000000001 0x00007fe6627fb960
0x00007fe6627fb900: 0x0000000000463d1d <runtime.throw+0x000000000000005d> 0x000000c000103040
0x00007fe6627fb910: 0x00007fe6627fb950 0x000000000046406c <runtime.fatalthrow+0x000000000000006c>
0x00007fe6627fb920: 0x00007fe6627fb930 0x000000c000103040
0x00007fe6627fb930: 0x00000000004640a0 <runtime.fatalthrow.func1+0x0000000000000000> 0x000000c000103040
0x00007fe6627fb940: 0x0000000000463d1d <runtime.throw+0x000000000000005d> 0x00007fe6627fb960
0x00007fe6627fb950: 0x00007fe6627fb980 0x0000000000463d1d <runtime.throw+0x000000000000005d>
0x00007fe6627fb960: 0x00007fe6627fb968 0x0000000000463d40 <runtime.throw.func1+0x0000000000000000>
0x00007fe6627fb970: 0x000000000186b4f8 0x000000000000002a
0x00007fe6627fb980: 0x00007fe6627fb9d0 0x000000000047a749 <runtime.sigpanic+0x0000000000000369>
0x00007fe6627fb990: 0x000000000186b4f8 0x00007fe6627fb9d8
0x00007fe6627fb9a0: 0x0000000000483314 <runtime.funcspdelta+0x0000000000000034> 0x00000000023c42a0
0x00007fe6627fb9b0: 0x0000000002538da0 0x000000000023990c
0x00007fe6627fb9c0: 0x0000000000e958e5 <github.com/mattn/go-sqlite3.(*SQLiteRows).nextSyncLocked+0x0000000000000105> 0x00007fe6627fbb48
0x00007fe6627fb9d0: 0x00007fe6627fbd48 0x0000000000482705 <runtime.findfunc+0x0000000000000025>
0x00007fe6627fb9e0: <0x000000000048a398 <runtime.gentraceback+0x0000000000000878> 0x00000000023c42a0
0x00007fe6627fb9f0: 0x0000000002538da0 !0x1d05cfa83c9f6500
0x00007fe6627fba00: >0x00007fe648005cf0 0x000000c0e03cd8f0
0x00007fe6627fba10: 0x000000c0e03ce000 0xffffffffffffff00
0x00007fe6627fba20: 0x0000000000000004 0x000000000130b5c6
0x00007fe6627fba30: 0x0000000000000000 0x000000c01001d520
0x00007fe6627fba40: 0x000000c0e03ce000 0x0000000001393b79
0x00007fe6627fba50: 0x0000000000000000 0x000000000011e51b
0x00007fe6627fba60: 0x0000000000000005 0x0000000000000004
0x00007fe6627fba70: 0x0000000000e955b3 <github.com/mattn/go-sqlite3.(*SQLiteRows).Next+0x00000000000002f3> 0xffffffffffffffff
0x00007fe6627fba80: 0x000000c0e03cdfd8 0x0000000000000000
0x00007fe6627fba90: 0x00007fe648000eb8 0x00007fe648000d38
0x00007fe6627fbaa0: 0x0000000000000000 0x00007fe64c00f799
0x00007fe6627fbab0: 0x0000000000000000 0x000000000100a133 <github.com/cockroachdb/redact/internal.(*pp).fmtInteger+0x0000000000000053>
0x00007fe6627fbac0: 0x00000000003796ab 0x000cf15609831ba8
0x00007fe6627fbad0: 0x000cf15601dc6df2 0x000000c000000000
0x00007fe6627fbae0: 0x0000000000000000 0x00007fe6627fbb30
0x00007fe6627fbaf0: 0x0000000000000000 0x000000000000000a
runtime.findmoduledatap(...)
/usr/local/go/src/runtime/symtab.go:792
runtime.findfunc(0x7fe648005cf0?)
/usr/local/go/src/runtime/symtab.go:829 +0x25 fp=0x7fe6627fba00 sp=0x7fe6627fb9e0 pc=0x482705

goroutine 36002 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:459 fp=0xc0e03cd6f8 sp=0xc0e03cd6f0 pc=0x496420
runtime.addOneOpenDeferFrame(0x0?, 0x7fe63030f000?, 0xc0e03cd780?)
/usr/local/go/src/runtime/panic.go:644 +0x69 fp=0xc0e03cd738 sp=0xc0e03cd6f8 pc=0x462de9
panic({0x1620900, 0x24f0450})
/usr/local/go/src/runtime/panic.go:844 +0x112 fp=0xc0e03cd7f8 sp=0xc0e03cd738 pc=0x463632
runtime.panicmem(...)
/usr/local/go/src/runtime/panic.go:260
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:835 +0x2f6 fp=0xc0e03cd848 sp=0xc0e03cd7f8 pc=0x47a6d6
runtime.mallocgc(0x12e1600, 0xc0e03cd920, 0x0)
/usr/local/go/src/runtime/malloc.go:892 +0xd7 fp=0xc0e03cd8c0 sp=0xc0e03cd848 pc=0x436db7
runtime.mallocgc(0x8, 0x7fe6480065b8, 0x2)
/usr/local/go/src/runtime/malloc.go:1070 +0x69f fp=0xc0e03cd938 sp=0xc0e03cd8c0 pc=0x43737f
runtime.convT64(0x2e36)
/usr/local/go/src/runtime/iface.go:382 +0x45 fp=0xc0e03cd960 sp=0xc0e03cd938 pc=0x434fc5
github.com/mattn/go-sqlite3.(*SQLiteRows).nextSyncLocked(0xc0c12948a0, {0xc0dae5eae0, 0x3, 0x159ed20?})
/root/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.21/sqlite3.go:2206 +0x105 fp=0xc0e03cda50 sp=0xc0e03cd960 pc=0xe958e5
github.com/mattn/go-sqlite3.(*SQLiteRows).Next(0xc0c12948a0, {0xc0dae5eae0?, 0x3, 0x3})
/root/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.21/sqlite3.go:2168 +0x2f3 fp=0xc0e03cdb08 sp=0xc0e03cda50 pc=0xe955b3
database/sql.(*Rows).nextLocked(0xc0f472ba00)
/usr/local/go/src/database/sql/sql.go:3008 +0x11a fp=0xc0e03cdb68 sp=0xc0e03cdb08 pc=0xe7adba
database/sql.(*Rows).Next.func1()
/usr/local/go/src/database/sql/sql.go:2986 +0x2f fp=0xc0e03cdb90 sp=0xc0e03cdb68 pc=0xe7ac6f
database/sql.withLock({0x1b1a820, 0xc0f472ba30}, 0xc0e03cdbf0)
/usr/local/go/src/database/sql/sql.go:3439 +0x8c fp=0xc0e03cdbd0 sp=0xc0e03cdb90 pc=0xe7d1ac
database/sql.(*Rows).Next(0xc0f472ba00)
/usr/local/go/src/database/sql/sql.go:2985 +0x6f fp=0xc0e03cdc20 sp=0xc0e03cdbd0 pc=0xe7abef
sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant