We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Getting a panic when using the package in parallel tests:
... schemaCache := kubeval.NewSchemaCache() config := kubeval.NewDefaultConfig() config.Strict = true config.IgnoreMissingSchemas = true config.Quiet = true kubeval.ValidateWithCache(someYaml, schemaCache, config) ...
and it works just fine when running without parallelism.
go version go1.16.5 darwin/amd64 github.com/instrumenta/kubeval v0.16.1
go version go1.16.5 darwin/amd64
github.com/instrumenta/kubeval v0.16.1
fatal error: concurrent map writes goroutine 55 [running]: runtime.throw(0x5681072, 0x15) /usr/local/Cellar/go/1.16.5/libexec/src/runtime/panic.go:1117 +0x72 fp=0xc000d67368 sp=0xc000d67338 pc=0x4039db2 runtime.mapassign_faststr(0x5455740, 0xc00035e960, 0x566a8da, 0x5, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/runtime/map_faststr.go:211 +0x3f1 fp=0xc000d673d0 sp=0xc000d67368 pc=0x40165b1 github.com/xeipuuv/gojsonschema.(*FormatCheckerChain).Add(...) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/format_checkers.go:99 github.com/instrumenta/kubeval/kubeval.validateAgainstSchema(0x5456040, 0xc0011707e0, 0xc000d67508, 0xc000cd9410, 0xc000e8e210, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:176 +0xec fp=0xc000d67430 sp=0xc000d673d0 pc=0x484b96c github.com/instrumenta/kubeval/kubeval.validateResource(0xc00080c700, 0x100, 0x100, 0xc000cd9410, 0xc000e8e210, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:159 +0x2f7 fp=0xc000d67588 sp=0xc000d67430 pc=0x484af57 github.com/instrumenta/kubeval/kubeval.ValidateWithCache(0xc00080c700, 0x100, 0x100, 0xc000cd9410, 0xc000d67e78, 0x1, 0x1, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:331 +0x99a fp=0xc000d67d78 sp=0xc000d67588 pc=0x484cdda myproject.com/cmd/parallel_test.TestValidSchema.func1(0xc000602f00, 0xc000666078) /Users/sam/myproject/cmd/another_test.go:176 +0x269 fp=0xc000d67f50 sp=0xc000d67d78 pc=0x53096e9 myproject.com/pkg/testing.runTestCase.func1(0xc000602f00) /Users/sam/myproject/pkg/testing/testcase.go:125 +0x42 fp=0xc000d67f80 sp=0xc000d67f50 pc=0x5305c82 testing.tRunner(0xc000602f00, 0xc0016cffa0) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1193 +0xef fp=0xc000d67fd0 sp=0xc000d67f80 pc=0x412b30f runtime.goexit() /usr/local/Cellar/go/1.16.5/libexec/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc000d67fd8 sp=0xc000d67fd0 pc=0x4074321 created by testing.(*T).Run /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1238 +0x2b3 goroutine 1 [chan receive]: testing.(*T).Run(0xc000602a80, 0x5677d94, 0xf, 0x578fd78, 0x4098c01) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1239 +0x2da testing.runTests.func1(0xc000713080) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1511 +0x78 testing.tRunner(0xc000713080, 0xc000c3fde0) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1193 +0xef testing.runTests(0xc0005490b0, 0x656a900, 0x7, 0x7, 0xc03fd7772430e868, 0x8bb4356763, 0x6633760, 0x5675a16) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1509 +0x2fe testing.(*M).Run(0xc000054d00, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1417 +0x1eb main.main() _testmain.go:57 +0x138 goroutine 19 [chan receive]: k8s.io/klog/v2.(*loggingT).flushDaemon(0x6634d80) /Users/sam/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:1169 +0x8b created by k8s.io/klog/v2.init.0 /Users/sam/go/pkg/mod/k8s.io/klog/[email protected]/klog.go:420 +0xdf goroutine 21 [chan receive]: k8s.io/klog.(*loggingT).flushDaemon(0x6634ca0) /Users/sam/go/pkg/mod/k8s.io/[email protected]/klog.go:1012 +0x8b created by k8s.io/klog.init.0 /Users/sam/go/pkg/mod/k8s.io/[email protected]/klog.go:412 +0xdc goroutine 10 [select]: go.opencensus.io/stats/view.(*worker).start(0xc000054880) /Users/sam/go/pkg/mod/[email protected]/stats/view/worker.go:276 +0xcd created by go.opencensus.io/stats/view.init.0 /Users/sam/go/pkg/mod/[email protected]/stats/view/worker.go:34 +0x68 goroutine 52 [chan receive]: testing.tRunner.func1(0xc000602a80) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1159 +0x2bc testing.tRunner(0xc000602a80, 0x578fd78) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1197 +0x125 created by testing.(*T).Run /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1238 +0x2b3 goroutine 53 [chan receive]: testing.tRunner.func1(0xc000602c00) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1159 +0x2bc testing.tRunner(0xc000602c00, 0xc0016cff00) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1197 +0x125 created by testing.(*T).Run /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1238 +0x2b3 goroutine 59 [runnable]: gopkg.in/yaml%2ev2.(*parser).scalar(0xc000f03200, 0xc000f03206) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:194 +0xd4 gopkg.in/yaml%2ev2.(*parser).parse(0xc000f03200, 0x6) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:145 +0x111 gopkg.in/yaml%2ev2.(*parser).mapping(0xc000f03200, 0xc00169c509) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:217 +0xac gopkg.in/yaml%2ev2.(*parser).parse(0xc000f03200, 0xc00169c540) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:149 +0xcc gopkg.in/yaml%2ev2.(*parser).mapping(0xc000f03200, 0x9) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:217 +0xc5 gopkg.in/yaml%2ev2.(*parser).parse(0xc000f03200, 0xc001697e03) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:149 +0xcc gopkg.in/yaml%2ev2.(*parser).document(0xc000f03200, 0xc000556d03) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:175 +0xa7 gopkg.in/yaml%2ev2.(*parser).parse(0xc000f03200, 0x0) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/decode.go:153 +0x87 gopkg.in/yaml%2ev2.unmarshal(0xc00000bb00, 0x100, 0x100, 0x53999a0, 0xc001691ac0, 0x5432400, 0x0, 0x0) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/yaml.go:142 +0x24a gopkg.in/yaml%2ev2.Unmarshal(0xc00000bb00, 0x100, 0x100, 0x53999a0, 0xc001691ac0, 0xc000232fd0, 0xc000c5b3f0) /Users/sam/go/pkg/mod/gopkg.in/[email protected]/yaml.go:81 +0x58 sigs.k8s.io/yaml.yamlToJSON(0xc00000bb00, 0x100, 0x100, 0xc000c5b408, 0x578f128, 0xb05ad38, 0x8, 0x8, 0x6f785b8, 0x8) /Users/sam/go/pkg/mod/sigs.k8s.io/[email protected]/yaml.go:124 +0x73 sigs.k8s.io/yaml.yamlUnmarshal(0xc00000bb00, 0x100, 0x100, 0x53a6fa0, 0xc0046b0410, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/sigs.k8s.io/[email protected]/yaml.go:53 +0x12a sigs.k8s.io/yaml.Unmarshal(...) /Users/sam/go/pkg/mod/sigs.k8s.io/[email protected]/yaml.go:36 github.com/instrumenta/kubeval/kubeval.validateResource(0xc00000bb00, 0x100, 0x100, 0xc000cd9410, 0xc000e8e210, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:118 +0x109 github.com/instrumenta/kubeval/kubeval.ValidateWithCache(0xc00000bb00, 0x100, 0x100, 0xc000cd9410, 0xc000c5be78, 0x1, 0x1, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:331 +0x99a myproject.com/cmd/parallel_test.TestValidSchema.func1(0xc000603500, 0xc0006660d8) /Users/sam/myproject/cmd/another_test.go:176 +0x269 myproject.com/pkg/testing.runTestCase.func1(0xc000603500) /Users/sam/myproject/pkg/testing/testcase.go:125 +0x42 testing.tRunner(0xc000603500, 0xc000d9c040) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1193 +0xef created by testing.(*T).Run /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1238 +0x2b3 goroutine 58 [sync.Cond.Wait]: sync.runtime_notifyListWait(0xc000fa41a0, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/runtime/sema.go:513 +0xf8 sync.(*Cond).Wait(0xc000fa4190) /usr/local/Cellar/go/1.16.5/libexec/src/sync/cond.go:56 +0x99 net/http.(*http2pipe).Read(0xc000fa4188, 0xc001015000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/net/http/h2_bundle.go:3515 +0x97 net/http.http2transportResponseBody.Read(0xc000fa4160, 0xc001015000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/net/http/h2_bundle.go:8611 +0xaf bufio.(*Reader).Read(0xc001620c00, 0xc001394080, 0xa, 0x200, 0xc00138c880, 0x400d505, 0x5479920) /usr/local/Cellar/go/1.16.5/libexec/src/bufio/bufio.go:227 +0x222 io.ReadAtLeast(0x58f3420, 0xc001620c00, 0xc001394080, 0xa, 0x200, 0xa, 0xa9d7188, 0x0, 0x1000) /usr/local/Cellar/go/1.16.5/libexec/src/io/io.go:328 +0x87 io.ReadFull(...) /usr/local/Cellar/go/1.16.5/libexec/src/io/io.go:347 compress/gzip.(*Reader).readHeader(0xc001394000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/Cellar/go/1.16.5/libexec/src/compress/gzip/gunzip.go:175 +0xd6 compress/gzip.(*Reader).Reset(0xc001394000, 0xc0884e8, 0xc000fa4160, 0x54dd6a0, 0x200) /usr/local/Cellar/go/1.16.5/libexec/src/compress/gzip/gunzip.go:113 +0x166 compress/gzip.NewReader(0xc0884e8, 0xc000fa4160, 0xc000fa4160, 0xc0884e8, 0xc000fa4160) /usr/local/Cellar/go/1.16.5/libexec/src/compress/gzip/gunzip.go:94 +0x58 net/http.(*http2gzipReader).Read(0xc002e19d10, 0xc001378600, 0x200, 0x200, 0xc003424000, 0xc000b14000, 0x0) /usr/local/Cellar/go/1.16.5/libexec/src/net/http/h2_bundle.go:9074 +0xca io.ReadAll(0xc0884c8, 0xc002e19d10, 0xc002e19d10, 0xc0884c8, 0xc002e19d10, 0x0, 0xc0011c4410) /usr/local/Cellar/go/1.16.5/libexec/src/io/io.go:633 +0xdf io/ioutil.ReadAll(...) /usr/local/Cellar/go/1.16.5/libexec/src/io/ioutil/ioutil.go:27 github.com/xeipuuv/gojsonschema.(*jsonReferenceLoader).loadFromHTTP(0xc0009dc3c0, 0xc0011c4410, 0x49, 0x0, 0x0, 0x20, 0x6f90548) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/jsonLoader.go:179 +0x235 github.com/xeipuuv/gojsonschema.(*jsonReferenceLoader).LoadJSON(0xc0009dc3c0, 0xc0011c42d0, 0x49, 0x592d2a8, 0xc0009dc3c0) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/jsonLoader.go:156 +0x247 github.com/xeipuuv/gojsonschema.(*schemaPool).GetDocument(0xc0004ca180, 0xc0003c7b00, 0x0, 0x0, 0x0, 0x100000001, 0x0, 0x0, 0xc00138d218) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/schemaPool.go:184 +0x1eb github.com/xeipuuv/gojsonschema.(*SchemaLoader).Compile(0xc00138d290, 0x592d2a8, 0xc0009dc2e0, 0x4010018, 0x20, 0x54c8100) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/schemaLoader.go:77 +0x237 github.com/xeipuuv/gojsonschema.NewSchema(0x592d2a8, 0xc0009dc2e0, 0xc001ac6580, 0x7, 0xc001ac6568) /Users/sam/go/pkg/mod/github.com/xeipuuv/[email protected]/schema.go:49 +0x85 github.com/instrumenta/kubeval/kubeval.downloadSchema(0xc00138d508, 0xc000cd9410, 0xc000e8e210, 0x5671330, 0xa, 0xc000de5288) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:217 +0x32a github.com/instrumenta/kubeval/kubeval.validateAgainstSchema(0x5456040, 0xc002fc74a0, 0xc00138d508, 0xc000cd9410, 0xc000e8e210, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:169 +0x46 github.com/instrumenta/kubeval/kubeval.validateResource(0xc001932e00, 0xe8, 0x100, 0xc000cd9410, 0xc000e8e210, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:159 +0x2f7 github.com/instrumenta/kubeval/kubeval.ValidateWithCache(0xc001932e00, 0xe8, 0x100, 0xc000cd9410, 0xc00138de78, 0x1, 0x1, 0x0, 0x0, 0x0, ...) /Users/sam/go/pkg/mod/github.com/instrumenta/[email protected]/kubeval/kubeval.go:331 +0x99a myproject.com/cmd/parallel_test.TestValidSchema.func1(0xc000603380, 0xc0006660c0) /Users/sam/myproject/cmd/another_test.go:176 +0x269 myproject.com/pkg/testing.runTestCase.func1(0xc000603380) /Users/sam/myproject/pkg/testing/testcase.go:125 +0x42 testing.tRunner(0xc000603380, 0xc000d9c020) /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1193 +0xef created by testing.(*T).Run /usr/local/Cellar/go/1.16.5/libexec/src/testing/testing.go:1238 +0x2b3
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Getting a panic when using the package in parallel tests:
and it works just fine when running without parallelism.
Setup:
go version go1.16.5 darwin/amd64
github.com/instrumenta/kubeval v0.16.1
Trace:
The text was updated successfully, but these errors were encountered: