Skip to content
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

Firebase Performance makes Ktor requests crash #7277

Closed
leinardi opened this issue Jan 8, 2021 · 11 comments
Closed

Firebase Performance makes Ktor requests crash #7277

leinardi opened this issue Jan 8, 2021 · 11 comments
Assignees
Labels
api: performance External Dependency Issues/PRs that are blocked because of an external dependency (non-Firebase)

Comments

@leinardi
Copy link

leinardi commented Jan 8, 2021

[REQUIRED] Step 1: Describe your environment

  • Xcode version: Version 12.2 (12B45b)
  • Firebase SDK version: 7.3.0 & 6.32.2
  • Installation method: Zip file
  • Firebase Component: Performance

[REQUIRED] Step 2: Describe the problem

Using Ktor together with Firebase Performance make the app crash with EXC_BAD_ACCESS.

The only workaround seems to remove Firebase Performance.

Steps to reproduce:

We are able to reproduce the issue using kotlin 1.4.21, ktor 1.5.0' and coroutines 1.4.1-native-mt.

Executing a Ktor request on a project where Firebase Performance is added and will crash the app as soon as the request starts.

The Ktor request can be as simple as this:

suspend fun ktorRequest(): String = httpClient.get<String>("https://en.wikipedia.org/wiki/Main_Page")

This is the stacktrace.txt

Relevant Code:

A sample KMM client crashing with Firebase Performance here (you might need to update the dependencies to the latest version): ktorio/ktor#1040

@maksymmalyhin
Copy link
Contributor

Potentially related #6938.

@maksymmalyhin
Copy link
Contributor

maksymmalyhin commented Jan 8, 2021

@leinardi Thank you for reporting the issue. Could you please attach the crash log to understand if it is the same issue as described at #6938.

@kim-f kim-f self-assigned this Jan 8, 2021
@leinardi
Copy link
Author

leinardi commented Jan 8, 2021

Hi @maksymmalyhin, thank you for the quick answer. What exactly do you mean by "crash log"? I already attached the stacktrace to the OP, isn't that the crash log?

image

@maksymmalyhin
Copy link
Contributor

Ah, sorry, I missed the link.

As far as I understand, the file contains Kotlin stack trace for the crashed thread, is it correct? Would you be able to provide stack traces for other threads? Are native (iOS) thread stack traces also available?

@leinardi
Copy link
Author

leinardi commented Jan 8, 2021

I have to check with my iOS colleague @kchromik on Monday (I am the KMM developer and he's doing the iOS integration).
We will report back on Monday, thanks for looking at the issue 👍

@kchromik
Copy link

The native stack trace doesn't differ from the one provided by @leinardi.

@maksymmalyhin
Copy link
Contributor

@leinardi @kchromik We will try to reproduce the issue on our end to proceed with the investigation.

In the meanwhile you may try to disable Firebase Performance instrumentation by setting Performance .isInstrumentationEnabled property to false as a workaround. With isInstrumentationEnabled = false Performance SDK won't do any runtime modifications such ISA swizzling some objects to get network request stats, etc.

@kchromik
Copy link

Thanks @maksymmalyhin that fixed the issue.

@leinardi
Copy link
Author

Thanks @maksymmalyhin that fixed the issue.

Let's say that worked around the issue 😅

A proper fix is still needed 😉 (please do not close this issue!)

@raymondlam
Copy link
Member

An update, I was able to reproduce the crash using https://github.com/kotlin-hands-on/kmm-networking-and-data-storage as a sample app with the Firebase performance SDK and the current release for Kotlin.

I have confirmed that the crash is fixed once I switched the app to use the Kotlin EAP preview v1.4.30-RC which contains the fix in JetBrains/kotlin-native#4569!

I'll keep this issue open until the next release of Kotlin is publicly available.

@raymondlam raymondlam self-assigned this Jan 26, 2021
@visumickey visumickey added the External Dependency Issues/PRs that are blocked because of an external dependency (non-Firebase) label Jan 26, 2021
@raymondlam
Copy link
Member

Closing this as this has been fixed with Kotlin v1.4.30.
ktorio/ktor#1040 (comment)

@firebase firebase locked and limited conversation to collaborators May 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: performance External Dependency Issues/PRs that are blocked because of an external dependency (non-Firebase)
Projects
None yet
Development

No branches or pull requests

8 participants