[racket] db connection-pool tip
Ryan Culpepper wrote at 08/22/2012 12:12 PM:
> Your initial experience sounds like a bug, though; it sounds like the
> connection didn't know it had been disconnected. What was the
> underlying kind of connection?
"db/postgresql".
Regarding "connected?"... My d'oh moment was when I saw that the
PostgreSQL log had messages, "EDT LOG: unexpected EOF on client
connection", appearing temporally at the end of the first use of the
connection, approximately at the time that the connection was reclaimed
by the pool. (The first DB connection was for the lifetime of a
short-lived thread, and the pool-of-pools created the "connection-pool"
on-demand within that same short-lived thread.) I then figured that the
"connected?" procedure was reporting some state that was stored on the
Racket side of the connection, which was still true -- although the
answer was known to be false by the PostgreSQL server and perhaps by a
lower networking layer on the Racket side. If that's the case for
"connected?" behavior, I suppose there might be a place for keeping that
(which has good performance) and also adding a procedure with the
different behavior of more expensive "really-connected?" and perhaps
"really-truly-connected?".
Server was PostgreSQL 8.4, talking over non-SSL'd TCP.
Thanks for looking at this.
Neil V.