I ran into a problem while using virtual-connections with
connection-pooling in my webserver.


With a postgres database. If the database itself gets restarted after a
connection is formed from the webserver, then I cannot re-establish a
connection afterword.

In production the database and webserver are on different hosts, but my
development box those the same symptoms.


So here is what I see....

(require db)



(define conn #f)

(define (reset)
  (set! conn (virtual-connection (connection-pool (λ ()
                                                    (postgresql-connect
#:server "localhost"

#:user "postgres"

#:password "postgres"

#:database "test"))
                                                  #:max-idle-connections
5))))


(define (go)
  (query conn "SELECT * FROM test"))

(reset)

(go)
;get results

;now restart my postgres server

(go)
. . tcp-write: error writing
  system error: Unknown error; errno=10054

;ok what now?
(disconnect conn)
(go)
. . tcp-write: error writing
  system error: Unknown error; errno=10054

;now what
(reset)
(go)
;I get my results again


I think what I expect is that the connection would be renegotiated for me.
Or maybe at least renegotiated if I run disconnect afterword. If that isn't
the case, that is fine... How should I handle this case?

Thanks,
   Curtis
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to