You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2022/07/04 09:54:10 UTC

[GitHub] [tinkerpop] jroimartin opened a new pull request, #1744: gremlin-go: fix data race on serializers and deserializers initialization

jroimartin opened a new pull request, #1744:
URL: https://github.com/apache/tinkerpop/pull/1744

   Move the initialization of the serializers and deserializers to an init function, so no data race happens because multiple goroutines try to access them at the same time.
   
   The following stack trace shows an instance of this problem (beware, some pending PRs have been applied, so line numbers could differ):
   
   ```
   WARNING: DATA RACE
   Read at 0x000000bc9f68 by goroutine 18:
     github.com/apache/tinkerpop/gremlin-go/v3/driver.initSerializers()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/serializer.go:221 +0x44
     github.com/apache/tinkerpop/gremlin-go/v3/driver.graphBinarySerializer.serializeMessage()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/serializer.go:87 +0x49
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*gremlinServerWSProtocol).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/protocol.go:157 +0x53
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*connection).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/connection.go:86 +0x46a
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*loadBalancingPool).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/connectionPool.go:78 +0x144
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Client).submitBytecode()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/client.go:162 +0x256
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*DriverRemoteConnection).submitBytecode()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/driverRemoteConnection.go:177 +0x9c
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Traversal).GetResultSet()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/traversal.go:121 +0x7e
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Traversal).Next()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/traversal.go:107 +0x30
     main.worker()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:56 +0x224
     main.main.func1()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:33 +0x35
     main.main.func2()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:35 +0x47
   
   Previous write at 0x000000bc9f68 by goroutine 8:
     github.com/apache/tinkerpop/gremlin-go/v3/driver.initSerializers()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/serializer.go:222 +0xea7
     github.com/apache/tinkerpop/gremlin-go/v3/driver.graphBinarySerializer.serializeMessage()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/serializer.go:87 +0x49
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*gremlinServerWSProtocol).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/protocol.go:157 +0x53
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*connection).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/connection.go:86 +0x46a
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*loadBalancingPool).write()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/connectionPool.go:78 +0x144
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Client).submitBytecode()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/client.go:162 +0x256
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*DriverRemoteConnection).submitBytecode()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/driverRemoteConnection.go:177 +0x9c
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Traversal).GetResultSet()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/traversal.go:121 +0x7e
     github.com/apache/tinkerpop/gremlin-go/v3/driver.(*Traversal).Next()
         /home/n/src/tinkerpop/.wt/dev/gremlin-go/driver/traversal.go:107 +0x30
     main.worker()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:56 +0x224
     main.main.func1()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:33 +0x35
     main.main.func2()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:35 +0x47
   
   Goroutine 18 (running) created at:
     main.main()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:32 +0x77
   
   Goroutine 8 (running) created at:
     main.main()
         /home/n/tmp/tinkerpop-repros/gremlin-go-data-race/main.go:32 +0x77
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] xiazcy commented on pull request #1744: gremlin-go: fix data race on serializers and deserializers initialization

Posted by GitBox <gi...@apache.org>.
xiazcy commented on PR #1744:
URL: https://github.com/apache/tinkerpop/pull/1744#issuecomment-1174041955

   LGTM. Makes sense to initialize the serializer and deserializer in an init() block, since they will be used regardless.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] simonz-bq commented on pull request #1744: gremlin-go: fix data race on serializers and deserializers initialization

Posted by GitBox <gi...@apache.org>.
simonz-bq commented on PR #1744:
URL: https://github.com/apache/tinkerpop/pull/1744#issuecomment-1175346380

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette merged pull request #1744: gremlin-go: fix data race on serializers and deserializers initialization

Posted by GitBox <gi...@apache.org>.
spmallette merged PR #1744:
URL: https://github.com/apache/tinkerpop/pull/1744


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org