Re: Postgresql 8.3 beta crash

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Sheikh Amjad <sheikhamjad(at)gmail(dot)com>
Subject: Re: Postgresql 8.3 beta crash
Date: 2007-10-31 17:56:09
Message-ID: 4728C1B9.90809@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> I was able to reproduce this after replacing those VARCHAR2's with
> VARCHAR. I added some debugging elog's (attached), and it looks like
> libxml2 is trying xml_pfree a pointer we never gave it in any of the
> alloc functions. Log attached, last xml_pfree crashes and it's the first
> time 853c180 is mentioned.

Looking closer, I think it's a memory management bug on our end. I
hadn't looked at the way we use palloc with xml before.

So my current theory is:

In xmlelement(), we use ExecEvalExpr(), which in turn calls xml_parse.
xml_parse calls xmlCleanupParser(). But when we call ExecEvalExpr(),
we're in the middle of constructing an xml buffer, so calling
xmlCleanupBuffer() probably frees something we still need.

Does that sound plausible to you libxml experts out there? If so, how
about we move the calls to ExecEvalExpr() before we start building the
xml buffer?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message andy 2007-10-31 18:49:39 psql show dbsize?
Previous Message andy 2007-10-31 17:51:16 pg 8.3beta 2 restore db with autovacuum report