Thread: 'pg_ctl -w' times out when unix_socket_directory is set
When I have "unix_socket_directory" set to an alternate value, "pg_ctl - D data -w start" times out. If I set it to default, it works fine. I'm using postgresql 8.1.4 on FreeBSD. Perhaps pg_ctl is waiting to see the socket file in /tmp/ before reporting that postgresql successfully started? Regards, Jeff Davis
On Wed, 2006-09-27 at 14:26 -0700, Jeff Davis wrote: > When I have "unix_socket_directory" set to an alternate value, "pg_ctl - > D data -w start" times out. If I set it to default, it works fine. > > I'm using postgresql 8.1.4 on FreeBSD. > > Perhaps pg_ctl is waiting to see the socket file in /tmp/ before > reporting that postgresql successfully started? > I took a look at the source quickly (as usual, the postgres source is so easy to read I should have looked before I posted) and I found that the problem seems to be in test_postmaster_connection() in pg_ctl.c. The function checks for a non-default port, including scanning the configuration file, but does not look for a non-default socket directory. It seems reasonable to add a check to find the real socket directory before trying the connection. I have attached a patch. I wrote it very quickly, but it seems to work as I expect. Regards, Jeff Davis
Attachment
Jeff Davis <pgsql@j-davis.com> writes: > I have attached a patch. I wrote it very quickly, but it seems to work > as I expect. I don't think this is very workable as a postgresql.conf parser ... at minimum it needs to handle quoted strings correctly, and really it ought to deal with file inclusions. There are other reasons why pg_ctl needs to look at postgresql.conf --- it currently fails to cope with config-file-outside-the-datadir cases, and that can't be fixed except by extracting the data_directory setting from the config file. What we probably need to do is port guc-file.l into the pg_ctl environment. (Not sure if it's feasible to use a single source file for both cases, though that would be nice if not too messy.) regards, tom lane