-
Notifications
You must be signed in to change notification settings - Fork 255
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
PyPy is segfaulting in CI - how can I help? #632
Comments
Hi @mattip, nice to see you here ! I guess you're referring to conda-forge/pyjnius-feedstock#35 As you noticed, some fixes were introduced in #627, and everything seemed great. (All the tests passed on the PR, and the same happened for the following CI runs) Unfortunately (as for https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=530828&view=logs&j=bb1c2637-64c6-57bd-9ea6-93823b2df951&t=350df31b-3291-5209-0bb7-031395f0baa1) seems that we now have a new segfault (seems that happens in a different test phase from the previous one). To speed-up the process, I'm available to chat on #dev channel @ Our Discord Chat, and I'm sure that other Core Devs (and contributors) are also happy to help. If I'm right, there's a chance that I was able to reproduce a segfault on the same test with a specific setup on macOS 12 + Apple Silicon in a Rosetta Terminal (that then disappeared) 🧐 . |
I was refering to the the segfault in this repo's CI here where both PyPy CI runs segfault, the message does not help me understand what is going on:
|
NB: As jnius loads the JVM, its usually the case that Java's signal fault handler takes priority and generates a hs_err_pid log file which can contain a more meaningful stacktrace, even for native/Cython. |
Meanwhile, I was trying to reproduce the segfault on the above-mentioned config.
Local test configuration:
Manually running the failing test (
|
tests/test_lambdas.py came from me. Can you narrow down to a particular test method? |
Looks that is failing here: Line 10 in 0421f01
|
So the java thread pool are calling back into a python class which implements Callable which calls the Python lambda. One big(!) hack that is there is to ensure that the /Callable/ object, rather than the lambda itself (IIRC) is not GCd. pyjnius/jnius/jnius_conversion.pxi Line 122 in bcf4e28
If it has been GCd by Python, segfaults can occur. Could it have been GCd by Pypy? |
Is there use of forking plus threads? We have seen some hairy bugs with this, the state is shared in strange and wondrous ways. |
Typically, the PyPy GC is less aggressive than the CPython one: objects tend to stay around a little longer. I wonder if changing the order to set up the thread pool before creating the function will change anything: - callFn = lambda: "done"
executor = autoclass("java.util.concurrent.Executors").newFixedThreadPool(1)
+ callFn = lambda: "done"
future = executor.submit(callFn) |
Hi. PyPy dev here, new to the project but curious about the segfault in CI. What would be the best way to get to the root cause? Pair programming? Read some documentation and get a dev environment set up? What would be the easiest way to get a minimal cython reproducer without Java?
The text was updated successfully, but these errors were encountered: