<div dir="ltr">I ran into a problem while using virtual-connections with connection-pooling in my webserver.<div><br></div><div><br></div><div>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.</div>
<div><br></div><div>In production the database and webserver are on different hosts, but my development box those the same symptoms.</div><div><br></div><div><br></div><div>So here is what I see....</div><div><br></div><div>
<div>(require db)</div><div><br></div><div><br></div><div><br></div><div>(define conn #f)</div><div><br></div><div>(define (reset)</div><div>  (set! conn (virtual-connection (connection-pool (λ ()                  </div><div>
                                                    (postgresql-connect #:server "localhost"</div><div>                                                                        #:user "postgres"</div><div>
                                                                        #:password "postgres"</div><div>                                                                        #:database "test"))</div>
<div>                                                  #:max-idle-connections 5))))</div><div><br></div><div><br></div><div>(define (go)</div><div>  (query conn "SELECT * FROM test"))</div><div><br></div><div>(reset)</div>
</div><div><br></div><div>(go)</div><div>;get results</div><div><br></div><div>;now restart my postgres server</div><div><br></div><div>(go)</div><div><div>. . tcp-write: error writing</div><div>  system error: Unknown error; errno=10054</div>
</div><div><br></div><div>;ok what now?</div><div>(disconnect conn)</div><div>(go)</div><div><div>. . tcp-write: error writing</div><div>  system error: Unknown error; errno=10054</div></div><div><br></div><div>;now what</div>
<div>(reset)</div><div>(go)</div><div>;I get my results again</div><div><br></div><div><br></div><div><div>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? </div>
<div><br></div><div>Thanks,</div></div><div>   Curtis</div></div>