-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
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
schema.VisitJSONString contains DATA RACE #371
Comments
Note this lib isn't claiming (yet) to be thread-safe. You are correct this is where you are experiencing a data race: this change inhibits the race. package openapi3_test
import (
"github.com/getkin/kin-openapi/openapi3"
"testing"
)
func TestRace_test(t *testing.T) {
var schema = openapi3.Schema{
Pattern: "race",
}
_ = schema.VisitJSONString("test")
go func() { _ = schema.VisitJSONString("test") }()
_ = schema.VisitJSONString("test")
} (This simply ensures In the future a |
thanks for the answer |
Visit all schemas looking for nonempty |
Hello again. If yes, I will be happy to submit a PR |
Yes that makes sense :) |
Also please make sure to add a test that runs with |
Signed-off-by: Pierre Fenoll <[email protected]>
Signed-off-by: Pierre Fenoll <[email protected]>
Hello!
Thanks for creating and supporting this library
I've noticed data race, let me show.
Consider following sample test:
when I run this test, I get the following output:
Looks like the problem sits here:
I believe this can happen when a web server receives two concurrent requests and performs two concurrent validations
The text was updated successfully, but these errors were encountered: