Re: Postgresql 8.3 beta crash - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Postgresql 8.3 beta crash
Date
Msg-id 4728C1B9.90809@enterprisedb.com
Whole thread Raw
In response to Re: Postgresql 8.3 beta crash  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: Postgresql 8.3 beta crash
List 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


pgsql-hackers by date:

Previous
From: andy
Date:
Subject: pg 8.3beta 2 restore db with autovacuum report
Next
From: andy
Date:
Subject: psql show dbsize?