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

Crash with OOM? #29

Closed
kennedyshead opened this issue Feb 27, 2022 · 5 comments · May be fixed by #30
Closed

Crash with OOM? #29

kennedyshead opened this issue Feb 27, 2022 · 5 comments · May be fixed by #30

Comments

@kennedyshead
Copy link

Server have 12G memory to spare so I really dont get this?

Traceback (most recent call last):
  File "/home/knutas/.local/lib/python3.9/site-packages/homeassistant/components/gdacs/__init__.py", line 154, in async_update
    await self._feed_manager.update()
  File "/home/knutas/.hass/deps/lib/python3.9/site-packages/aio_georss_client/feed_manager.py", line 46, in update
    status, feed_entries = await self._feed.update()
  File "/home/knutas/.hass/deps/lib/python3.9/site-packages/aio_georss_client/feed.py", line 77, in update
    status, rss_data = await self._fetch()
  File "/home/knutas/.hass/deps/lib/python3.9/site-packages/aio_georss_client/feed.py", line 114, in _fetch
    feed_data = parser.parse(text)
  File "/home/knutas/.hass/deps/lib/python3.9/site-packages/aio_georss_client/xml_parser/__init__.py", line 102, in parse
    parsed_dict = xmltodict.parse(
  File "/home/knutas/.hass/deps/lib/python3.9/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: out of memory: line 1, column 0
@kennedyshead
Copy link
Author

Ymagis/ClairMeta#212

@kennedyshead
Copy link
Author

Fast fix for now would be running apt-get install libexpat1=2.2.9-1build1 libexpat1-dev=2.2.9-1build1, The bug originates from libexpat

@exxamalte
Copy link
Owner

Thanks for the analysis.
I was just able to reproduce this on Ubuntu 21.10 which has libexpat1 version 2.4.1-2ubuntu0.1 installed.

$ python3 -c 'import xmltodict; print(xmltodict.parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" version=\"2.0\"><channel><item><title>Title 1</title></item></channel></rss>", process_namespaces=True))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/malte/.local/lib/python3.9/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: out of memory: line 1, column 0

And, after adding namespace_separator=" ":

$ python3 -c 'import xmltodict; print(xmltodict.parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" version=\"2.0\"><channel><item><title>Title 1</title></item></channel></rss>", process_namespaces=True, namespace_separator=" "))'
OrderedDict([('rss', OrderedDict([('@version', '2.0'), ('@xmlns', OrderedDict([('geo', 'http://www.w3.org/2003/01/geo/wgs84_pos#')])), ('channel', OrderedDict([('item', OrderedDict([('title', 'Title 1')]))]))]))])

@exxamalte
Copy link
Owner

It seems that a new change in the libexpat library will fix this issue, planned for version 2.4.7: libexpat/libexpat#577

@kennedyshead
Copy link
Author

Closing, seems to be solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants