On 2023/01/28 22:53, Theo Buehler wrote:
> On Sat, Jan 28, 2023 at 08:48:52PM +0000, Stuart Henderson wrote:
> > Python bindings for LMDB. OK to import?
> > 
> 
> Something's wrong. When trying to run tests, I got
> 
> E   ModuleNotFoundError: No module named 'cffi'

This is our old friend, pytest not finding the cpython extension,
with a twist where it falls back to calling lmdb via cffi.

This fixes it:

MODPY_TEST_DIR= ${WRKSRC}/build
MODPY_PYTEST_ARGS= ..

> So I added py3-cffi and then got this:
> 
> tests/env_test.py .........................F...Fatal Python error: 
> Segmentation fault
> 
> Looks like a NULL deref:
> 
>  46718 python3.10 CALL  thrkill(0,SIGSEGV,0)
>  46718 python3.10 PSIG  SIGSEGV SIG_DFL addr=0x0 trapno=0
>  46718 python3.10 NAMI  "python3.10.core"
> 
> I couldn't immediately spot what's wrong in the python code. Happens on
> both amd64 and arm64.

The test tries to close twice and then access after closing, to
intentionally produce a failure. It only crashes the Python process when
loading lmdb via cffi, with the cpython extension it works as expected,
so with the above MODPY_* changes it passes.

Not sure if that's OpenBSD-specific, or always happens with cffi, or
maybe a consequence of the writemap hack, either way I don't think it
causes problems for normal use.

The remaining failures are I think expected given the MDB_WRITEMAP hack
in lmdb. One is checking that writemap gets set as expected, so the
failure reason is obvious. The other relates to transactions, which have
some restrictions when writemap is used.

Reply via email to