Re: BUG #6233: pg_dump hangs with Access Violation C0000005

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pavel Holec <holec(at)email(dot)cz>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6233: pg_dump hangs with Access Violation C0000005
Date: 2011-10-05 10:42:22
Message-ID: CABUevEw98s1AaReZGufiMp+=kBp_cGdtc4f+hJeev-BQTgn=YA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Oct 5, 2011 at 09:24, Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> wrote:
> Tom Lane wrote:
>>
>> However, the flaw in that explanation is that it would basically mean
>> pg_dump doesn't work at all on Windows, at least not if you have any
>> user-defined functions, and probably some other cases too because there
>> seem to be multiple instances of the dubious coding.  It's a bit hard to
>> believe that nobody's noticed that before.
>
> It's like a double-free - you often get away with it. Some people will never
> notice it. Others will crash on it consistently. It'll crash for some people
> only on tuesday evenings on full moons, but only if they're in the southern
> hemisphere and using a laptop with an exactly 1.8GHz CPU. Etc.
>
> Add the "interesting" variety of Windows environments and configurations
> that exist and it's not surprising to see this sort of issue pop up only
> occasionally.
>
> In particular, if your libpq and pg_dump link to the exact same msvcrt *and*
> that's a dynamic (dll) runtime not a static runtime, you'll get away with
> this. If they link to the same static runtime it'll crash. If they link to
> different dynamic runtimes - different versions, different thread/debug
> options, etc - then you still might get away with it or might not, depending
> on the usual luck associated with double free issues.

Yes. Each copy of MSVCRT will have it's own heap. But if the same
version is loaded through different paths, it will just use the same
copy. But when they're different versions or flags, you get two
completely separate heaps in the app. Which is exactly the reason why
we added that function to libpq.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Chethan HB 2011-10-05 11:12:26 Fwd: [BUGS] BUG #6240: About - postgreswdinit.sql
Previous Message Basavaraj, Chethan (EXT-Other - IN/Bangalore) 2011-10-05 10:29:04 FW: About - postgreswdinit.sql