Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Failed to connect via WS #1

Closed
lexakimov opened this issue Dec 22, 2020 · 1 comment
Closed

Failed to connect via WS #1

lexakimov opened this issue Dec 22, 2020 · 1 comment

Comments

@lexakimov
Copy link

I try to explore our graph via latest GraphExplorer. For graph explorer, i run invana-engine in docker:

docker run -p 8000:8000 -d -e GREMLIN_SERVER_URL=ws://127.0.0.1:9900/gremlin --name invana-engine invanalabs/invana-engine

and when i try to connect via http://graph-explorer-edge.herokuapp.com/connect:

http://127.0.0.1:8000/graphql

i got 'failed to connect'

i watched invana-engine's logs in docker and got this:

.................................................
Starting invana-engine server
Using GREMLIN_SERVER_URL ws://127.0.0.1:9900/gremlin
.................................................
[2020-12-22 02:29:49 +0000] [11] [INFO] Started server process [11]
[2020-12-22 02:29:49 +0000] [11] [INFO] Waiting for application startup.
[2020-12-22 02:29:49 +0000] [11] [INFO] Application startup complete.
DEBUG:invana.gremlin.vertex:Reading vertices with label:InvanaManagement; namespace:None; query: None; limit: 50; skip: 0
ERROR:graphql.execution.executor:An error occurred while resolving field GremlinQuery.filterVertex
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error
    return executor.execute(resolve_fn, source, info, **args)
  File "/usr/local/lib/python3.8/site-packages/graphql/execution/executors/sync.py", line 16, in execute
    return fn(*args, **kwargs)
  File "/webapp/invana/server/schemas/query.py", line 44, in resolve_filter_vertex
    data = info.context['request'].app.state.gremlin_client.vertex.read_many(
  File "/webapp/invana/gremlin/base.py", line 91, in read_many
    return self._read_many(label=label, namespace=namespace, query=query, limit=limit, skip=skip)
  File "/webapp/invana/gremlin/vertex.py", line 88, in _read_many
    for _ in filtered_data.elementMap().toList():
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 58, in toList
    return list(iter(self))
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 48, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 573, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/remote_connection.py", line 149, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/driver_remote_connection.py", line 55, in submit
    result_set = self._client.submit(bytecode)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/client.py", line 111, in submit
    return self.submitAsync(message, bindings=bindings).result()
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/client.py", line 127, in submitAsync
    return conn.write(message)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/connection.py", line 55, in write
    self.connect()
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/connection.py", line 45, in connect
    self._transport.connect(self._url, self._headers)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/tornado/transport.py", line 35, in connect
    self._ws = self._loop.run_sync(
  File "/usr/local/lib/python3.8/site-packages/tornado/ioloop.py", line 576, in run_sync
    return future_cell[0].result()
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:graphql.execution.utils:Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error
    return executor.execute(resolve_fn, source, info, **args)
  File "/usr/local/lib/python3.8/site-packages/graphql/execution/executors/sync.py", line 16, in execute
    return fn(*args, **kwargs)
  File "/webapp/invana/server/schemas/query.py", line 44, in resolve_filter_vertex
    data = info.context['request'].app.state.gremlin_client.vertex.read_many(
  File "/webapp/invana/gremlin/base.py", line 91, in read_many
    return self._read_many(label=label, namespace=namespace, query=query, limit=limit, skip=skip)
  File "/webapp/invana/gremlin/vertex.py", line 88, in _read_many
    for _ in filtered_data.elementMap().toList():
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 58, in toList
    return list(iter(self))
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 48, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/process/traversal.py", line 573, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/remote_connection.py", line 149, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/driver_remote_connection.py", line 55, in submit
    result_set = self._client.submit(bytecode)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/client.py", line 111, in submit
    return self.submitAsync(message, bindings=bindings).result()
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/client.py", line 127, in submitAsync
    return conn.write(message)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/connection.py", line 55, in write
    self.connect()
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/connection.py", line 45, in connect
    self._transport.connect(self._url, self._headers)
  File "/usr/local/lib/python3.8/site-packages/gremlin_python/driver/tornado/transport.py", line 35, in connect
    self._ws = self._loop.run_sync(
  File "/usr/local/lib/python3.8/site-packages/tornado/ioloop.py", line 576, in run_sync
    return future_cell[0].result()
graphql.error.located_error.GraphQLLocatedError: [Errno 111] Connection refused

We use JanusGraph 0.5.2 as embedded database, running with embedded gremlin server on port 9900.

@lexakimov
Copy link
Author

I think I know what is the cause of this problem. invana-engine cannot access localhost from inside the container. I tried starting the container specifying the local ip address such as '192.168.1.43' and now it works fine

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant