kubeflow / metadata

Repository for assets related to Metadata.
Apache License 2.0
121 stars 69 forks source link

circular reference in pre-defined schema cause server crash #119

Open dreamryx opened 5 years ago

dreamryx commented 5 years ago

/kind bug

What steps did you take and what happened: [A clear and concise description of what the bug is.] When metadata server starts, it first to load pre-defined schemas of artifact and execution stored in json file. However, if those schemas contain circular reference, the metadata server crash with following error:

runtime: goroutine stack exceeds 1000000000-byte limit fatal error: stack overflow

runtime stack: runtime.throw(0x14020bd, 0xe) GOROOT/src/runtime/panic.go:617 +0x72 runtime.newstack() GOROOT/src/runtime/stack.go:1041 +0x6f0 runtime.morestack() GOROOT/src/runtime/asm_amd64.s:429 +0x8f

goroutine 1 [running]: runtime.heapBitsSetType(0xc0059cd6b0, 0x30, 0x30, 0x13cf140) GOROOT/src/runtime/mbitmap.go:938 +0xa56 fp=0xc0240003b0 sp=0xc0240003a8 pc=0x8663e6 runtime.mallocgc(0x30, 0x13cf140, 0x1, 0x0) GOROOT/src/runtime/malloc.go:969 +0x51c fp=0xc024000450 sp=0xc0240003b0 pc=0x85c12c runtime.newobject(0x13cf140, 0x0) GOROOT/src/runtime/malloc.go:1068 +0x38 fp=0xc024000480 sp=0xc024000450 pc=0x85c788 runtime.makemap_small(0x0) GOROOT/src/runtime/map.go:295 +0x2d fp=0xc0240004a0 sp=0xc024000480 pc=0x85d39d github.com/kubeflow/metadata/schemaparser.(*SchemaSet).SimpleProperties(0xc0002448c0, 0xc000309e40, 0x3c, 0x48, 0xc000338be8, 0x1) schemaparser/schemaset.go

The simplest way to reproduce this bug is to make the schema quote itself. For example, add " $ref": "http://github.com/kubeflow/metadata/schema/alpha/artifact.json" to artifact.json file.

Currently all the schemas are well designed and tested. But the server need to plug this hole.

jtfogarty commented 4 years ago

/area engprod /priority p1