Skip to content

panic: segmentation violation during concurrent SELECTs #51

Closed
@raichu

Description

@raichu

When GOMAXPROCS=1 eveything works out fine but with GOMAXPROCS=4 I'm getting

SIGSEGV: segmentation violation
PC=0x7fe715011f7d
signal arrived during cgo execution

github.com/mattn/go-sqlite3._Cfunc__sqlite3_open_v2(0x259def0, 0xc20055e378, 0x10006, 0x0, 0xc1fffc3fa8, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:80 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteDriver).Open(0xc70a80, 0xc200192320, 0x9, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:128 +0x1a2
database/sql.(*DB).conn(0xc2001aef50, 0xc20055e370, 0xffffffffffffffff, 0xc2004269f0)

...
goroutine 74 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_step(0x7fe6a8000e48, 0xff00ffff)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:296 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteRows).Next(0xc200480540, 0xc20055f1a0, 0xd, 0xd, 0xd, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:323 +0x3a

...
goroutine 72 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_prepare_v2(0x7fe6bc0008e8, 0x7fe6bc011ca0, 0x7fe6ffffffff, 0xc200677008, 0xc200677010, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:278 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteConn).Prepare(0xc200677000, 0x86da50, 0xaf, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:174 +0xf5

...
goroutine 75 [syscall]:
github.com/mattn/go-sqlite3._Cfunc__sqlite3_open_v2(0x7fe6d4013ad0, 0xc20055e090, 0x7fe600010006, 0x0, 0x4, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:80 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteDriver).Open(0xc70a80, 0xc200192320, 0x9, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:128 +0x1a2

...
goroutine 71 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_prepare_v2(0x7fe6ec0158c8, 0x7fe6ec0021f0, 0x7fe6ffffffff, 0xc20044bb28, 0xc20044bb30, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:278 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteConn).Prepare(0xc20044bb20, 0x85df90, 0x41, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:174 +0xf5

...
goroutine 81 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_prepare_v2(0x7fe6d40008c8, 0x7fe6f00008c0, 0x7fe6ffffffff, 0xc20055e070, 0xc20055e078, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:278 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteConn).Prepare(0xc2006778a0, 0x86da50, 0xaf, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:174 +0xf5

...
goroutine 77 [syscall]:
github.com/mattn/go-sqlite3._Cfunc__sqlite3_open_v2(0x7fe6b00008c0, 0xc20055e558, 0x7fe600010006, 0x0, 0x4, ...)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:80 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteDriver).Open(0xc70a80, 0xc200192320, 0x9, 0x0, 0x0, ...)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:128 +0x1a2

...
goroutine 78 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_close(0x7fe6d80008c8, 0x0)
        github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:152 +0x2f
github.com/mattn/go-sqlite3.(*SQLiteConn).Close(0xc200677260, 0x7483e0, 0x4e68dd)
        github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:159 +0x7f

...
and so on

I'm basically running basic & simple SELECT queries, and scanning & closing rows.
Am I getting bitten by this? If yes, I'm wondering how should correct go programs be written: use locks for almost everything? use LockOSThread?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions