Page 1 of 1

Disconnection problem

Posted: Sat 09 Jul 2005 22:33
by szinkopa
I have just noticed that when I disconnect from PostgreSQL, its logfile shows this:

127.0.0.1(1369), otto@test, 1456 [2005-07-10 00:23:26] LOG: statement: SELECT * FROM pgsqldirect.Dept

127.0.0.1(1369), otto@test, 1456 [2005-07-10 00:24:25] LOG: unexpected EOF on client connection

127.0.0.1(1369), otto@test, 1456 [2005-07-10 00:24:25] LOG: disconnection: session time: 0:01:16.86 user=otto database=test host=127.0.0.1 port=1369


The first line is my command
Then I clicked disconnect in the DataReader sample. And nothing happened in the logfile.
Then I closed the DataReader sample application, and the 2nd and 3rd lines was added into the logfile.
This is abnormal termination, Connection.Close() method should disconnect, and it should be shown in the logfile like with psql command line tool, that disconnects correctly.

Posted: Mon 11 Jul 2005 09:17
by Oleg
This takes place due to Connection Pool. You can turn it off by adding pooling = false to your connection string. You can call PgSqlConnection.ClearPool method to close connections that currently in pool.

Posted: Sun 24 Jul 2005 18:49
by szinkopa
Ok, but when I close the application Dispose is called for the connection, isn't it? And then it should close the connection(s) properly. Right?

Posted: Mon 25 Jul 2005 13:26
by Yuri
In case where PgSqlConnection object is finalized by Garbage Collector the connection is not always closed right. You have to call explicitly PgSqlConnection.Dispose or PgSqlConnection.Close method.