Re: "could not reattach to shared memory" captured in buildfarm

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Dave Page <dpage(at)postgresql(dot)org>
Subject: Re: "could not reattach to shared memory" captured in buildfarm
Date: 2009-05-05 22:15:21
Message-ID: 13271.1241561721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> One proposed fix is to allocate a fairly large block of memory in the
> postmaster just before we get the shared memory, and then free it right
> away. The effect should be to push down the shared memory segment
> further in the address space.

I have no enthusiasm for doing something like this when we have so
little knowledge of what's actually happening. We have *no* idea
whether the above could help, or what size of allocation to request.
It's not very hard to imagine that the wrong size choice could make
things worse rather than better.

It seems to me that what we ought to do now is make a serious effort
to gather more data. I came across a suggestion that one could use
VirtualQuery() to generate a map of the process address space
under Windows. I suggest that we add some code that is executed
if the reattach attempt fails and dumps the process address space
details to the postmaster log. Dumping the postmaster's address
space at the time it successfully creates the shmem segment might
be useful for comparison, too.

(A quick look at the VirtualQuery spec indicates that you can't tell
very much beyond free/allocated status, though. Maybe there's some
other call that would tell more? It'd be really good if we could get
the names of DLLs occupying memory ranges, for example.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-05 22:27:12 Re: Wrong stats for empty tables
Previous Message Josh Berkus 2009-05-05 22:10:06 Re: Wrong stats for empty tables