> 19 июня 2019 г., в 20:57, Christoph Berg <m...@debian.org> написал(а): > > Control: tags -1 moreinfo > > Re: Andrey Borodin 2019-06-19 > <3fd6aec7-55c8-4129-a46c-0bb3e4296...@yandex-team.ru> >> Package: postgresql-common >> Version: 199 >> >> When I execute >> service postgresql start >> I observe that logfile descriptor will leak into postmaster and every >> backend. This is not fd opened by PG's syslogger. > > That's because we use logging to stderr. > >> - my $fd = POSIX::open($info{'logfile'}, >> POSIX::O_WRONLY|POSIX::O_APPEND|POSIX::O_CREAT) or error "Could not open >> logfile $info{'logfile'}"; >> - dup2($fd, 1); >> - dup2($fd, 2); >> + open(STDOUT, ">>$info{logfile}") or die $!; >> + open(STDERR, '>&STDOUT') or die $!; > > Does that actually do things differently? Does stderr logging still > work with that patch? On my observation - yes, descriptor 4 is no longer in lsof. I looked that I see some lines of pg_ctl output like "output will be redirected etcetc" in pglog. But not from stderr.
But I've checked only on Yandex.Cloud clusters. I think I'll do repro on fresh Ubuntu... I'm not an expert in Perl, these two lines were my first experience, and even in them I needed a lot of help from colleagues with Perl background. Best regards, Andrey Borodin.