[racket] db connection pools
Hi Ryan,
On 1/16/2015 10:44 AM, Ryan Culpepper wrote:
> On 01/16/2015 03:13 AM, George Neuner wrote:
>> Does anything have to be done to safely shutdown a connection pool and
>> close idle connections?
>
> There's no explicit shutdown procedure. I would recommend removing all
> references to the pool and letting the GC clean up its connections.
> Port-based connections (postgresql and mysql) are closed when their
> custodian is shutdown, and in recent versions of Racket (about a month
> ago) so are sqlite3 connections.
The pool would be shut down only to terminate the application, so I'm
not sure that GC would ever run [though I could force it before
terminating]. I am mostly worried about the connections being broken
rather than closed cleanly and holding onto DBMS resources. I haven't
seen that but I am using a large pool and so I have to worry about it.
>> Also, it is mentioned that an exception is thrown if
>> connection-pool-lease fails, but not what exception.
>
> If attempting to create a new connection fails, you should get that
> exception, whatever it is. You can also get a generic exception
> (exn:fail, I think) with the message "connection pool limit reached"
> from the pool itself.
I'll have to try to force the situation and see what happens.
Thanks,
George