Method swizzling breaks Ktor data form request
Closed this issue · 7 comments
Steps to Reproduce the Problem
- Clone https://github.com/tfcporciuncula/ktor-instabug
- Run the Ktor server from the project on the
ktor-sample
folder - Update the IP address here to point to the machine running the Ktor service
- Run the iOS app and tap on the “Trigger data form request” button
- Observe the app crashes with:
REQUEST http://192.168.1.189:8080/upload failed with exception: kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=JobImpl{Cancelled}@954f220
If we disable method swizzling, then nothing breaks when the call is made. There’s nothing special about the project other than being a Kotlin Multiplatform project using Ktor. Any data form call will fail like that — other requests like simple GET or POSTs won’t fail, though. I’m including a Ktor server application just to make it easier to test everything end to end, but any data form request will fail the same way (be it hosted by Ktor or anywhere else).
Expected Behavior
No crash.
Actual Behavior
Crash.
Instabug integration code
It’s all here. The token there is from a dedicated test project with the sole purpose of reproducing this issue, so it’s all good.
// Instabug.disableMethodSwizzling() // Everything works fine when this is uncommented
Instabug.start(withToken: "", invocationEvents: .shake)
Instabug.welcomeMessageMode = .disabled // This doesn’t really affect anything
SDK Version
12.1.0
Device Model & iOS Version
iPhone 11 running iOS 16.2, iPhone 8 running iOS 16.7, iPhone 14 Pro running 17.0.3
Project That Reproduces the Issue
Thanks for the finding @tfcporciuncula . This is currently blocking the update of Ktor from version 2.3.1
(included) on.
@tfcporciuncula @marcorighini We're looking into it and will get back to you as soon as possible.
@EyadHeikal Do you have updates on this?
This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.
I don't think this should be closed as the issue still exists.
This issue has been automatically closed due to inactivity.
Why is this closed @EyadHeikal ?