Re: windows shared memory error

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: windows shared memory error
Date: 2009-05-03 09:40:27
Message-ID: 49FD668B.7080209@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
>>
>> Now this would only explain problems if there were some code path
>> through the postmaster that could leave the errno set to
>> ERROR_ALREADY_EXISTS (a/k/a EEXIST) when this code is reached. I'm not
>> sure there is one, and I have even less of a theory as to why system
>> load might make it more probable to happen. Still, this looks like a
>> bug from here, and repeating the create call won't fix it.
>>
>>
>>
>
> Oh, I think that this code has such a path. We already know that the
> code I showed is entered when that error is set. So the solution would
> be to put SetError(0) before the call to CreateFileMapping(), possibly
> before both such calls.
>
> Maybe we need to look at all the places we call GetLastError(). There
> are quite a few of them.

A quick look shows that all of these except the one in
pgwin32_get_dynamic_tokeninfo() (which uses a documented way to check
the return code in the case of success) are only called after an API
function fails, so we should be safe there.

//Magnus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yeb Havinga 2009-05-03 10:40:17 Re: Gist consistent and compression
Previous Message Magnus Hagander 2009-05-03 09:28:45 Re: windows shared memory error