[HACKERS] pg_ctl {start,restart,reload} bad handling of stdout file descriptor

2014-12-30 Thread Luis Menina
Hi,

I've been trying to run some pg_ctl command inside a python script,
and saw that some of them where deadlocking. It seems that the
commands that start postgres handle stdout in a way that that block
the caller. Redirecting stdout to /dev/null or to a file using the -l
option allow me to workaround the problem, but fixing it upstream
would be nice.

Here's a simple python program that reproduces the problem, and should deadlock.
Customize your data path first, of course.

Regards,
-- 
Luis MENINA / Software Engineer
Web: www.anevia.com
Anevia: 1 rue René Anjolvy, 94250 Gentilly, France
#! /usr/bin/env python

import subprocess

PGDATADIR = '/mnt/streams1/pgsql/localdb/data'

# WORKS !!! (because of stdout redirection)
#cmd = 'sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl restart -w -s -m fast -D ' + PGDATADIR + '  /dev/null'
#cmd = 'sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl restart -w -s -m fast -D ' + PGDATADIR + ' -l /tmp/postgres.log'

# BROKEN !!!
#cmd = 'sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl restart -w -s -m fast -D ' + PGDATADIR + ' 21'
cmd = 'sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl restart -w -s -m fast -D ' + PGDATADIR

print cmd

print Running subprocess.check_output
subprocess.check_output(cmd, shell=True)

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pg_ctl {start,restart,reload} bad handling of stdout file descriptor

2014-12-30 Thread Luis Menina
I knew I'd forget something...
I'm running Postgres 9.3.5 on Debian/Linux.

Regards,
--
Luis MENINA / Software Engineer
Web: www.anevia.com
Anevia: 1 rue René Anjolvy, 94250 Gentilly, France


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers