minio / simdjson-go

Golang port of simdjson: parsing gigabytes of JSON per second

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal error: checkptr: unsafe pointer arithmetic on Go 1.14

lukasmalkmus opened this issue · comments

Noticed our tests which are run with -race by default are panicking on Go 1.14. This is caused by a new checker in 1.14 as described in https://tip.golang.org/doc/go1.14#compiler.

Easily reproducible by running the tests for the package with -race enabled (go test -race):

fatal error: checkptr: unsafe pointer arithmetic

goroutine 54 [running]:
runtime.throw(0x176c4c5, 0x23)
	/usr/local/Cellar/go/1.14/libexec/src/runtime/panic.go:1112 +0x72 fp=0xc00005da78 sp=0xc00005da48 pc=0x1073a12
runtime.checkptrArithmetic(0xc022086002, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.14/libexec/src/runtime/checkptr.go:41 +0xb5 fp=0xc00005daa8 sp=0xc00005da78 pc=0x1045a95
github.com/minio/simdjson-go.parse_string_simd_validate_only(0xc022086001, 0x15c8ecd7, 0x1ffffdff, 0xc00005ddf8, 0xc00005db58, 0xc00005db4f, 0x0)
	/Users/lukasmalkmus/Code/test/parse_string_amd64.go:39 +0x6d fp=0xc00005db08 sp=0xc00005daa8 pc=0x163a85d
github.com/minio/simdjson-go.parse_string(0xc0022dc000, 0x1, 0x8, 0x1044b3b)
	/Users/lukasmalkmus/Code/test/stage2_build_tape_amd64.go:90 +0x1a9 fp=0xc00005dde8 sp=0xc00005db08 pc=0x16526f9
github.com/minio/simdjson-go.unified_machine(0xc022086000, 0x15c8ecd8, 0x1ffffe00, 0xc0022dc000, 0x0)
	/Users/lukasmalkmus/Code/test/stage2_build_tape_amd64.go:249 +0x2775 fp=0xc00005df68 sp=0xc00005dde8 pc=0x1656535
github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal.func2(0xc0022dc000, 0xc00011a640, 0xc00030a020)
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:89 +0x67 fp=0xc00005dfc8 sp=0xc00005df68 pc=0x166e147
runtime.goexit()
	/usr/local/Cellar/go/1.14/libexec/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00005dfd0 sp=0xc00005dfc8 pc=0x10a7371
created by github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:88 +0x2c4

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001ca480, 0x1763be6, 0x14, 0x178b290, 0x1)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1044 +0x699
testing.runTests.func1(0xc0001ca480)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1285 +0xa7
testing.tRunner(0xc0001ca480, 0xc00013dd50)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0x1ec
testing.runTests(0xc000134a20, 0x1cd7ee0, 0x21, 0x21, 0x0)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1283 +0x528
testing.(*M).Run(0xc0001ea000, 0x0)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1200 +0x300
main.main()
	_testmain.go:252 +0x224

goroutine 39 [semacquire]:
sync.runtime_Semacquire(0xc00030a028)
	/usr/local/Cellar/go/1.14/libexec/src/runtime/sema.go:56 +0x42
sync.(*WaitGroup).Wait(0xc00030a020)
	/usr/local/Cellar/go/1.14/libexec/src/sync/waitgroup.go:130 +0xd4
github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal(0xc0022dc000, 0xc022086000, 0x15c8ecd8, 0x1ffffe00, 0x15c8ec01, 0x1ffffe00, 0xc000286090)
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:98 +0x2d2
github.com/minio/simdjson-go.(*internalParsedJson).parseMessageNdjson(...)
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:56
github.com/minio/simdjson-go.ParseND(0xc022086000, 0x15c8ecd9, 0x1ffffe00, 0x0, 0x1ffffe00, 0x0, 0x11ae3b0)
	/Users/lukasmalkmus/Code/test/simdjson_amd64.go:78 +0x105
github.com/minio/simdjson-go.TestNdjsonCountWhere(0xc000161d40)
	/Users/lukasmalkmus/Code/test/ndjson_test.go:259 +0x149
