-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests sometimes fail with PyPy3 #140
Comments
interesting. this certainly looks like a threading issue and a race condition. the second error is also in the threading test i assume? |
I have really no idea what triggers the second error. I edited my first message to show that it happens after all tests have run. Strangely enough, it doesn't change pytest's exit code. Maybe it is a garbage collection issue? |
seems the latest cython release has some pypy3 incompatibilities, but i could build with a slightly older cython version. running
|
ah, and with a few more retries i could reproduce the other crash as well. note that pypy compatibility for python c extensions and cython is not ideal in general: https://cython.readthedocs.io/en/latest/src/userguide/pypy.html |
When running the tests on Pypy, sometimes this error occurs: Exception ignored in: weakref callback: <cyfunction __init__.<locals>.<lambda> at 0x227aec0> Traceback (most recent call last): File "plyvel/_plyvel.pyx", line 695, in plyvel._plyvel.BaseIterator.__init__.lambda lambda wr: ref_dict.pop(iterator_id)) KeyError: 140185035039968 This issue manifests only sporadically, and may be related to cleanup order (garbage collection etc.) being different on CPython and Pypy. LevelDB requires that iterators are closed before a database is closed, so plyvel tracks ‘active iterators’ using weak references (‘ref_dict’ in the traceback above). Active iterators are cleaned up when a database is closed. Apparently the weakref callback sometimes triggers after the weakref has already been removed from the collection, and this raises the KeyError. Ignoring this should be fine since it means the iterator is closed already. Simplify a bit by using a set instead of a dict to track the weakrefs, and use set.discard() in the callback, which is a no-op (no exception) for missing items. See #140.
i think i have a fix that should address the weakref callback error, and maybe the other issue as well. see #141 for details. |
Yes, I also ran into that so I rebuilt the extension with If you release a new version with the fix, can you please make sure the generated extension is compatible with
I have run tests more than 100 times in a row and haven't any of the previous errors so I'd say this fix works :) |
i see cython has some recent pypy related activity: https://github.com/cython/cython/pulls?q=sort%3Aupdated-desc+pypy and good question about the ‘other’ error. i really don't know :( but my results are consistent with yours. i can't reproduce, and i tried many times |
not sure i understand what you mean here? |
The PyPI tarball for the latest version contains |
Hi,
It looks like tests sometimes fail when running PyPy3 (pypy-7.3.7-final):
Other times, I get this non-fatal error:
Reproducer Dockerfile:
Please note that this does not always fail, sometimes all tests pass. I believe the first error message has to do with threading since it happens immediately afterwards.
The text was updated successfully, but these errors were encountered: