Skip to content

Concurrency issue on accessing shared varible URIMap #359

@yangcao77

Description

@yangcao77

To trace cycle reference of the parent uri, a shared variable URIMap is introduced: https://github.com/devfile/library/blob/master/pkg/devfile/parser/context/context.go#L12

However, @mmulholl 's multi-thread test caught the following error due to fatal error: concurrent map writes:

goroutine 58 [running]:
runtime.throw(0x1b9bb93, 0x15)
	/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc0003e1628 sp=0xc0003e15f8 pc=0x1038f52
runtime.mapclear(0x1a893a0, 0xc0001c1350)
	/usr/local/go/src/runtime/map.go:985 +0x171 fp=0xc0003e1660 sp=0xc0003e1628 pc=0x1012f71
github.com/devfile/library/pkg/devfile/parser.parseDevfile(0xc00054e9a8, 0x5, 0xc00043ed20, 0x6c, 0xc0004c80c0, 0x31, 0xc0007e1400, 0x49f, 0x500, 0x1c1dbcd, ...)
	/Users/martinmulholland/devfile/library/pkg/devfile/parser/parse.go:51 +0x199 fp=0xc0003e1798 sp=0xc0003e1660 pc=0x19c6839

/Users/martinmulholland/go/pkg/mod/github.com/xeipuuv/gojsonschema@v1.2.0/validation.go:41 +0x39
github.com/devfile/library/pkg/devfile/parser/context.(*DevfileCtx).ValidateDevfileSchema(0xc00025a090, 0xc00025a090, 0xc0002fd7e0)
	/Users/martinmulholland/devfile/library/pkg/devfile/parser/context/schema.go:32 +0x119
github.com/devfile/library/pkg/devfile/parser/context.(*DevfileCtx).Validate(...)
	/Users/martinmulholland/devfile/library/pkg/devfile/parser/context/context.go:111

Need to handle the concurrency issue.

Metadata

Metadata

Assignees

Labels

area/libraryCommon devfile library for interacting with devfileskind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions