mogui/pyorient

client.db_open gets stuck

Opened this issue ยท 7 comments

Just pulled the master branch of pyorient 1.5.4 on 9/29/2016 and tried it against OrientDB 1.5.4.

Gets stuck on the db_open call forever. Distributed Database.

client.db_exists("testdb",pyorient.STORAGE_TYPE_PLOCAL)
True
client.db_open("testdb","admin","admin")
ctrl+c - output
^CTraceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/orient.py", line 379, in db_open
.prepare((db_name, user, password, db_type, client_id)).send().fetch_response()
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/messages/database.py", line 147, in fetch_response
_, decoded = self.get_serializer().decode(nodes_config)
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 75, in decode
chunk = self._parse_value(content)
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 236, in _parse_value
return self._parse_collection( content[1:] )
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 391, in _parse_collection
chunk = self._parse_value(content)
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 247, in _parse_value
elif c == '-' or self._is_numeric( c ):
KeyboardInterrupt

I have also see the exception being thrown sometimes as follows:

^CTraceback (most recent call last):
File "orienttest.py", line 14, in
client.db_open('admin', 'root', 'admin')
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/orient.py", line 379, in db_open
.prepare((db_name, user, password, db_type, client_id)).send().fetch_response()
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/messages/database.py", line 147, in fetch_response
_, decoded = self.get_serializer().decode(nodes_config)
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 75, in decode
chunk = self._parse_value(content)
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 236, in _parse_value
return self._parse_collection( content[1:] )
File "/usr/lib/python2.7/site-packages/pyorient-1.5.4-py2.7.egg/pyorient/serializations.py", line 393, in _parse_collection
content = chunk[1]
KeyboardInterrupt

I had the same issue. I think our issues are related:

#215

I found a solution that works in distributed mode:

http://stackoverflow.com/questions/39121685/running-orientdb-in-distributed-mode-on-aws-does-not-work/39441873#39441873

It uses the binary serializer that is currently in development and it's faster than the CSV serializer.
It's important NOT to use first release of pyorient_native because it has a nasty memory leak.

Hi all,
only to explain the issue, OrientDB, changed the response for the list of nodes, before that change the node list was a serialized message like a normal resultset, now it is changed to binary and and there is no way to request the list of nodes in the previous format , so pyorient can not decode it and it crashes.

i must do further investigations, anyway i will try to fix this issue as soon as possible.

Coolio
I must say, the current way that pyorient parse CSV serialization is not very robust. I was thinking of introducing pyyaml parser which seem to work with the OrientDB protocol. I don't think introducing another dependency was a good idea but the current code is not capable of handling any funny business in the protocol.

@anber500 what kind of message the csv parser does not handle?

mogui commented

@Ostico i think we should move to the binary serialization by default what do you think? we could ask @nikulukani to mergethe nativa serialization in the main project

It's been a few weeks but I think the csv serializer gets stuck on the "message" node in the packet.

I've been using the binary serializer for about 2 weeks now and it's working great. Pyorient_native 1.1.1 had a nasty memory leak but pyorient_native 1.1.2 has been working without any problems. I don't have any benchmarks but I think the binary serializer feels much faster than the csv parser.

@nikulukani did a good job ;)

@vguhesan sorry bud, any reason for not closing this issue yet ?