Comments (5)
I'm closing the issue since it became outdated.
Thank you @pyros2097 for looking into it and feel free to report issues in the future too.
from graphql.
Hi @pyros2097
After the relevant PR #104 that you've submitted has been merged, are they any changes to this? Does running go -race
still shows warning about race condition?
If it does, is it possible to update your implementation and remove gorilla/context
as a dependency and see if it still happens?
from graphql.
I am using 26c58bd and building with go build -race
doesn't give me any race errors.
from graphql.
The #104 is a minor change to make sure the objects are same eventhough they aren't the same but the type they represent is the same.
WARNING: DATA RACE
Read by goroutine 14:
runtime.mapaccess1_faststr()
/build/go/src/go-1.5.2/src/runtime/hashmap_fast.go:179 +0x0
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.getFieldDef()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:757 +0x2ce
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.resolveField()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:470 +0x221
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.executeFields()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:224 +0x251
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValue()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:672 +0x1a58
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValueCatchingError()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:540 +0x2a6
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValue()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:597 +0xc3e
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValueCatchingError()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:540 +0x2a6
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.resolveField()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:516 +0x76a
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.executeFields()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:224 +0x251
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValue()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:672 +0x1a58
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValueCatchingError()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:540 +0x2a6
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.resolveField()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:516 +0x76a
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.executeFields()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:224 +0x251
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValue()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:672 +0x1a58
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.completeValueCatchingError()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:540 +0x2a6
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.resolveField()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:516 +0x76a
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.executeFields()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:224 +0x251
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.executeOperation()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:158 +0x454
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.Execute()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:54 +0x497
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.Do()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/graphql.go:42 +0x5f1
playlyfe.com/go-potential/server.Serve.func6()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:498 +0x108e
playlyfe.com/go-potential/server.Serve.func5.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:420 +0x1bb7
playlyfe.com/go-potential/server.Serve.func4.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:314 +0x22d
playlyfe.com/go-potential/server.Serve.func3.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:296 +0x327
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).ServeHTTP()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:575 +0x4f6
net/http.serverHandler.ServeHTTP()
/build/go/src/go-1.5.2/src/net/http/server.go:1862 +0x206
net/http.(*conn).serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1361 +0x117c
Previous write by goroutine 19:
runtime.mapassign1()
/build/go/src/go-1.5.2/src/runtime/hashmap.go:411 +0x0
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.defineFieldMap()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/definition.go:544 +0x143a
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.(*Object).Fields()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/definition.go:419 +0xf0
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.getFieldDef()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/executor.go:757 +0x290
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.resolveField()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/ex
and an other one
net/http.serverHandler.ServeHTTP()
/build/go/src/go-1.5.2/src/net/http/server.go:1862 +0x206
net/http.(*conn).serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1361 +0x117c
Previous write by goroutine 16:
[failed to restore the stack]
Goroutine 15 (running) created at:
net/http.(*Server).Serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1910 +0x464
net/http.(*Server).ListenAndServe()
/build/go/src/go-1.5.2/src/net/http/server.go:1877 +0x174
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:619 +0x110
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).Run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:594 +0x6b
playlyfe.com/go-potential/server.Serve()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:572 +0x13e5
main.main()
/home/pyros2097/Code/src/playlyfe.com/go-potential/catalyst.go:14 +0x166
runtime.main()
/build/go/src/go-1.5.2/src/runtime/proc.go:111 +0x246
main.init()
/home/pyros2097/Code/src/playlyfe.com/go-potential/catalyst.go:15 +0x89
Goroutine 16 (running) created at:
net/http.(*Server).Serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1910 +0x464
net/http.(*Server).ListenAndServe()
/build/go/src/go-1.5.2/src/net/http/server.go:1877 +0x174
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:619 +0x110
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).Run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:594 +0x6b
playlyfe.com/go-potential/server.Serve()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:572 +0x13e5
main.main()
/home/pyros2097/Code/src/playlyfe.com/go-potential/catalyst.go:14 +0x166
runtime.main()
/build/go/src/go-1.5.2/src/runtime/proc.go:111 +0x246
main.init()
/home/pyros2097/Code/src/playlyfe.com/go-potential/catalyst.go:15 +0x89
==================
==================
WARNING: DATA RACE
Read by goroutine 15:
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.(*TypeInfo).Enter()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/type_info.go:85 +0x923
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.visitUsingRules.func1.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/validator.go:50 +0x16a
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/language/visitor.Visit()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/language/visitor/visitor.go:393 +0x174b
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.visitUsingRules.func1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/validator.go:137 +0x29c
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.visitUsingRules()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/validator.go:146 +0x59f
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.ValidateDocument()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/validator.go:29 +0x3d7
playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql.Do()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/graphql-go/graphql/graphql.go:28 +0x407
playlyfe.com/go-potential/server.Serve.func6()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:498 +0x108e
playlyfe.com/go-potential/server.Serve.func5.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:420 +0x1bb7
playlyfe.com/go-potential/server.Serve.func4.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:314 +0x22d
playlyfe.com/go-potential/server.Serve.func3.1()
/home/pyros2097/Code/src/playlyfe.com/go-potential/server/main.go:296 +0x327
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).ServeHTTP()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:575 +0x4f6
net/http.serverHandler.ServeHTTP()
/build/go/src/go-1.5.2/src/net/http/server.go:1862 +0x206
net/http.(*conn).serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1361 +0x117c
Previous write by goroutine 16:
[failed to restore the stack]
Goroutine 15 (running) created at:
net/http.(*Server).Serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1910 +0x464
net/http.(*Server).ListenAndServe()
/build/go/src/go-1.5.2/src/net/http/server.go:1877 +0x174
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:619 +0x110
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).Run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack
Goroutine 16 (running) created at:
net/http.(*Server).Serve()
/build/go/src/go-1.5.2/src/net/http/server.go:1910 +0x464
net/http.(*Server).ListenAndServe()
/build/go/src/go-1.5.2/src/net/http/server.go:1877 +0x174
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:619 +0x110
playlyfe.com/go-potential/vendor/github.com/labstack/echo.(*Echo).Run()
/home/pyros2097/Code/src/playlyfe.com/go-potential/vendor/github.com/labstack/echo/echo.go:594 +0x6b
==================
==================
Its because graphql-go uses a map internally for the schema and creating and storing the types and the types are not always created at initialization, sometimes they are done lazily and this may happen from 2 or more goroutines at a time and they may all change the underlying at the same time. We might need to use a concurrent map or see how the other implementations do it https://github.com/tmc/graphql.
Even in our server we have a service locator which does the same thing initialize services lazily but if 2 or more goroutines are started and request the same service the race happens.
from graphql.
@F21 you need to use it a http server context or run multiple go routines which call the Do function
from graphql.
Related Issues (20)
- Potential goroutine leak in TestContextDeadline HOT 1
- Enums with trailing white space cause error.
- Playground
- make union input type ? it just have output union type
- With fiber HOT 1
- Printing GraphQL documents is slow HOT 1
- Bug with underscore and same name in keys from json response
- MongoDB _id field
- Printer returns invalid SDL if Block String comment contains double-quote
- When using custom scalar types, it's crucial to provide error feedback to users when issues arise with their submitted data. However, triggering exceptions within the ParseValue and ParseLiteral methods can lead to program crashes when using the graphql.Do method. This prevents the necessary error messages from being delivered to users.
- String type no longer recongised HOT 1
- Is it possible to go from `*graphql.Schema` to an ast node? HOT 1
- Error handling HOT 1
- Disabling Field Suggestions
- Is possible to typing typeConfig of graphql.Object after Object done.
- RootObjectFn request body always empty
- Unable to pass {{....}} as part of query or mutation string
- Redefining scalar ID
- How to support scalar JSON type? HOT 1
- Accessing parent from nested child resolver HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.