Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers-win32 by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group