testing.tRunner(0xc000161d40, 0x178b290)
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0x1ec
created by testing.(*T).Run
	/usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x661

goroutine 9 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc0000764e0)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 10 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc0000765b0)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 11 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc000076680)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 12 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc000076750)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 13 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc000076820)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 14 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc0000768f0)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 15 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc0000769c0)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 16 [chan receive]:
github.com/klauspost/compress/zstd.(*blockDec).startDecoder(0xc000076a90)
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:195 +0xd2
created by github.com/klauspost/compress/zstd.newBlockDec
	/Users/lukasmalkmus/Code/Go/pkg/mod/github.com/klauspost/compress@v1.10.1/zstd/blockdec.go:110 +0x18e

goroutine 53 [runnable]:
github.com/minio/simdjson-go.find_structural_indices(0xc022092a00, 0x15c822d8, 0x1fff3400, 0xc0022dc000, 0x200000)
	/Users/lukasmalkmus/Code/test/stage1_find_marks_amd64.go:119 +0x603
github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal.func1(0xc0022dc000, 0xc00011a660, 0xc00030a020)
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:83 +0x67
created by github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal
	/Users/lukasmalkmus/Code/test/parse_json_amd64.go:82 +0x28b
exit status 2
FAIL	github.com/minio/simdjson-go	16.687s

Thanks for submitting the issue, we will investigate.

@fwessels reproduced here

=== RUN   TestJSONQueries/simd-select-in-array-full
fatal error: checkptr: unsafe pointer arithmetic
goroutine 13 [running]:
runtime.throw(0xaffd2a, 0x23)
	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/panic.go:1116 +0x72 fp=0xc00004fa78 sp=0xc00004fa48 pc=0x462cd2
runtime.checkptrArithmetic(0xc000f02002, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/checkptr.go:43 +0xb5 fp=0xc00004faa8 sp=0xc00004fa78 pc=0x434805
github.com/minio/simdjson-go.parse_string_simd_validate_only(0xc000f02001, 0x170, 0xa003ff, 0xc00004fdf8, 0xc00004fb58, 0xc00004fb4f, 0x0)
	/home/travis/gopath/pkg/mod/github.com/minio/simdjson-go@v0.1.5-0.20200303142138-b17fe061ea37/parse_string_amd64.go:39 +0x6d fp=0xc00004fb08 sp=0xc00004faa8 pc=0x8fc7ad
github.com/minio/simdjson-go.parse_string(0xc00016e000, 0x1, 0x4, 0x0)
	/home/travis/gopath/pkg/mod/github.com/minio/simdjson-go@v0.1.5-0.20200303142138-b17fe061ea37/stage2_build_tape_amd64.go:90 +0x1a9 fp=0xc00004fde8 sp=0xc00004fb08 pc=0x9093d9
github.com/minio/simdjson-go.unified_machine(0xc000f02000, 0x171, 0xa00400, 0xc00016e000, 0x0)
	/home/travis/gopath/pkg/mod/github.com/minio/simdjson-go@v0.1.5-0.20200303142138-b17fe061ea37/stage2_build_tape_amd64.go:249 +0x2775 fp=0xc00004ff68 sp=0xc00004fde8 pc=0x90d215
github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal.func2(0xc00016e000, 0xc000030020, 0xc0000a0000)
	/home/travis/gopath/pkg/mod/github.com/minio/simdjson-go@v0.1.5-0.20200303142138-b17fe061ea37/parse_json_amd64.go:89 +0x67 fp=0xc00004ffc8 sp=0xc00004ff68 pc=0x90f957
runtime.goexit()
	/home/travis/.gimme/versions/go1.14.2.linux.amd64/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00004ffd0 sp=0xc00004ffc8 pc=0x496831
created by github.com/minio/simdjson-go.(*internalParsedJson).parseMessageInternal
	/home/travis/gopath/pkg/mod/github.com/minio/simdjson-go@v0.1.5-0.20200303142138-b17fe061ea37/parse_json_amd64.go:88 +0x2c4

https://travis-ci.org/github/minio/minio/jobs/673248092

Fixed with commit 41d5568.
Test are now passing again.