Re: Dangerous code in syslogger?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "PostgreSQL Win32 port list" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Dangerous code in syslogger?
Date: 2004-11-05 21:15:17
Message-ID: 12916.1099689317@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32

"Magnus Hagander" <mha(at)sollentuna(dot)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

In response to

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2004-11-05 22:37:40 Isn't win32_make_absolute() a waste of time?
Previous Message Magnus Hagander 2004-11-05 20:13:35 Dangerous code in syslogger?