vesoft-inc / nebula-python

Client API of Nebula Graph in Python
194 stars 76 forks source link

when I use nebula3-python(version:3.1.0) to connect nebula3.2.0 "Unexpected type for skipping xxx" happened #236

Open daidai0235 opened 1 year ago

daidai0235 commented 1 year ago

This Exception raised from nebula3.fbthrift.TProtocol.TProtocolBase,TTYPE has attrs 0-19,but "xxx" can be 34、58、44、123、92、117、34、108、116 and more.

wey-gu commented 1 year ago

Would you mind sharing a detailed reproduce process so that others could try helping on this?

daidai0235 commented 1 year ago
    @awaitable
    def initialize(self, conf):
        self.conf = conf
        configer = Config()
        configer.max_connection_pool_size = self.conf.get('max_size', 1)
        self._pool = ConnectionPool()
        self._pool.init(self.conf['addresses'], configer)

    @awaitable
    def execute(self, command, method=None):
        begin_time = time.time()
        try:
            self.session = self._pool.get_session(self.conf['user'], self.conf['password'])
            while True:
                resultset = self.session.execute(command)  # raised from
                err_code, result = self.parseResultSet(resultset, method)
                if err_code:
                    if err_code == -1009:
                        self.session.execute('use frfr;')
                    else:
                        raise Exception(result)
                else:
                    break
            return result
        except Exception as e:
            raise e
async def _get_frame_info(self, frames_str):
        command = f'FETCH PROP ON frame {frames_str} YIELD id(vertex) as id, properties(vertex).ip as ip, ' \
                  f'properties(vertex).type_statistics as type_statistics'
        result = await self.execute(command, method='frame')
daidai0235 commented 1 year ago

same as "https://discuss.nebula-graph.com.cn/t/topic/7857"

daidai0235 commented 1 year ago

nebula3-python version=3.3.0 has no problem above

wey-gu commented 1 year ago

Strange, are you using the session pool from 3.3.0 or everything is the same but for the version of nebula-python?

Also, plz be noted that nebula-python is not thread-safe.

daidai0235 commented 1 year ago

yes,I am using the session pool from 3.3.0

wey-gu commented 1 year ago

ok, it may be related to how session was created/shared among requests before? cc @Aiee