CloudWanderer-io / CloudWanderer

A Python package which wanders across your AWS account and records your resources in a variety of Storage Connectors
http://cloudwanderer.io
MIT License
24 stars 1 forks source link

GremlinConnector - RuntimeError: Connection was already closed #228

Closed Sam-Martin closed 2 years ago

Sam-Martin commented 3 years ago

Environment

Local docker gremlin server connected via ws.

Action

Running

    cloudwanderer.write_resources(regions=["us-east-1"], service_resource_types=[ServiceResourceType("iam", "policy")])

Output


cloudwanderer/cloud_wanderer.py:119: in write_resources
    self._write_resource(resource)
cloudwanderer/cloud_wanderer.py:192: in _write_resource
    storage_connector.write_resource(resource)
cloudwanderer/storage_connectors/gremlin.py:89: in write_resource
    self._write_resource(resource)
cloudwanderer/storage_connectors/gremlin.py:110: in _write_resource
    traversal.next()
.venv/lib/python3.9/site-packages/gremlin_python/process/traversal.py:88: in next
    return self.__next__()
.venv/lib/python3.9/site-packages/gremlin_python/process/traversal.py:47: in __next__
    self.traversal_strategies.apply_strategies(self)
.venv/lib/python3.9/site-packages/gremlin_python/process/traversal.py:548: in apply_strategies
    traversal_strategy.apply(traversal)
.venv/lib/python3.9/site-packages/gremlin_python/driver/remote_connection.py:63: in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
.venv/lib/python3.9/site-packages/gremlin_python/driver/driver_remote_connection.py:60: in submit
    results = result_set.all().result()
../../.pyenv/versions/3.9.2/lib/python3.9/concurrent/futures/_base.py:440: in result
    return self.__get_result()
../../.pyenv/versions/3.9.2/lib/python3.9/concurrent/futures/_base.py:389: in __get_result
    raise self._exception
.venv/lib/python3.9/site-packages/gremlin_python/driver/resultset.py:90: in cb
    f.result()
../../.pyenv/versions/3.9.2/lib/python3.9/concurrent/futures/_base.py:433: in result
    return self.__get_result()
../../.pyenv/versions/3.9.2/lib/python3.9/concurrent/futures/_base.py:389: in __get_result
    raise self._exception
../../.pyenv/versions/3.9.2/lib/python3.9/concurrent/futures/thread.py:52: in run
    result = self.fn(*self.args, **self.kwargs)
.venv/lib/python3.9/site-packages/gremlin_python/driver/connection.py:82: in _receive
    data = self._transport.read()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <gremlin_python.driver.aiohttp.transport.AiohttpTransport object at 0x1096b28e0>

    def read(self):
        # Inner function to perform async read.
        async def async_read():
            async with async_timeout.timeout(self._read_timeout):
                return await self._websocket.receive()

        # Execute the async read synchronously.
        msg = self._loop.run_until_complete(async_read())

        # Need to handle multiple potential message types.
        if msg.type == aiohttp.WSMsgType.close:
            # Server is closing connection, shutdown and throw exception.
            self.close()
            raise RuntimeError("Connection was closed by server.")
        elif msg.type == aiohttp.WSMsgType.closed:
            # Should not be possible since our loop and socket would be closed.
>           raise RuntimeError("Connection was already closed.")
E           RuntimeError: Connection was already closed.```