[
https://issues.apache.org/jira/browse/TINKERPOP-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16449042#comment-16449042
]
ASF GitHub Bot commented on TINKERPOP-1933:
-------------------------------------------
GitHub user davebshow opened a pull request:
https://github.com/apache/tinkerpop/pull/854
TINKERPOP-1933 gremlin-python maximum recursion depth exceeded on large
responses
https://issues.apache.org/jira/browse/TINKERPOP-1933
Recursive calls to the `data_received` were causing max recursion depth
error with large streaming responses. This PR remove the recursion in favor of
a simple loop. I didn't add any new tests. Locally, I tested like this:
```python
from gremlin_python.driver import client
groovy = """
def num_nodes = 1..100000
for (n in num_nodes) {
g.addV().next()
}
"""
c = client.Client('ws://localhost:8182/gremlin', 'g')
results = c.submit(groovy)
results.all().result()
results = c.submit("g.V().count()")
print("Added %d nodes to graph" % results.all().result()[0])
# This was always ok
print("Ok up to len: %d" %
len(c.submit("g.V().limit(61888)").all().result()))
try:
# This used to throw error
print("Retrieved %d nodes, no more recursion issue" %
len(c.submit("g.V().limit(100000)").all().result()))
except:
pass
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1933
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/854.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #854
----
commit 4c8717dd4e94ec248a959911d8c11f3b45b2d7b3
Author: davebshow <davebshow@...>
Date: 2018-04-23T23:21:48Z
Don't use recursive calls for streaming response
----
> gremlin-python maximum recursion depth exceeded on large responses
> ------------------------------------------------------------------
>
> Key: TINKERPOP-1933
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1933
> Project: TinkerPop
> Issue Type: Bug
> Components: python
> Affects Versions: 3.3.1
> Reporter: Branden Moore
> Assignee: David M. Brown
> Priority: Major
>
> gremlin-python fails to deserialize large lists returned from the server,
> giving the error:
>
> {{>>> x = g.V().limit(65000).toList()}}
> {{Traceback (most recent call last):}}
> {{ File "/usr/lib/python2.7/logging/__init__.py", line 861, in emit}}
> {{Traceback (most recent call last):}}
> {{ File "<stdin>", line 1, in <module>}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 52, in toList}}
> {{ return list(iter(self))}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 70, in next}}
> {{ return self.__next__()}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 43, in __next__}}
> {{ self.traversal_strategies.apply_strategies(self)}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 352, in apply_strategies}}
> {{ traversal_strategy.apply(traversal)}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/driver/remote_connection.py",
> line 143, in apply}}
> {{ remote_traversal = self.remote_connection.submit(traversal.bytecode)}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
> line 54, in submit}}
> {{ results = result_set.all().result()}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/concurrent/futures/_base.py",
> line 462, in result}}
> {{ return self.__get_result()}}
> {{ File
> "/ascldap/users/bjmoor/.local/lib/python2.7/site-packages/concurrent/futures/_base.py",
> line 414, in __get_result}}
> {{ raise exception_type, self._exception, self._traceback}}
> {{RuntimeError: maximum recursion depth exceeded while calling a Python
> object}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)