lenchv / hive-driver

Driver for connection to Apache Hive via Thrift API
MIT License
40 stars 9 forks source link

trying out getting started examples, fails at client.openSession #45

Closed myou closed 8 months ago

myou commented 2 years ago

I traced the code a little bit, in driver.openSession, action.execute(request) seems to hang, and the promise never resolves

confirmed local thrift is running via beeline

lenchv commented 2 years ago

needs more information how to reproduce, as openSession is checked in test pipeline https://github.com/lenchv/hive-driver/blob/master/tests/e2e/operations/data_types.test.js#L33

addlistener commented 2 years ago

Same here. I'm using https://github.com/big-data-europe/docker-hive at localhost 10000; The example hang at client.openSession.

davidkhala commented 2 years ago

not sure if it is the same use.

background

I have setup a hive server with username & password node v18.7.0

code snippets

const promiseSession = client.openSession({
            client_protocol: TCLIService_types.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
});

console.debug(await promiseSession)

When we await client.openSession promise, the entire node process exit with 0. No error found and no success hint.

lenchv commented 2 years ago

@davidkhala it is not related to this issue, but related to how nodejs works, try to wrap your code with IIFE

(async () => {
    const promiseSession = client.openSession({
                client_protocol: TCLIService_types.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
    });

    console.debug(await promiseSession)
})()
davidkhala commented 2 years ago

@davidkhala it is not related to this issue, but related to how nodejs works, try to wrap your code with IIFE

(async () => {
    const promiseSession = client.openSession({
                client_protocol: TCLIService_types.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
    });

    console.debug(await promiseSession)
})()

@lenchv thanks for your prompt reply, actually it is just part of full text, and I am quite sure not a syntax error, but the process exit happend within client.openSession.

Here are the context https://github.com/davidkhala/node-databases/blob/main/hive/index.js

lenchv commented 8 months ago

@davidkhala sorry, didn't notice your reply back then, hope you found a solution for the problem. For the context, perhaps the issue happens inside the TCP connection itself, so you might try to subscribe on client events to figure out the core problem:

        this.connection = new hive.HiveClient(
            TCLIService,
            TCLIService_types
        );
        this.connection.on('error', console.debug);
        this.connection.on('close', () => console.log('connection closed'));

but this is strange the entire process crashes