First, thanks for your hard work on providing a Go Gremlin client. Really appreciate it. Let me know if i've misinterpreted the intended use of the package in any way... On to the issue.
Background: I first encountered the issue when performance test my API using ab (Apache Bench) with concurrency set to "2". I was not able to recreate using the existing test suite and therefore had to simulate concurrent "Execute" calls with a new test (see below).
Hi @qasaur,
First, thanks for your hard work on providing a Go Gremlin client. Really appreciate it. Let me know if i've misinterpreted the intended use of the package in any way... On to the issue.
Background: I first encountered the issue when performance test my API using
ab
(Apache Bench) with concurrency set to "2". I was not able to recreate using the existing test suite and therefore had to simulate concurrent "Execute" calls with a new test (see below).tested on: go 1.7.3
Reproduce:
client_test.go
go test -race -v
output:
As indicated, the issue lies at: https://github.com/qasaur/gremgo/blob/master/client.go#L61
I believe you will also have issues at: https://github.com/qasaur/gremgo/blob/master/response.go#L65 and https://github.com/qasaur/gremgo/blob/master/response.go#L69.
A simple solution would be to add locks around those map ops, (perhaps consider RWMutex) but performance obviously may be affected.