astropy/astropy — pull request #2357 by pllim (2014-04-22 18:05:06+00:00)
Title: Prevent VOTable validator from crashing xmllint encounters SIGKILL

This happened when 'vo.xml' was too large (400+ MB), causing memory problem and resulted in system sending kill signal to the process.

The offending URL was a Cone Search query http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-B1&ra=0&dec=0&sr=1

>>> from astropy.io.votable.validator.result import Result
>>> r = Result(url)
>>> r.validate_vo()

This fix was suggested by @mdboom and would just set `xmllint` result as `None` instead of crashing. However, it does not fix the memory issue, it just catches the resultant error.

>>> r._attributes
{u'network_error': None,
u'nexceptions': 0,
u'nwarnings': 22,
u'version': u'1.1',
u'warning_types': {'W06', 'W35', 'W50'},
u'warnings': ["./df/3a/a0b5f3ab4afe30172cf585203db5/vo.xml:7:0: W35: 'name' attribute required for INFO elements",
"./df/3a/a0b5f3ab4afe30172cf585203db5/vo.xml:7:0: W35: 'value' attribute required for INFO elements", ...,
u'xmllint': None,
u'xmllint_content': "xmllint was terminated by signal 'SIGKILL'"}

There are no change log entry nor test for `Result` because it is not documented and not meant to be an end-user facing API.