Skip to content
Snippets Groups Projects
Commit 1c98e510 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

handle ENOMEM during mremap()

parent dc400adc
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ You will need to have both snakehouse and satella installed.
## v0.4.4
* more error conditions during mmap will be supported as well
* ENOMEM will be correctly handled during resize operation
## v0.4.3
......
......@@ -25,7 +25,7 @@ if 'CI' in os.environ:
setup(name='tempsdb',
version='0.4.4a2',
version='0.4.4a3',
packages=['tempsdb'],
install_requires=['satella>=2.14.21', 'ujson'],
ext_modules=build([Multibuild('tempsdb', find_pyx('tempsdb')), ],
......
......@@ -217,7 +217,13 @@ cdef class Chunk:
ba = bytearray(self.page_size)
ba[self.page_size-FOOTER_SIZE:self.page_size] = STRUCT_L.pack(self.entries)
self.file.write(ba)
self.mmap.resize(self.file_size)
try:
self.mmap.resize(self.file_size)
except OSError as e:
if e.errno == 12: # ENOMEM
self.switch_to_descriptor_based_access()
else:
raise
finally:
if self.file_lock_object:
self.file_lock_object.release()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment