Github user jorgebay commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/712#discussion_r140818483
--- Diff: gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Bytecode.cs ---
@@ -79,7 +85,77 @@ public void AddSource(string sourceName, params object[]
args)
/// <param name="args">The traversal method arguments.</param>
public void AddStep(string stepName, params object[] args)
{
- StepInstructions.Add(new Instruction(stepName, args));
+ StepInstructions.Add(new Instruction(stepName,
FlattenArguments(args)));
+ Bindings.Clear();
--- End diff --
Even though `Bindings` is based on a `ThreadLocal<T>` instance, I think the
implementation is not thread-safe.
For example: Multiple tasks executed serially on the same thread, modifying
the same bindings dictionary.
Besides not being thread-safe, it doesn't support defining a binding on 1
thread and adding the step on another, sample:
```csharp
// thread 1
// define bindings
Bindings.Instance.Of(/* */);
await SomeUnRelatedTask();
// thread 2
// Do something with that binding
g.V()/**/;
```
---