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

EXC_BAD_ACCESS (code=1, address=0x4) in AuthBackendRPCImplementation.callInternal(with:) #13480

Closed
peterfriese opened this issue Aug 12, 2024 · 13 comments · Fixed by #13521 or #13647
Closed
Assignees
Labels
api: auth beta-software Related to using beta iOS or Xcode versions.
Milestone

Comments

@peterfriese
Copy link
Contributor

peterfriese commented Aug 12, 2024

Description

When refreshing the access token, the app crashes.

CleanShot 2024-08-12 at 11 04 15

Reproducing the issue

This happens shortly after launching the app and the access token is expired.
On Xcode 16.0 beta 4, this doesn't happen.

I also made tried to use the head of the main branch, to make sure I benefit from #13472 - but this didn't seem to have any positive impact.

Firebase SDK Version

11.0.0

Xcode Version

16.0 beta 5

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication

Targeted Platforms

iOS

Relevant Log Output

Using the emulator: NO
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1723453304.319128 7924252 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
{
  "originHash" : "84ac0461b2e8905f4982372323f08159d25b5c55c3a1da0dd0508312d7903013",
  "pins" : [
    {
      "identity" : "abseil-cpp-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/abseil-cpp-binary.git",
      "state" : {
        "revision" : "194a6706acbd25e4ef639bcaddea16e8758a3e27",
        "version" : "1.2024011602.0"
      }
    },
    {
      "identity" : "app-check",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/app-check.git",
      "state" : {
        "revision" : "21fe1af9be463a359aaf8d96789ef73fc3760d09",
        "version" : "11.0.1"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk",
      "state" : {
        "branch" : "main",
        "revision" : "e76d7460aa3d19c5503a072f3117f69e2c443b11"
      }
    },
    {
      "identity" : "fuzi",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/cezheng/Fuzi",
      "state" : {
        "revision" : "f08c8323da21e985f3772610753bcfc652c2103f",
        "version" : "3.1.3"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "ca30c987b732d130732fb60b071e0b655a85ada7",
        "version" : "11.0.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
        "version" : "10.1.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "66dd81c729364b0425d0c2b73e38a489f32b1717",
        "version" : "8.0.1"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "f56d8fc3162de9a498377c7b6cea43431f4f5083",
        "version" : "1.65.1"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
        "version" : "3.5.0"
      }
    },
    {
      "identity" : "interop-ios-for-google-sdks",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/interop-ios-for-google-sdks.git",
      "state" : {
        "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
        "version" : "100.0.0"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
        "version" : "1.22.5"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
        "version" : "2.30910.0"
      }
    },
    {
      "identity" : "networkimage",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/gonzalezreal/NetworkImage",
      "state" : {
        "revision" : "7aff8d1b31148d32c5933d75557d42f6323ee3d1",
        "version" : "6.0.0"
      }
    },
    {
      "identity" : "nuke",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kean/Nuke",
      "state" : {
        "revision" : "0ead44350d2737db384908569c012fe67c421e4d",
        "version" : "12.8.0"
      }
    },
    {
      "identity" : "opengraphreader",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/pzmudzinski/OpenGraphReader",
      "state" : {
        "revision" : "790470f4c1d89d7765123be6c0d78bd4d64ea1ea",
        "version" : "1.0.1"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
        "version" : "2.4.0"
      }
    },
    {
      "identity" : "swift-markdown-ui",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/gonzalezreal/swift-markdown-ui",
      "state" : {
        "revision" : "9a8119b37e09a770367eeb26e05267c75d854053",
        "version" : "2.3.1"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "e17d61f26df0f0e06f58f6977ba05a097a720106",
        "version" : "1.27.1"
      }
    },
    {
      "identity" : "swiftsoup",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/scinfu/SwiftSoup.git",
      "state" : {
        "revision" : "e2d11208519549c2e5798d70190472045633f22f",
        "version" : "2.7.3"
      }
    }
  ],
  "version" : 3
}

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@ncooke3
Copy link
Member

ncooke3 commented Aug 12, 2024

I have been unable to reproduce it, but I am finding recent concurrency related crashes with the same EXC_BAD_ACCESS (code=1, address=0x4) message.

It may be a Xcode 16b5 regression:

@peterfriese
Copy link
Contributor Author

Sounds reasonable.

Should we keep an eye on it and review once Xcode 16b6 rolls out?

@paulb777 paulb777 added the beta-software Related to using beta iOS or Xcode versions. label Aug 12, 2024
@ncooke3
Copy link
Member

ncooke3 commented Aug 12, 2024

@peterfriese, I think so. I'm not sure why I couldn't reproduce it though. I was using Xcode 16b5 on a physical device running iOS 17.X (I also tried the simulator). If you're able to reliably reproduce it, could you please check the other threads to see if that same class is being called elsewhere? If it's not a Xcode bug, then it may be a concurrency bug within the SDK.

@paulb777
Copy link
Member

I'm reproing this with Xcode 16.1b1 with this backtrace when relogging in via GoogleSignIn:

Screenshot 2024-08-16 at 9 09 13 AM

@paulb777 paulb777 added this to the 11.2.0 - M153 milestone Aug 16, 2024
@paulb777
Copy link
Member

paulb777 commented Aug 16, 2024

I have a prototype fix working - converting some internal methods to async and doing fetchAccessToken on the main actor. Still several cascading code and unit test changes to work through. ca78a65

@nataliakozlovska
Copy link

Hey! The same issue, using Xcode 16.0 beta 6 and Firebase 11.1.0. Should it be fixed in this version?

@paulb777

@ondrejkorol
Copy link

Just got the same crash reported in prod, seems it's after I've updated Firebase to v11.2 ad GoogleSignIn 8.0.0.
(I'm using Xcode 15.4)

Crashed: com.apple.root.user-initiated-qos.cooperative
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000003
AuthBackend.swift - Line 143
specialized AuthBackendRPCImplementation.callInternal(with:) + 143

@ncooke3
Copy link
Member

ncooke3 commented Sep 15, 2024

Hi @nataliakozlovska, no, the fix was released in Firebase 11.2.0.


Thanks for reporting, @ondrejkorol. Are you able to provide a full stack trace?

@ondrejkorol
Copy link

Hi @ncooke3 , thanks for your quick response! I'll be happy to help, Crashlytics reports this:

Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x40437c swift_unknownObjectRetain + 8
1  Mind                           0x3297bc specialized AuthBackendRPCImplementation.callInternal<A>(with:) + 143 (AuthBackend.swift:143)
2  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
3  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
4  libdispatch.dylib              0x15894 _dispatch_root_queue_drain + 392
5  libdispatch.dylib              0x1609c _dispatch_worker_thread2 + 156
6  libsystem_pthread.dylib        0x48f8 _pthread_wqthread + 228
7  libsystem_pthread.dylib        0x10cc start_wqthread + 8

Full stack trace:
app_issue_466ae93783cfc5e3010951fc92f6e334_crash_session_c89332271f904df98a543d8daf437162_DNE_0_v2_stacktrace.txt

Data:
Device
Model:iPhone 13
Orientation:Face Up
RAM free: 64.59 MB
Operating System
Version:17.6.1
Orientation:Unknown
Jailbroken: No
Crash
Date:Sep 15, 2024, 3:29:34 AM

@ncooke3
Copy link
Member

ncooke3 commented Sep 16, 2024

Thanks @ondrejkorol! I was not able to reproduce via Xcode 15.2 (simulator/device) and Xcode 16.0 RC (simulator). I will look into if Xcode 15.4 makes a difference.

From the stack trace, this looks like a slightly different issue from the original issue in this thread, especially as you are using 11.2. Could you please open a new issue using some of the info you have already provided here? Could you also please include whether you can repro this locally? https://github.com/firebase/firebase-ios-sdk/issues/new?assignees=&labels=&projects=&template=BUG_REPORT.yml

@ondrejkorol
Copy link

Thank you so much! I haven't encountered this issue locally. Just got 2 reports via Crashlytics from our users.
Do you think using Xcode 16.0 RC to publish and release the app could mitigate the issue?

I will open the new issue with the current stack trace.

@ncooke3
Copy link
Member

ncooke3 commented Sep 16, 2024

If possible, could you also share the second crash report in that new issue? I'm wondering if the threading layout matches the first report.

Do you think using Xcode 16.0 RC to publish and release the app could mitigate the issue?

Possibly, but I'm not sure so I can't give a strong recommendation. Did you previously release your app with Firebase 11.1.0? If so and it was successful, downgrading could be an option. This could also indicate that the Xcode 16 fix in 11.2 may have introduced a behavior change for apps built with Xcode 15.

@ondrejkorol
Copy link

I appreciate your help! Thanks.
I've been using v+10 of Firebase. I did upgrade Firebase directly to 11.2 few days ago. And the new app versions are reporting this crash.

Here's the second stack trace I got today:
second.crash_issue_466ae93783cfc5e3010951fc92f6e334_crash_session_449ef354ab5e4450b4e53a2fde399be3_DNE_0_v2_stacktrace.txt
Device
Model:iPhone 11
Orientation:Landscape
RAM free: 112.97 MB
Operating System
Version:17.6.1
Orientation:Unknown
Jailbroken: No
Crash
Date:Sep 16, 2024, 2:17:35 AM
App version:1.0.10 (7)

@firebase firebase locked and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: auth beta-software Related to using beta iOS or Xcode versions.
Projects
None yet
6 participants