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

Really, how do you end a connection/disconnect without getting the 'unexpected EOF' message in the server log? #48

Open
kimwykoff opened this issue Sep 14, 2015 · 4 comments

Comments

@kimwykoff
Copy link

Hi,

Sorry I'm posting this again, but I'm still having this issue and I don't know if I can re-open the closed issue. I put added some comments on the other issue, but I don't know if anyone will read them.

I'm using node-vertica version 0.5.2 and Vertica Analytic Database v7.1.1-0. I'm facing an issue where when I call disconnect(), I always see this message in the server log:

Unexpected EOF on client connection

I'm simply executing a query and then disconnecting:

var   vertica = require('vertica')
var _ = require('lodash')

var verticaSettings = {<props>}

vertica.connect(verticaSettings, function (err, conn) {
    if (err) {
        console.log('connection error', err)
    } else {
        queryVertica("select count(*) from sessions", conn, function(err, results) {
            console.log('err = ', err)
            console.log('results = ', results)
            conn.disconnect()
        })
    }
})

The log file still indicates an Unexpected EOF:

8:17.729 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/2705: Connection received: host=192.168.249.1 port=51740 (connCnt 3)
8:17.730 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/4540: Received SSL negotiation startup packet
8:17.730 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/4691: Sending SSL negotiation response 'N'
8:17.733 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/4686: Authentication - sendAuthRequest: user=dbUser database=verticaDB host=192.168.249.1 authType=3
8:17.735 Init Session:0x7fed34014010-a0000000006308 [Txn] <INFO> Begin Txn: a0000000006308 'check_login_history'
8:17.735 Init Session:0x7fed34014010-a0000000006308 [Txn] <INFO> Rollback Txn: a0000000006308 'check_login_history'
8:17.735 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/4686: Authentication - sendAuthRequest: user=dbUser database=verticaDB host=192.168.249.1 authType=0
8:17.735 Init Session:0x7fed34014010 <LOG> @v_verticadb_node0001: 00000/2703: Connection authenticated: user=dbUser database=verticaDB host=192.168.249.1
8:17.737 Init Session:0x7fed34014010 [Session] <INFO> [Query] TX:0(iod-vertica-1-20028:0x36fdd) select count(*) from sessions
8:17.738 Init Session:0x7fed34014010-a0000000006309 [Txn] <INFO> Begin Txn: a0000000006309 'select count(*) from sessions'
8:17.785 Init Session:0x7fed34014010-a0000000006309 <LOG> @v_verticadb_node0001: 08006/5167: Unexpected EOF on client connection
8:17.785 Init Session:0x7fed34014010-a0000000006309 <LOG> @v_verticadb_node0001: 00000/4719: Session iod-vertica-1-20028:0x36fdd ended; closing connection (connCnt 3)
8:17.785 Init Session:0x7fed34014010-a0000000006309 [Txn] <INFO> Rollback Txn: a0000000006309 'select count(*) from sessions'

I noticed that vertica provides the finish() method in their odbc driver and if finish() is called from perl, then there is no 'Unexpected EOF' message:

$query = "SELECT distinct Calendar_Month_Name FROM Date_Dimension";
$sth = $dbh->prepare($query);
$sth->execute();

# Bind the variables and then look throuhg the results

$sth->bind_columns(undef, \$month );

while($sth->fetch())
   {
   print "$month\n"
   }
# Disconnect from the database
$sth->finish;
$dbh->disconnect
or warn "Disconnection failed: $DBI::errstr\n";
exit;

I couldn't find a 'finish' call in the node-vertica module. Perhaps this is the problem?

@asaf-lahav
Copy link

I have the same issue...
Did you manage to resolve this?

@boazshor
Copy link

Hi All,
I am working on a very big project utilizing your driver and I'm experiencing the same problem.
Every time I close a connection I get the msg : Unexpected EOF on client connection.
I read it might be caused by closing the connection incorrectly.
Is there a fix on the horizon?
Thanks.

@wvanbergen
Copy link
Owner

I am not planning on working on this any time soon, because I don't work with either node, nor Vertica anymore on a daily basis. I would welcome a fix though.

@RajithaFernando
Copy link

RajithaFernando commented Jan 4, 2021

I used something like below. Creates a connection for each request.

```
let connection;

try {
    connection.disconnect()
}
catch (e) {
    // console.log(e)
}
finally {
    
    connection = new Vertica({
        user: 'userName',
        host: 'IP',
        database: 'DB',
        password: 'password',
        post: 5433,
        keepAlive: false
    }, (error) => {
        if (error) {
            // DO SOMETHING
        }
        else {
            // DO SOMETHING
        }
    })
}
// YOUR QUERY

Therefore, for each request, There will be a new Connection

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

5 participants