mattn / mattn/go-sqlite3

"unexpected signal during runtime execution" when setting compile time options

Open
#1,153 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
9.2k
Forks
1.2k
Avg merge
19m
Merged PRs (30d)
4

Description

When I run go build with sqlite compile time flags such as CGO_CFLAGS="-DSQLITE_OMIT_AUTOINIT", go panics with unexpected signal during runtime execution.

Is it possible to set sqlite compile time flags? Is there another way that this should be done?

Partial stack trace:

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

runtime stack:
runtime.throw({0x2432e3d?, 0xffffffff000036b9?})
        /usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0x7f183fffeee0 sp=0x7f183fffeeb0 pc=0x43b0dd
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:821 +0x3e9 fp=0x7f183fffef40 sp=0x7f183fffeee0 pc=0x452129

goroutine 1 [syscall]:
runtime.cgocall(0x1caddb0, 0xc000daf030)
        /usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc000daf008 sp=0xc000daefd0 pc=0x405edc
github.com/mattn/go-sqlite3._Cfunc__sqlite3_open_v2(0x7f1838000dd0, 0xc001309e90, 0x10006, 0x0)
        _cgo_gotypes.go:305 +0x4c fp=0xc000daf030 sp=0xc000daf008 pc=0xce7ccc
github.com/mattn/go-sqlite3.(*SQLiteDriver).Open.func3(0x7f1838000dd0?, 0x23?, 0x10000, 0x3?)
        /home/circleci/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.15/sqlite3.go:1456 +0x72 fp=0xc000daf080 sp=0xc000daf030 pc=0xcf9152
github.com/mattn/go-sqlite3.(*SQLiteDriver).Open(0xc0001a4a40, {0xc000d81ce0, 0x2c})
        /home/circleci/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.15/sqlite3.go:1456 +0x27b4 fp=0xc000daf6b0 sp=0xc000daf080 pc=0xcf67b4
database/sql.dsnConnector.Connect(...)
        /usr/local/go/src/database/sql/sql.go:758
database/sql.(*dsnConnector).Connect(0x26?, {0x800?, 0x1c58540?})
        <autogenerated>:1 +0x3a fp=0xc000daf6d8 sp=0xc000daf6b0 pc=0xca749a
database/sql.(*DB).conn(0xc000ddaf70, {0x29ec228, 0xc00018a000}, 0x1)
        /usr/local/go/src/database/sql/sql.go:1387 +0x763 fp=0xc000daf850 sp=0xc000daf6d8 pc=0xc9b343
database/sql.(*DB).exec(0xc0011780d0?, {0x29ec228, 0xc00018a000}, {0x23f52d7, 0x19}, {0x0, 0x0, 0x0}, 0x78?)
        /usr/local/go/src/database/sql/sql.go:1651 +0x5d fp=0xc000daf8c8 sp=0xc000daf850 pc=0xc9cd7d
database/sql.(*DB).ExecContext.func1(0x16?)
        /usr/local/go/src/database/sql/sql.go:1634 +0x55 fp=0xc000daf930 sp=0xc000daf8c8 pc=0xc9cbf5
database/sql.(*DB).retry(0x40fd28?, 0xc000daf9a8)
        /usr/local/go/src/database/sql/sql.go:1538 +0x47 fp=0xc000daf978 sp=0xc000daf930 pc=0xc9c167
database/sql.(*DB).ExecContext(0x2406e20?, {0x29ec228?, 0xc00018a000?}, {0x23f52d7?, 0x1?}, {0x0?, 0x24?, 0x0?})
        /usr/local/go/src/database/sql/sql.go:1633 +0xcc fp=0xc000dafa10 sp=0xc000daf978 pc=0xc9cb0c
database/sql.(*DB).Exec(...)
        /usr/local/go/src/database/sql/sql.go:1647

[...]

goroutine 86 [select]:
runtime.gopark(0xc000081f88?, 0x2?, 0x28?, 0xfd?, 0xc000081f84?)
        /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000081e10 sp=0xc000081df0 pc=0x43ddf6
runtime.selectgo(0xc000081f88, 0xc000081f80, 0xc0011b6c60?, 0x0, 0x0?, 0x1)
        /usr/local/go/src/runtime/select.go:327 +0x7be fp=0xc000081f50 sp=0xc000081e10 pc=0x44e0be
database/sql.(*DB).connectionOpener(0xc000ddaf70, {0x29ec1f0, 0xc0012e5680})
        /usr/local/go/src/database/sql/sql.go:1218 +0x8d fp=0xc000081fb8 sp=0xc000081f50 pc=0xc9a66d
database/sql.OpenDB.func1()
        /usr/local/go/src/database/sql/sql.go:791 +0x2e fp=0xc000081fe0 sp=0xc000081fb8 pc=0xc989ee
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000081fe8 sp=0xc000081fe0 pc=0x4724a1
created by database/sql.OpenDB
        /usr/local/go/src/database/sql/sql.go:791 +0x18d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with go build and CGO_CFLAGS="-DSQLITE_OMIT_AUTOINIT", then inspect the SQLiteDriver.Open call at sqlite3.go:1456 and the _Cfunc__sqlite3_open_v2 stack entry. Determine whether compile-time SQLite flags are supported and what change or documented usage is needed to prevent the reported runtime panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go, sqlite
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.