Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Issue - Client exits without throwing any error during connection attempt #68

Open
mkkhedawat opened this issue Jan 10, 2025 · 1 comment

Comments

@mkkhedawat
Copy link

I tried standard example and it exits without printing any error or data.

Additionally, I was following the parallel issue and tried that debug example

const SASL_CODES = {
    START: 1,
    OK: 2,
    BAD: 3,
    ERROR: 4,
    COMPLETE: 5,
}
function createSaslPackage(status, body) {
    const bodyLength = Buffer.alloc(4);

    bodyLength.writeUInt32BE(body.length, 0);

    return Buffer.concat([ Buffer.from([ status ]), bodyLength, body ]);
}

const conn = net.createConnection(PORT, HOST);
conn.addListener('connect', () => {
    console.log('connect - init');
    conn.write(createSaslPackage(SASL_CODES.START, Buffer.from('PLAIN')))
    conn.write(createSaslPackage(SASL_CODES.OK, Buffer.concat([
        Buffer.from(USERNAME || ""),
        Buffer.from([0]),
        Buffer.from(USERNAME || ""),
        Buffer.from([0]),
        Buffer.from(PASSWORD || ""),
    ])))
    console.log('connect - finish');
});
conn.addListener('error', (error) => console.error(error));
conn.on('error', (error) => console.error(error));
conn.addListener('close', (hadError) => console.log(`closed - ${hadError}`));
conn.addListener('data', (data) => {
   if (data[0] == SASL_CODES.COMPLETE) {
       console.log('authenticated successfully')
   } else {
      console.log("Authentication failed: " + data.toString());
    }
})

In case of above, output is

$ node test.js
connect - init
connect - finish
closed - false

Same result with Node 18 and 23.

@lenchv
Copy link
Owner

lenchv commented Jan 10, 2025

@mkkhedawat if there is no data, perhaps hive server doesn't respond. What does the hive.log output says? There might be a clue as to where the problem comes from.

Also what are the values of your hive-site.xml configurations for following properties?

    <property>
        <name>hive.server2.transport.mode</name>
        <value>...</value>
    </property>
    <property>
        <name>hive.server2.authentication</name>
        <value>...</value>
    </property>

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

No branches or pull requests

2 participants