Closed freakboy3742 closed 3 years ago
@dgelessus Don't know if you have any spare time at the moment, but if you do - any help you can provide here would be most appreciated.
So I haven't actually built and tested it myself yet, because I don't have a simulator or device set up for development right now.
I had a look over the changes between Python 3.9.1 and 3.9.2 - the only commits that stood out to me were python/cpython@60463e8e4f79e5b5e96dc43fb83ded373b489e33 (because it changes something related to garbage collection) and python/cpython@7e729978fa08a360cbf936dc215ba7dd25a06a08 (because it touches memory management code related to libffi). It might be worth a try to revert either of those two commits and see if that prevents the crash. If not, then I don't really have any ideas other than git bisect
ing all changes between 3.9.1 and 3.9.2. (I'm assuming that this is in fact a CPython issue, because it happens only exactly after the update to 3.9.2 and isn't affected by the exact version of rubicon-objc.)
@dgelessus Thanks for that investigation - I guess it's time for me to go spelunking :-)
The problem was related to https://github.com/python/cpython/pull/23868 - but the issue was on our end. We were enabling some preprocessor flags (HAVE_FFI_CLOSURE_ALLOC
and HAVE_FFI_PREP_CIF_VAR
) that weren't required, but with the code change in CPython 3.9.2, enabled some code that caused the crash we were seeing.
Resolved with the publication of 3.9-b3.
Describe the bug
Support package 3.9-b2 segfaults on iOS.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
App starts.
Actual behavior is a segfault when the Toga app is instantiated -
EXC_BAD_ACCESS (code=2, address=0x107004d30)
; top stack frame is:Environment:
Additional context
I've tracked the problem as far as the definition of Rubicon's DeallocationObserver. Basic registration of
NSObject
,NSNumber
etc classes appears to work; however, defining the DeallocationObserver fails. The problem occurs on both Rubicon 0.4.0 and HEAD, so it doesn't appear to be related to the recent changes around memory management.Support package 3.9-b1, as well as a custom build of the 3.9 branch as of b0d860cc, both work without error. The problem appears to have been introduced when the support package was updated to Python 3.9.2.
This was back ported to 3.8.8; however, 3.8-b5 appears to work.