[Mono-devel-list] Releasing connections from pool

Reggie Burnett rykr at bellsouth.net
Sun Dec 28 22:58:35 EST 2003


> 
> Hi all!
> 
> I'm working in getting connection pool in Npgsql.
> 
> But I'm facing a little problem I wasn't aware before:
> 
> When I close the connection, if it is being pooled, I return it back to
> pool. Ok, but what happens when the client program exits? I mean, if it
> specify Npgsql to use a pool, it opens a connection, close it and so
> exits, who will release the connection from the pool?
> 
> I know that the Stream object handle the unmanaged tcp connection and on
> its dispose(false) method it will release the unmanaged connection
> cleanly, but even with this, Postgresql still logs about receiving eof
> from the client connection.
> 
> I was checking the bytefx and sqlclient code about connection pool and I
> couldn't see anything about this too. So I suppose that with their code
> this also happens.
> 
> Pedro, guys, do you have any idea about that?
> 
> I was thinking about some way to register an eventhandler which would
> notice me about the app domain unloading where I could check the
> connection pool and release any connection there is in it.
> 
> Would this be possible? There may be some other clearer solution?
> 

I don't think I see the problem here.  The only unmanaged resource we are
really concerned with is the connection to the database.  The database has
to be able to cleanly handle a dropped connection so domain unloading will
dispose the socket connections for us.    The rest of the pooling is
completely managed and doesn't need disposing.

Am I missing something obvious here?

Reggie




More information about the Mono-devel-list mailing list