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

Re: Fwd: 8.0 Beta3 worked, RC1 didn't!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gary Doades <gpd(at)gpdnet(dot)co(dot)uk>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Fwd: 8.0 Beta3 worked, RC1 didn't!
Date: 2004-12-24 16:30:17
Message-ID: 8916.1103905817@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
Gary Doades <gpd(at)gpdnet(dot)co(dot)uk> writes:
> Tom Lane wrote:
>> Win32 may not care, but we do.  The shared memory segment must be mapped
>> at the same address in every backend.

> Forgive me for not knowing the internals of postgres, but why? As long 
> as all the shared memory is accessed from the same relative offsets from 
> the private starting address it will refer to the same physical shared 
> memory address and should work.

Because we use absolute addresses in many cases.  There was once a
convention of making everything relative to ShmemBase, but we've
abandoned that for reasons of code simplicity (and to a lesser extent
performance).  There are still some places using relative offsets but
they are gradually going away.  We are not reversing that decision
just because some flavors of Windows have stupid algorithms for
assigning default shmem addresses.

> If this is the case then your suggestion may be the only one, to 
> artificially bump up the first free address and hope that it is enough. 
> Seems a bit hit and miss though (probably more hit than miss) since it's 
> not easily known what the extra allocation for the subsequent backends 
> may be.

The needed extra allocation should really be *zero*.  Keep in mind that
the intention of the EXEC_BACKEND code is to emulate the Unix case where
backends are spawned by fork().  Therefore the state of the backend at
the point where it needs to attach to shmem should really be hardly at
all different from the state of the postmaster.  I'm moderately
interested to find out why changing listen_addresses seems to affect
this, but on the strength of the available evidence I'd suspect it's a
matter of just a few bytes that happens to exceed an allocation
boundary.

It might be that we could solve the problem by rethinking the order of
operations --- maybe we should reattach to shared memory during
restore_backend_variables, before the exec'd backend has had a chance to
do much of anything.

			regards, tom lane

In response to

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2004-12-24 17:37:49
Subject: Re: Fwd: 8.0 Beta3 worked, RC1 didn't!
Previous:From: Gary DoadesDate: 2004-12-24 16:15:30
Subject: Re: Fwd: 8.0 Beta3 worked, RC1 didn't!

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