after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
possibly diagnostic and extremely irritating is that I can't back out to my previous version of lxml.
-w
------------------------------------------------------------------------
# ganked from z0pt and sfive import os from StringIO import StringIO
slug = """ <div><some tag="true"> <other /> </some> </div> """
def xstrip(text): """ strip out whitespace >>> print xstrip(slug) <div><some tag="true"><other></other></some></div> ... """ if not text: return '' from lxml import etree xsltfile = os.path.join(os.path.dirname(__file__), 'strip.xsl') xslt = open(xsltfile) xslt_doc = etree.parse(xslt) style = etree.XSLT(xslt_doc) xslt.close() doc = etree.fromstring(text) result = style(doc) return str(result)
import unittest from zope.testing import doctest optionflags = doctest.REPORT_ONLY_FIRST_FAILURE | doctest.ELLIPSIS def test_suite():
return unittest.TestSuite(( doctest.DocTestSuite('xml', optionflags=optionflags) ))
if __name__=="__main__": unittest.TextTestRunner().run(test_suite())
------------------------------------------------------------------------
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet>
-- | david "whit" morriss | | contact :: http://public.xdi.org/=whit "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 "I like to write code like other ppl like to tune their cars or 10kW hifi equipment..." Christian Heimes, 2004
whit a écrit :
after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
Are you using the OSX Tiger egg from pypi or your own egg build from lxml trunk?
possibly diagnostic and extremely irritating is that I can't back out to my previous version of lxml.
You can still build lxml from the tarball since you have your own gcc / pyrex. -- Olivier
whit wrote:
after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
Hi, thanks for reporting this. I cleaned up your test case somewhat and came up with this: ---------------------------- slug = """ <div><some tag="true"> <other /> </some> </div> """ xslt = """\ <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet> """ from lxml import etree xslt_doc = etree.XML(xslt) style = etree.XSLT(xslt_doc) doc = etree.XML(slug) result = style(doc) print 1 del result print 2 ---------------------------- This triggers a double free in _Document.__dealloc__() calling xmlFreeDoc() when result is GCed on "del result". This is exactly the same problem I had with the HTML parser branch. It is triggered because you use "html" as output method, which makes libxslt output HTML trees with HTML document nodes instead of XML document nodes. I've applied the fix to trunk and 0.9 branch. Please test it. Stefan
I've tried the following permutations:: easy_install lxml easy_install http://codespeak.net/lxml/lxml-0.9.tgz (installs without xslt.py and several other files) untarring and installing http://codespeak.net/lxml/lxml-0.9.tgz (python setup.py install) python setup.py bdist; easy_install dist/....egg building locally doesn't seem to help. same for trunk, and tags of .8 and .9 all get similar errors. -w Olivier Grisel wrote:
whit a écrit :
after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
Are you using the OSX Tiger egg from pypi or your own egg build from lxml trunk?
possibly diagnostic and extremely irritating is that I can't back out to my previous version of lxml.
You can still build lxml from the tarball since you have your own gcc / pyrex.
-- | david "whit" morriss | | contact :: http://public.xdi.org/=whit "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 "I like to write code like other ppl like to tune their cars or 10kW hifi equipment..." Christian Heimes, 2004
awesome. that passes on my machine. -w Stefan Behnel wrote:
whit wrote:
after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
Hi, thanks for reporting this. I cleaned up your test case somewhat and came up with this:
---------------------------- slug = """ <div><some tag="true"> <other /> </some> </div> """
xslt = """\ <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet> """
from lxml import etree xslt_doc = etree.XML(xslt) style = etree.XSLT(xslt_doc)
doc = etree.XML(slug) result = style(doc) print 1 del result print 2 ----------------------------
This triggers a double free in _Document.__dealloc__() calling xmlFreeDoc() when result is GCed on "del result".
This is exactly the same problem I had with the HTML parser branch. It is triggered because you use "html" as output method, which makes libxslt output HTML trees with HTML document nodes instead of XML document nodes. I've applied the fix to trunk and 0.9 branch. Please test it.
Stefan
-- | david "whit" morriss | | contact :: http://public.xdi.org/=whit "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 "I like to write code like other ppl like to tune their cars or 10kW hifi equipment..." Christian Heimes, 2004
participants (3)
-
Olivier Grisel
-
Stefan Behnel
-
whit