diff --git a/README.md b/README.md index 48789b76b7069fd008cca54857762d74327212e5..01825e025d368f9958d7bcd5e97657eec716aac5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/setup.py b/setup.py index 848e2c20cf9b111bd1b0db2ba73a349eaf4d190d..679b03fcb6282ce43180a4c51e2ebe533e9a2b6b 100644 --- a/setup.py +++ b/setup.py @@ -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')), ], diff --git a/tempsdb/chunks.pyx b/tempsdb/chunks.pyx index f3e7db68dc8fac79a7b13511b4a9484b100ce4da..d03d898dcad34a94b59bbc54d5a16b038d39033f 100644 --- a/tempsdb/chunks.pyx +++ b/tempsdb/chunks.pyx @@ -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()