[racket] db connection pools

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Fri Jan 16 10:44:43 EST 2015

On 01/16/2015 03:13 AM, George Neuner wrote:
> Hi all,
>
> Does anything have to be done to safely shutdown a connection pool and
> close idle connections?   The documentation (6.0.1) says new connections
> are opened under the custodian that initialized the pool, but nothing
> directly is said about what happens when the custodian terminates, and
> there is no mention of a shutdown call. Can I assume that the idle
> connections are closed automatically?

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.

> 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.

Ryan


Posted on the users mailing list.