pb33f / doctor Goto Github PK
View Code? Open in Web Editor NEWThe Doctor. Just the doctor, no more, no less.
Home Page: https://pb33f.io
License: Other
The Doctor. Just the doctor, no more, no less.
Home Page: https://pb33f.io
License: Other
As per our discord chat, opened this for tracking on your end since I saw that you prefer issues be on Github.
a root.yaml
paths:
/v3/test:
get:
summary: test
operationId: test
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "schemas.yaml#/TestAccountV3"
referencing a schemas.yaml
TestAccountV3:
type: object
properties:
parentAccount:
$ref: "schemas.yaml#/TestAccountV3"
liveAccount:
$ref: "schemas.yaml#/TestAccountV3"
provisionedForAccount:
$ref: "schemas.yaml#/TestAccountV3"
Like so, will hang indefinitely. The reason that occurs is because of the following line:
https://github.com/pb33f/doctor/blob/main/model/high/base/schema_proxy.go#L61
for _, ref := range circularRefs {
if ref.LoopPoint.Definition == sp.Value.GetReference() {
return true
}
}
Which never finds a match. The variable values are as follows:
ref.LoopPoint.Definition
is #/TestAccountV3
, but
sp.Value.GetReference()
is schemas.yaml#/TestAccountV3
.
This occurs because the schemas.yaml
has a self reference that uses a file reference (adding in the schemas.yaml#
to refer to a definition to itself).
As per your recommendation, this is most likely invalid or at least non standard but in that case should either error or be fixed to pass. My preference is for it to pass, but lint it in vacuum.
Running doctor with build graph enabled triggers a race condition. Can be seen using vacuum with BuildGraph On.
WARNING: DATA RACE
Read at 0x00c00012c7c0 by goroutine 317:
runtime.growslice()
/nix/store/4cijk6gwv59c84h1l9yhxzsaz93f67mz-go-1.23.0/share/go/src/runtime/slice.go:177 +0x0
github.com/pb33f/doctor/model/high/base.(*Foundation).AddEdge()
<redacted>/vendor/github.com/pb33f/doctor/model/high/base/foundation.go:316 +0x94
github.com/pb33f/doctor/model/high/v3.(*PathItem).AddEdge()
<autogenerated>:1 +0x28
github.com/pb33f/doctor/model/high/base.(*Foundation).BuildNodesAndEdges()
<redacted>/vendor/github.com/pb33f/doctor/model/high/base/foundation.go:174 +0x800
github.com/pb33f/doctor/model/high/v3.(*Operation).Walk()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/operation.go:33 +0x130
github.com/pb33f/doctor/model/high/v3.(*PathItem).Walk.func1()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/path_item.go:81 +0x64
github.com/sourcegraph/conc/panics.(*Catcher).Try()
<redacted>/vendor/github.com/sourcegraph/conc/panics/panics.go:23 +0x70
github.com/sourcegraph/conc.(*WaitGroup).Go.func1()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:32 +0x84
Previous write at 0x00c00012c7c0 by goroutine 318:
github.com/pb33f/doctor/model/high/base.(*Foundation).AddEdge()
<redacted>/vendor/github.com/pb33f/doctor/model/high/base/foundation.go:314 +0x154
github.com/pb33f/doctor/model/high/v3.(*PathItem).AddEdge()
<autogenerated>:1 +0x28
github.com/pb33f/doctor/model/high/base.(*Foundation).BuildNodesAndEdges()
<redacted>/vendor/github.com/pb33f/doctor/model/high/base/foundation.go:174 +0x800
github.com/pb33f/doctor/model/high/v3.(*Server).Walk()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/server.go:26 +0x168
github.com/pb33f/doctor/model/high/v3.(*PathItem).Walk.func9()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/path_item.go:138 +0x50
github.com/sourcegraph/conc/panics.(*Catcher).Try()
<redacted>/vendor/github.com/sourcegraph/conc/panics/panics.go:23 +0x70
github.com/sourcegraph/conc.(*WaitGroup).Go.func1()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:32 +0x84
Goroutine 317 (running) created at:
github.com/sourcegraph/conc.(*WaitGroup).Go()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:30 +0xd4
github.com/pb33f/doctor/model/high/v3.(*PathItem).Walk()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/path_item.go:81 +0x234
github.com/pb33f/doctor/model/high/v3.(*Paths).Walk.func1()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/paths.go:47 +0x50
github.com/sourcegraph/conc/panics.(*Catcher).Try()
<redacted>/vendor/github.com/sourcegraph/conc/panics/panics.go:23 +0x70
github.com/sourcegraph/conc.(*WaitGroup).Go.func1()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:32 +0x84
Goroutine 318 (running) created at:
github.com/sourcegraph/conc.(*WaitGroup).Go()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:30 +0xd4
github.com/pb33f/doctor/model/high/v3.(*PathItem).Walk()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/path_item.go:138 +0xe2c
github.com/pb33f/doctor/model/high/v3.(*Paths).Walk.func1()
<redacted>/vendor/github.com/pb33f/doctor/model/high/v3/paths.go:47 +0x50
github.com/sourcegraph/conc/panics.(*Catcher).Try()
<redacted>/vendor/github.com/sourcegraph/conc/panics/panics.go:23 +0x70
github.com/sourcegraph/conc.(*WaitGroup).Go.func1()
<redacted>/vendor/github.com/sourcegraph/conc/waitgroup.go:32 +0x84
The reason is https://github.com/pb33f/doctor/blob/main/model/high/base/foundation.go#L306
func (f *Foundation) AddEdge(edge *Edge) {
if f == nil {
return
}
if edge == nil {
return
}
if f.Edges == nil {
f.Edges = []*Edge{edge}
} else {
f.Edges = append(f.Edges, edge)
}
}
does not take a lock on appending to f.Edges
using the built in struct Mutex
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.