fix(json-marshaler): change json marshaler to prevent data races due result saving#137
Open
vhlebnikov wants to merge 1 commit intoozontech:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Привет, стали флакать тесты, как оказалось из-за data race при сериализации json результата после выполнения тестов. Проблема пакета "github.com/goccy/go-json", ниже приведу stacktrace
runtime: pointer 0xc000481ca0 to unallocated span span.base()=0xc000480000 span.limit=0xc000489f00 span.state=0 fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?) goroutine 101 gp=0xc0002fee00 m=5 mp=0xc0000bd808 [running]: runtime.throw({0x10623de?, 0xc00025ac80?}) /usr/local/go/src/runtime/panic.go:1094 +0x48 fp=0xc0008207f0 sp=0xc0008207c0 pc=0x4bdca8 runtime.badPointer(0x7f387d142c68, 0xc000481ca0, 0x0, 0x0) /usr/local/go/src/runtime/mbitmap.go:1292 +0x165 fp=0xc000820840 sp=0xc0008207f0 pc=0x458bc5 runtime.findObject(0xc0002d2680?, 0xc0003663e8?, 0xc000800000?) /usr/local/go/src/runtime/mbitmap.go:1344 +0x9e fp=0xc000820878 sp=0xc000820840 pc=0x4bc1fe runtime.checkptrBase(0xc000481ca0) /usr/local/go/src/runtime/checkptr.go:104 +0x3e fp=0xc0008208a0 sp=0xc000820878 pc=0x4ba69e runtime.checkptrStraddles(0xc000800000?, 0xc000800adb?) /usr/local/go/src/runtime/checkptr.go:47 +0x45 fp=0xc0008208c8 sp=0xc0008208a0 pc=0x44eba5 runtime.checkptrAlignment(0xc0002d2680?, 0xc0003663e8?, 0xc000800000?) /usr/local/go/src/runtime/checkptr.go:25 +0x3d fp=0xc0008208e8 sp=0xc0008208c8 pc=0x44eafd github.com/goccy/go-json/internal/encoder/vm.Run(0xc0002d2680, {0xc000136800, 0x0, 0x400}, 0xc000355f10) /builds/project/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go:527 +0x1d56 fp=0xc000829830 sp=0xc0008208e8 pc=0xc81a56 github.com/goccy/go-json.encodeRunCode(0xc0002d2680, {0xc000136800, 0x0, 0x400}, 0xc000355f10) /builds/project/vendor/github.com/goccy/go-json/encode.go:310 +0x235 fp=0xc0008298a0 sp=0xc000829830 pc=0xcdb955 github.com/goccy/go-json.encode(0xc0002d2680, {0x10219e0, 0xc000225c80}) /builds/project/vendor/github.com/goccy/go-json/encode.go:235 +0x47d fp=0xc000829970 sp=0xc0008298a0 pc=0xcdb5fd github.com/goccy/go-json.marshal({0x10219e0, 0xc000225c80}, {0x0, 0x0, 0x0?}) /builds/project/vendor/github.com/goccy/go-json/encode.go:150 +0x16a fp=0xc000829a00 sp=0xc000829970 pc=0xcdb06a github.com/goccy/go-json.MarshalWithOption(...) /builds/project/vendor/github.com/goccy/go-json/json.go:185 github.com/goccy/go-json.Marshal({0x10219e0, 0xc000225c80}) /builds/project/vendor/github.com/goccy/go-json/json.go:170 +0x3b fp=0xc000829a60 sp=0xc000829a00 pc=0xcdba1b github.com/ozontech/allure-go/pkg/allure.(*Result).printResult(0xc000225c80) /builds/project/vendor/github.com/ozontech/allure-go/pkg/allure/result.go:278 +0x39 fp=0xc000829ae0 sp=0xc000829a60 pc=0xced819 github.com/ozontech/allure-go/pkg/allure.(*Result).Print(0xc000225c80) /builds/project/vendor/github.com/ozontech/allure-go/pkg/allure/result.go:273 +0x4f fp=0xc000829b08 sp=0xc000829ae0 pc=0xced78f github.com/ozontech/allure-go/pkg/allure.(*Result).Done(0xc000225c80) /builds/project/vendor/github.com/ozontech/allure-go/pkg/allure/result.go:316 +0xb1 fp=0xc000829b48 sp=0xc000829b08 pc=0xcedc51 github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager.(*allureManager).FinishTest(0xc0002c81e0) /builds/project/vendor/github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager/provider.go:93 +0x73 fp=0xc000829b80 sp=0xc000829b48 pc=0xdcc333 github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).Run.func1.2() /builds/project/vendor/github.com/ozontech/allure-go/pkg/framework/core/common/common.go:369 +0x4b fp=0xc000829bd8 sp=0xc000829b80 pc=0xde532b runtime.deferreturn() /usr/local/go/src/runtime/panic.go:589 +0x5e fp=0xc000829c68 sp=0xc000829bd8 pc=0x480afe github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).Run.func1(0xc0002fec40) /builds/project/vendor/github.com/ozontech/allure-go/pkg/framework/core/common/common.go:387 +0x10cc fp=0xc000829ee0 sp=0xc000829c68 pc=0xde504c testing.tRunner(0xc0002fec40, 0xc000232320) /usr/local/go/src/testing/testing.go:1934 +0x21d fp=0xc000829fb0 sp=0xc000829ee0 pc=0x6c18dd testing.(*T).Run.gowrap1() /usr/local/go/src/testing/testing.go:1997 +0x45 fp=0xc000829fe0 sp=0xc000829fb0 pc=0x6c37a5 runtime.goexit({}) /usr/local/go/src/runtime/asm_amd64.s:1693 +0x1 fp=0xc000829fe8 sp=0xc000829fe0 pc=0x4c63c1 created by testing.(*T).Run in goroutine 98 /usr/local/go/src/testing/testing.go:1997 +0x9d3