-
Notifications
You must be signed in to change notification settings - Fork 228
Closed
Description
I've been tracking down an issue I've encountered on 512 MB VPSes (virtual private servers), and it's appears to be coming from msgpack
:
File "/scraper/client.py", line 336, in partial_capture
self.put_message_chunked(response, connector)
File "/scraper/client.py", line 443, in put_message_chunked
message_bytes = msgpack.packb(message, use_bin_type=True)
File "/scraper/venv/lib/python3.4/site-packages/msgpack/__init__.py", line 47, in packb
return Packer(**kwargs).pack(o)
SystemError: error return without exception set
This can be replicated pretty easily. In a VM with 512 MB RAM and no swap:
durr@memtest:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import msgpack
>>> data = os.urandom(1024 * 1024 * 175)
>>> message_bytes = msgpack.packb(data, use_bin_type=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/msgpack/__init__.py", line 47, in packb
return Packer(**kwargs).pack(o)
SystemError: <built-in method pack of msgpack._packer.Packer object at 0x7f11af1e27b8> returned NULL without setting an error
I think the minor traceback differences are due to python differences - 3.4 for the original traceback, 3.5 for the example.
In any event, ideally the packer should raise something like a custom sub-class of MemoryError
rather then an apparently broken SystemError, but at least documenting that packing a message can result in a failure might be nice too.
Interestingly enough, the fallback version seems to use much less memory, and produce the expected MemoryError
on failure.
Metadata
Metadata
Assignees
Labels
No labels