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

App hangs when introspect framework linked to #400

Closed
2 tasks done
wtmoose opened this issue Feb 19, 2024 · 7 comments · Fixed by #401
Closed
2 tasks done

App hangs when introspect framework linked to #400

wtmoose opened this issue Feb 19, 2024 · 7 comments · Fixed by #401
Labels
bug Something isn't working

Comments

@wtmoose
Copy link

wtmoose commented Feb 19, 2024

Description

The mere linking to the Introspect framework, without even importing the framework, causes an app to hang under certain conditions. In particular, when pushing a view onto a navigation stack when other specific conditions exist (see attached minimal sample app).

Checklist

Expected behavior

App pushes a view onto the navigation stack

Actual behavior

App hangs with 100% CPU

Steps to reproduce

  1. Run the attached minimal sample app
  2. Tap the button labelled "Tap"

PushHang2.zip

Version information

1.1.2

Destination operating system

iOS 17.2

Xcode version information

Xcode 15.2 (15C500b)

Swift Compiler version information

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
@wtmoose wtmoose added the bug Something isn't working label Feb 19, 2024
@wtmoose
Copy link
Author

wtmoose commented Feb 19, 2024

Forgot to mention that removing the Introspect package from the sample project, without making any code changes, resolves the hang.

@davdroman
Copy link
Collaborator

davdroman commented Feb 25, 2024

I narrowed down the hang to SignInWithAppleButton.swift. These public static let declarations are causing the hang:

extension iOSViewVersion<SignInWithAppleButtonType, ASAuthorizationAppleIDButton> {
    @available(*, unavailable, message: "SignInWithAppleButton isn't available on iOS 13")
    public static let v13 = Self.unavailable()
    public static let v14 = Self(for: .v14)
    public static let v15 = Self(for: .v15)
    public static let v16 = Self(for: .v16)
    public static let v17 = Self(for: .v17)
}

I don't know why, and since it used to work in older Swift/Xcode/iOS versions this is a regression in either or several of those. Very annoying. I'll try to work out a fix and if I can't I'll sadly have to remove that implementation.

@wtmoose
Copy link
Author

wtmoose commented Feb 25, 2024

Thanks for investigating. That’s so weird. Just so you know, we had to replace Introspect with our own workaround to get unblocked. We’d like to bring it back in. But if you’re thinking of waiting to see if it resolves itself in a future version of Xcode, it won’t be a problem for us.

@davdroman
Copy link
Collaborator

davdroman commented Feb 25, 2024

@wtmoose understandable. Just so you know 1.1.3 is out with the fix. Didn't make sense to sacrifice the entire library because of one minor introspection type wrecking havoc on iOS 17 alone.

@wtmoose
Copy link
Author

wtmoose commented Feb 25, 2024

Great! Appreciate your help

@philprime
Copy link

philprime commented Feb 26, 2024

@davdroman you could create a branch, i.e. 'introspect-sign-in-with-apple-button' where you revert commit 0cd2a5a the removal of the introspection.

It could then be rebased on the latest version (maybe even automatically using GitHub Actions) so that if someone is actually using that functionality, they can just go for the branch instead.

@davdroman
Copy link
Collaborator

davdroman commented Feb 26, 2024

@philprime the thing is that the mere act of declaring that implementation makes the app hang when linking the library. So this is way too dangerous to offer, even in a side branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants