Closed spinus closed 9 years ago
I'm not 100% sure, but it may have to do with the Titan conf file. In titan/conf/gremlin-server/gremlin-server.yaml
make sure that channelizer
is set to WebSocketChannelizer
like such:
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
Let me know if that fixes your problem.
Cheers,
Dave
Looking a bit more, I don't think this is the problem. I'll take a closer look at this tomorrow morning and get back to you.
@davebshow sorry I didnt include configs. Here they are: titan.properties:
gremlin.graph=com.thinkaurelius.titan.core.TitanFactory
storage.backend=berkeleyje
storage.directory=/data/
gremlin.yaml:
host: 0.0.0.0
port: 8182
threadPoolWorker: 1
gremlinPool: 8
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
g: /service/titan.properties}
plugins:
- aurelius.titan
scriptEngines: {
gremlin-groovy: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI],
scripts: [scripts/empty-sample.groovy]},
nashorn: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI]}}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
# csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: true},
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
threadPoolBoss: 1
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferHighWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false}
Ok a couple things. I found the bug in that wasn't releasing the resource on error, and I fixed it in the most recent commit. But to be honest I don't think this is the source of your problems.
I noticed in your config that in graphs
you have defined your graph name as g
. This is fine in theory, but in the new gremlin the convention is to call this graph
, because g
is used for the TraversalSource
object. This object is defined in the scripts
file, and by default in scripts/empty-sample.groovy
, g
is defined as follows:
g = graph.traversal()
Maybe you have modified this, maybe not. However, this could be the source of your error, defining g
in both conf/gremlin-server/gremlin-server.yaml
and in scripts/empty-sample.groovy
. What are the contents of the latter? Please check this and see if it solves your problem. I would first rename your graph to graph
in the gremlin-server.yaml
, and try:
resp = yield from client.submit('''graph'')
That should work. Then try:
resp = yield from client.submit('''g''')
And you should see the TraversalSource
object. Let me know how this goes. If everything is good I will release a new version of aiogremlin
with the bug fix.
Thanks @spinus!
Also, please remember that you must explicitly close the client using the close
coroutine when you are done:
yield from client.close()
I'll add this to the docs.
A way to get around this is by using the submit
function.
Good stuff, it's moving forward.
empty-samply.groovy
does exactly what you wrote. I didn't change anything.
I changed gremlin graph name to graph
as you suggested. Didn't change anything else.
When I run submit("g")
the response it:
[Message(status_code=200, data=[{'graph': {'present': True}, 'graphComputer': {'present': False}, 'strategies': [{'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$DecorationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$OptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$VendorOptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$VendorOptimizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$FinalizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$FinalizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$FinalizationStrategy'}, {'traversalCategory': 'org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy$VerificationStrategy'}]}], message={}, metadata='')]
It seems that traversal object works now. I can do query with g.V()
and responses are ok.
When I use submit("graph")
I still have serialization problem the same as I described before.
@davebshow Thank you for helping with this.
Well I get that same graph serialization error using WebSockets and HTTP. I've posted a thread on Gremlin User's Google group. Let's see what Stephen Mallette has to say about it...
https://groups.google.com/forum/#!topic/gremlin-users/QdQ9PH0noxs
Here I will quote the response from Stephen Mallette, who is the lead developer on the Gremlin Server. If you are having any other issues with unclosed clients or unreleased resources please open a separate issue. Cheers, Dave
"You will always get an error like that anytime you try to return a value that isn't understood as serializable given the serializer you are using. So it's just saying that it doesn't know what to do with "graph" which returns a Graph instance. Generally speaking, TinkerPop does not enforce any semantics regarding the serialization of a Graph object. It's a bit of a weird use case in a sense, especially a TitanGraph (i.e. billion edge graph), because it would just mean Gremlin Server would have to send back all the vertices/edges when it is sorta rare that you would ever want that. Not sure what the point of that would be. That said, I did think that serialization of a TinkerGraph would make sense as they are typically small and folks might want to ship around small subgraphs and such - so as of 3.1.x you will be able to do that."
@davebshow thank you for the effort.
My setup is: titan-0.9.0-M2-hadoop1 (berkleyDB backend, no index). When I connect to gremlin server using gremlin shell I can do stuff:
But with aiogremlin with the code
I receive the error:
On gremlin server errors look like:
I'm not sure this is misconfiguration of server or gremlin serialization bug, have any idea?
Moreover, those lines:
appear on every request, even when gremlin script is evaluated correctly and there is no serialization problems (for example when script is
2+2
).