Disable pikepdf mmap

Infrequently we can reproduce this error:

terminating with uncaught exception of type std::runtime_error: pybind11_object_dealloc(): Tried to deallocate unregistered instance!

The error is probably related to pybind11 issue #2252 and a bunch of
other related issues. Until that is resolved in pybind11 and pikepdf
we will disable the pikepdf mmap interface.
This commit is contained in:
James R. Barlow 2020-09-16 23:48:55 -07:00
parent 6b994221c6
commit b93cf51c0f
No known key found for this signature in database
GPG Key ID: E54A300D567E1260

View File

@ -213,11 +213,15 @@ def clamp(n: T, smallest: T, largest: T) -> T:
def pikepdf_enable_mmap():
try:
if pikepdf._qpdf.set_access_default_mmap(True):
log.debug("pikepdf mmap enabled")
except AttributeError:
log.debug("pikepdf mmap not available")
# try:
# if pikepdf._qpdf.set_access_default_mmap(True):
# log.debug("pikepdf mmap enabled")
# except AttributeError:
# log.debug("pikepdf mmap not available")
# We found a race condition probably related to pybind issue #2252 that can
# cause a crash. For now, disable pikepdf mmap to be on the safe side.
log.debug("pikepdf mmap disabled")
return
def deprecated(func):