[Mono-devel-list] Releasing connections from pool

Jaroslaw Kowalski jaak at zd.com.pl
Sun Dec 28 09:29:01 EST 2003

I think that this kind of work should be done in finalizers (C#
destructors). Theory says you shouldn't rely on finalizers to be called at
any particular moment, but in practice MS calls all finalizers after app
exits (but does not allow them to take AFAIR 40 seconds to execute). After
that timeout the process terminates. I'm not sure how mono handles this.
Some time ago, finalizers weren't called property but I haven't checked
since then.

There's also AppDomain.DomainUnload event which might be interesting to you.


----- Original Message ----- 
From: "Francisco Figueiredo Jr." <fxjrlists at yahoo.com.br>
To: "mono-devel mailing list" <mono-devel-list at lists.ximian.com>
Sent: Sunday, December 28, 2003 3:23 PM
Subject: [Mono-devel-list] Releasing connections from pool

> 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?
> Thanks in advance.
> Regards,
> Francisco Figueiredo Jr.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list