[ 
https://issues.apache.org/jira/browse/TINKERPOP-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16425581#comment-16425581
 ] 

Branden Moore commented on TINKERPOP-1933:
------------------------------------------

Using bytecode-based traversals, if I issue any query that returns a large 
number of results, when the results come back from the server, the client will 
hit the python max recursion depth.

Here is an example python session, demonstrating that (for this instance) I can 
get back only up to 61,888 results before the recursion limit is hit:

 
{code:java}
$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gremlin_python.structure.graph import Graph
>>> from gremlin_python.driver.driver_remote_connection import 
>>> DriverRemoteConnection
>>> graph = Graph()
>>> g = 
>>> graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
>>> g.V().count().next()
138408L
>>> x = g.V().limit(61888).toList()
>>> x = g.V().limit(61889).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
>>>{code}
 

Now, I could change that target number (61888) to something higher if I call 
{{sys.setrecursionlimit()}}, but that feels like a hack.   gremlin-python is 
still using recursion for something that it should not be.

 

> 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
>            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)

Reply via email to