Re: Dangerous code in syslogger? - Mailing list pgsql-hackers-win32

From Tom Lane
Subject Re: Dangerous code in syslogger?
Date
Msg-id 12916.1099689317@sss.pgh.pa.us
Whole thread Raw
In response to Dangerous code in syslogger?  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-hackers-win32
"Magnus Hagander" <mha@sollentuna.net> writes:
> I'm trying to track down a problem with socket inheritance and the
> syslogger, and I noticed something that I think is very dangerous code:
> The function pipeThread() is called on a non-default thread, and yet
> uses ereport(). ereport() is, AFAIK, not thread-safe. Am I mistaken
> here, or is this a crash waiting to happen?

I think you're right.  Might be best to restructure the locking so that
rather than protecting only access to syslogFile, the data transfer
thread holds the lock whenever it's not doing ReadFile() from the pipe,
and the main thread likewise holds the lock except when sleeping.

            regards, tom lane

pgsql-hackers-win32 by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Dangerous code in syslogger?
Next
From: Tom Lane
Date:
Subject: Isn't win32_make_absolute() a waste of time?