Closed Johennes closed 6 hours ago
I'm seeing similar behavior with a recent version of this library, a bad access crash in initTimeline with debug builds.
@Johennes are you seeing this on simulator, or only with real devices? I've struggled to make this reproduce on iOS simulator.
Oh, interesting. I have not tried it on a device yet but I can consistently reproduce the crash on a simulator. I'm on an Apple Silicon Mac in case that makes any difference.
Sorry, I've been chasing two crash bugs, let me try to make this one reproduce on simulator and I will update what I find.
Edit: yeah, I seemingly can only make this happen on a real device (not on the simulator).
Ok, I see. I originally reproduced the crash in https://github.com/unomed-dev/react-native-matrix-sdk and thought that it might be due to React Native or the glue code I had added to connect the bindings. But then it still showed when using the bindings in a minimal non-RN example. It's wild that it crashes on different platforms for the two of us. 🤔
Interesting, we are also working to bring the matrix-rust-sdk to react-native, though we took the approach of sponsoring a uniffi library that is capable of generating react-native bindings directly. We plan to release the OSS tool very soon, just wrapping up the documentation and working out some final bugs.
Thank you for identifying that this bug was happening in the vanilla library, I was going slowly mad trying to figure out what about our environment was triggering it.
Interesting, we are also working to bring the matrix-rust-sdk to react-native, though we took the approach of sponsoring a uniffi library that is capable of generating react-native bindings directly. We plan to release the OSS tool very soon, just wrapping up the documentation and working out some final bugs.
Oh, amazing! Is there a place I could sign up to be notified about the release? Wrapping the FFI bindings manually has worked relatively well so far but generating the entire RN module would be a lot better. If this works, I won't have to continue on my current track anymore.
I was going slowly mad trying to figure out what about our environment was triggering it.
Me too. 😅
Interestingly it only crashes when I build the bindings in debug mode but not when using --release
We've first saw these crashes within the crypto crate and on the timeline years ago. The solution was to use a custom build profile. It's probably a bit slower to compile but Element X is using it and we haven't had any problems since.
Wow! 😮
Would it make sense to make reldbg
the default profile in https://github.com/matrix-org/matrix-rust-sdk/blob/main/xtask/src/swift.rs? It currently seems to default to dev
but I suppose there's not a lot you can do with the bindings if they crash on initTimeline
.
Would it make sense to make reldbg the default profile
I think it would, yes! Can you please see if it fixes the problem on your side and then perhaps raise a PR for it?
Can you please see if it fixes the problem on your side and then perhaps raise a PR for it?
Looks like using reldbg
fixes the crashes I'm seeing. 🎉
Have opened https://github.com/matrix-org/matrix-rust-sdk/pull/4020.
Nice, it's merged now so let's close this ticket.
I'm hitting a weird
EXC_BAD_ACCESS
with the FFI bindings on iOS. I'm using the following example code:I thought it's a race condition initially which is why I added some
sleep
statements but that didn't help. The app crashes when callingpollFunc
insideinitTimeline
.Interestingly it only crashes when I build the bindings in debug mode but not when using
--release
. I'm using the following command to build the SDK: