jroimartin commented on code in PR #1700:
URL: https://github.com/apache/tinkerpop/pull/1700#discussion_r903067178
##########
gremlin-go/driver/connection_test.go:
##########
@@ -1121,4 +1121,26 @@ func TestConnection(t *testing.T) {
// This routine.
assert.Equal(t, startCount, runtime.NumGoroutine())
})
+
+ t.Run("Test per-request arguments", func(t *testing.T) {
+ skipTestsIfNotEnabled(t, integrationTestSuiteName,
testNoAuthEnable)
+
+ g := getTestGraph(t, testNoAuthUrl, testNoAuthAuthInfo,
testNoAuthTlsConfig)
+ defer g.remoteConnection.Close()
+
+ _, err := g.With("evaluationTimeout",
10).Inject(1).SideEffect(&Lambda{"Thread.sleep(5000)", "gremlin-groovy"}).Next()
+ assert.NotNil(t, err)
+
+ _, err = g.With("evaluationTimeout",
10000).Inject(1).SideEffect(&Lambda{"Thread.sleep(5000)",
"gremlin-groovy"}).Next()
+ assert.Nil(t, err)
+
+ _, err = g.With("evaluationTimeout",
10000).With("evaluationTimeout",
10).Inject(1).SideEffect(&Lambda{"Thread.sleep(5000)", "gremlin-groovy"}).Next()
+ assert.NotNil(t, err)
+
+ _, err =
g.WithStrategies(OptionsStrategy(map[string]interface{}{"evaluationTimeout":
10})).Inject(1).SideEffect(&Lambda{"Thread.sleep(5000)",
"gremlin-groovy"}).Next()
+ assert.NotNil(t, err)
+
+ _, err =
g.WithStrategies(OptionsStrategy(map[string]interface{}{"evaluationTimeout":
10000})).Inject(1).SideEffect(&Lambda{"Thread.sleep(5000)",
"gremlin-groovy"}).Next()
+ assert.Nil(t, err)
+ })
Review Comment:
@lyndonbauto I've been able to reproduce it using gremlin-python with the
following set-up (it's a quick hack):
**repro.py**
```python
#!/usr/bin/env python3
from gremlin_python.driver.driver_remote_connection import
DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal
g =
traversal().with_remote(DriverRemoteConnection('ws://localhost:45940/gremlin','g'))
try:
g.inject(1).sideEffect(lambda: "Thread.sleep(1000)").iterate()
except Exception as e:
print(e)
```
**stress.bash**
```bash
#!/bin/bash
for i in $(seq 0 250); do
python3 repro.py &
pids[${i}]=$!
done
wait ${pids[*]}
```
I'm running gremlin-server this way (from the gremlin-go directory):
```
$ GREMLIN_SERVER=3.5.4-SNAPSHOT docker-compose run --rm --service-ports
gremlin-test-server
```
The reproducer:
```
$ ./stress.bash
Received error message '{'requestId':
'0a358421-df3c-4965-8535-bf66337289c8', 'status': {'message': 'startup
failed:\nScript4.groovy: 1: unexpected token: 1 @ line 1, column 44.\n1
error\n', 'code': 597, 'attributes': {'stackTrace':
'org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed:\nScript4.groovy: 1: unexpected token: 1 @ line 1, column 44.\n
engine__g.inject((int) 1(int) 1).sideEff\n
^\n\n1 error\n\n\tat
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311)\n\tat
org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151)\n\tat
org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121)\n\tat
org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133)\n\tat
org.codehaus.groovy.control.So
...
```
In the gremlin-server logs:
```
[ERROR] ? - Script compilation FAILED gremlinscriptengine__g.inject((int)
1(int)
1).sideEffect().sideEffect({Thread.sleep(1000)}{Thread.sleep(1000)}))..nonenone()()
took 11ms {}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed:
Script4.groovy: 1: unexpected token: 1 @ line 1, column 44.
engine__g.inject((int) 1(int) 1).sideEff
^
1 error
at
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311)
at
org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151)
at
org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121)
at
org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133)
at
org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:325)
...
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]