From: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Subject: | Re: logger subprocess including win32 |
Date: | 2004-08-05 21:35:01 |
Message-ID: | 4112A805.4040902@pse-consulting.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Tom Lane wrote:
> Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
>
>>Attached the patch, an orgy in #ifdefs, decorated with various indents
>>and crlf line ends (glad we have pgindent).
>
>
> I spent a fair amount of time fooling with this, trying to extract
> something that I trusted enough to apply at this late date, but got
> stuck on one point. Exiting when the postmaster dies is *not* good
> enough; we want the logger to stick around until the last process
> upstream of the logger pipe is gone. In the Unix case we can detect
> this by watching for EOF on the pipe,
I saw strange errnos coming from that pipe, i.e. EMFILE. I'm not sure if
EOF is really reliable.
but I don't know how to do the equivalent in this threaded scheme
you've devised for Windows.
if (realStdErr !0 NULL)
{
...
}
#ifdef WIN32
CloseHandle(writePipe);
#else
close(syslogPipe[1]);
#endif
You probably found out yourself.
In pipeThread:
if (!ReadFile(...))
{
DWORD error = GetLastError();
if (error == ERROR_HANDLE_EOF)
exit(0);
/* errno is not set */
ereport(COMERROR,
errmsg("could not read from system logger pipe: %d", error)))}
}
> (Why is the separate thread needed, again?)
On unnamed pipes, WaitForSingleObject does not work (it always reports
"signaled", so the blocking ReadFile won't allow for
sighup/IsPostmasterRunning; select is for sockets only).
Regards,
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Pflug | 2004-08-05 21:44:01 | Re: logger subprocess including win32 |
Previous Message | Tom Lane | 2004-08-05 19:39:34 | Re: logger subprocess including win32 |