Postgres (or pg) closes backend on exit

(This is ruby-1.8.[46] on Linux).

When I strace the following script:
#!usr/bin/ruby -w
require ‘postgres’
connection = PGconn.connect(nil,nil,nil,nil,‘palga’, ‘palga’,


I see that it ends with:

send(3, “X\0\0\0\4”, 5, 0) = 5
close(3) = 0

In other words, the script somehow shuts down the backend server on
Normally this is fine, but if it’s a fork of a process that is supposed
continue with the same
backend it’s a problem.
Does anyone know how this is achieved, and therefore how I can disable
I tried GC.disable (doesn’t work) and exit! (does work, but is a bit

Thanks in advance for any help,

Han H.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs