Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpclib crash when PyXML installed - sgmlop is available #45308

Closed
ldeller mannequin opened this issue Aug 13, 2007 · 9 comments
Closed

xmlrpclib crash when PyXML installed - sgmlop is available #45308

ldeller mannequin opened this issue Aug 13, 2007 · 9 comments
Labels
extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@ldeller
Copy link
Mannequin

ldeller mannequin commented Aug 13, 2007

BPO 1772916
Nosy @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-08-01.22:53:27.183>
created_at = <Date 2007-08-13.08:15:58.000>
labels = ['extension-modules', 'type-crash']
title = 'xmlrpclib crash when PyXML installed - sgmlop is available'
updated_at = <Date 2010-08-01.22:53:27.182>
user = 'https://bugs.python.org/ldeller'

bugs.python.org fields:

activity = <Date 2010-08-01.22:53:27.182>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2010-08-01.22:53:27.183>
closer = 'georg.brandl'
components = ['Extension Modules']
creation = <Date 2007-08-13.08:15:58.000>
creator = 'ldeller'
dependencies = []
files = []
hgrepos = []
issue_num = 1772916
keywords = []
message_count = 9.0
messages = ['32637', '32638', '32639', '32640', '32641', '32642', '32643', '57097', '112394']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'mak']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue1772916'
versions = ['Python 2.6', '3rd party', 'Python 3.0']

@ldeller
Copy link
Mannequin Author

ldeller mannequin commented Aug 13, 2007

The xmlrpclib module in the standard library will use a 3rd party C extension called "sgmlop" if it is present.

The last version of PyXML (0.8.4) includes this module, but it causes crashes with Python 2.5 due to the use of mismatched memory allocation/deallocation functions (PyObject_NEW and PyMem_DEL).

It is unlikely that sgmlop will be fixed, as PyXML is no longer maintained. Therefore sgmlop support should be removed from xmlrpclib.

(In case you're wondering why anyone would install PyXML with Python 2.5 anyway: there are still some 3rd party libraries which depend upon PyXML, such as ZSI and twisted).

@ldeller ldeller mannequin added stdlib Python modules in the Lib dir labels Aug 13, 2007
@alanmcintyre
Copy link
Mannequin

alanmcintyre mannequin commented Aug 13, 2007

I'm assuming that stuff won't be removed from 2.5 because it's in maintenance, so should this be removed or changed to raise a deprecation warning in 2.6?

As an aside, how about removing references to _xmlrpclib (which appears to have been removed long ago) as well?

@ldeller
Copy link
Mannequin Author

ldeller mannequin commented Aug 14, 2007

Choice of XML parser is an implementation detail of xmlrpclib not visible to users of the module. This change would not affect the behaviour of xmlrpclib (other than to fix a crash introduced in Python 2.5). Does this mean that a DeprecationWarning would not be necessary? Does it also mean that the fix might qualify for the maintenance branch?

Adding a DeprecationWarning in 2.6 without removing use of sgmlop is pointless, because the DeprecationWarning would be followed by a process crash anyway.

@alanmcintyre
Copy link
Mannequin

alanmcintyre mannequin commented Aug 14, 2007

I tried out xmlrpclib on the trunk (2.6) with sgmlop-1.1.1 and it works just fine. At the moment I don't have time to try out PyXML, but seeing that the most recent sgmlop works with xmlrpclib makes me lean towards not removing sgmlop support (not that I have a say about it, but still).

How did you install PyXML? If it wasn't from source or from an installer compiled for 2.5, that might be a problem. If PyXML installed from source or compiled for 2.5 still causes this problem, it could be that it needs to be updated to the current sgmlop.

@ldeller
Copy link
Mannequin Author

ldeller mannequin commented Aug 14, 2007

Yes the standalone sgmlop-1.1.1 looks fine: in its sgmlop.c I can see that matching allocator and deallocator functions are used.

I installed PyXML-0.8.4 from source ("python setup.py install" on Win32 which picked up the C compiler from MSVS7.1). The cause of the problem is quite visible in the PyXML source code (see that PyObject_NEW and PyMem_DEL are used together):
http://pyxml.cvs.sourceforge.net/pyxml/xml/extensions/sgmlop.c?view=markup

Interestingly PyXML-0.8.4 was released more recently than sgmlop-1.1.1. I guess they weren't keeping in sync with each other.

@loewis
Copy link
Mannequin

loewis mannequin commented Aug 21, 2007

Fredrik, can you please comment? If not, unassign.

@effbot
Copy link
Mannequin

effbot mannequin commented Aug 21, 2007

I don't really have an opinion here; the best solution would of course be to find someone that cares enough about PyXML to cut a bugfix release, it's probably easiest to just remove it (or disable, with a note that it can be re-enabled if you have a stable version of sgmlop). I'm tempted to suggest removing SlowParser as well, but there might be some hackers on very small devices that rely on that one.

(Ideally, someone should sit down and rewrite the Unmarshaller to use xml.etree.cElementTree's iterparse function instead. Contact me if you're interested).

@mak
Copy link
Mannequin

mak mannequin commented Nov 4, 2007

Minimalistic test crash (python 2.5 cvs, sgmlop cvs(pyxml)) - compiled
with msvc 2005, where after 10 loops ms-debugger is invoked:
data='''\
<?xml version="1.0"?>
<methodCall>
<methodName>mws.ScannerLogout</methodName>
<params>
<param>
<value>
<i4>7</i4>
</value>
</param>
</params>
</methodCall>
'''

import xmlrpclib

def main():
    i = 1
    while 1:
        print i
        params, method = xmlrpclib.loads(data)
        i+=1
main()

@mak mak mannequin added extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Nov 4, 2007
@mak mak mannequin changed the title xmlrpclib crash when PyXML installed xmlrpclib crash when PyXML installed - sgmlop is available Nov 4, 2007
@mak mak mannequin added extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Nov 4, 2007
@mak mak mannequin changed the title xmlrpclib crash when PyXML installed xmlrpclib crash when PyXML installed - sgmlop is available Nov 4, 2007
@devdanzin devdanzin mannequin added type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 7, 2009
@birkenfeld
Copy link
Member

Both PyXML and sgmlop are deprecated now, and support has been removed in xmlrpclib as of Python 2.7. I think this can be closed.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant