Describe the bug
Summary
We have a repro repo for an iOS GraphQL subscription reconnection issue after app lifecycle transitions.
With the current feature/multi-subscription-repro branch, we are now able to reproduce a stronger failure mode that is closer to our production app:
- one or more subscriptions enter
connecting
- we have not observed them recover without fully terminating the app
- the app does not recover by foregrounding again or by normal in-app actions
This stuck state is not reproducing on the simpler main branch of the repro repo. It is currently reproducing only on the multi-subscription variant.
We also observe a difference between build configurations:
- the issue is harder to reproduce in
Debug
- the issue reproduces more easily in
Release
Repro repository
- Repo:
https://github.com/akiramur/amplify-swift-ios-repros
- Branch:
feature/multi-subscription-repro
- Commit:
6daca6d404771ab3cdac435976eacf0577958b40
Repro shape
This repro app uses:
- Cognito auth with Hosted UI sign-in
- AppSync GraphQL API
- one GraphQL model
- three concurrent
onCreate subscription workers
- background/foreground restart logic across all workers
- in-app logging for worker connection state and lifecycle transitions
Environment
- Amplify Swift:
2.58.1
- Xcode:
26.3
- iOS:
26.4.2
- Device:
iPhone 12
- Repro backend:
Amplify Gen 2 sandbox
Actual behavior
After repeating lock/unlock and app switching several times, one or more subscription workers eventually enter connecting and remain stuck there.
Once this happens:
- one or more stuck subscription workers do not return to
connected
- normal app usage does not recover them
- repeated foreground/background transitions do not recover them
- the app remains in a degraded state until it is fully terminated and relaunched
In other words, after the stuck state is reached, a full app restart is the only reliable recovery we have observed.
Important observation
This behavior is currently reproducing only on the feature/multi-subscription-repro branch, which runs multiple concurrent subscription workers.
We are not reproducing the same stuck connecting state on the simpler main branch of the repro repo.
This multi-subscription branch appears closer to our production shape, where multiple subscriptions and lifecycle-driven restarts are active concurrently.
This suggests the issue may be related to one or more of:
- multiple concurrent subscriptions
- lifecycle-driven restart timing across multiple workers
- reconnection races that do not appear with a single subscription
Steps To Reproduce
Steps to reproduce the behavior:
1. Start the backend sandbox and generate `amplify_outputs.json`.
2. Generate the Xcode project and run the app from the `feature/multi-subscription-repro` branch.
3. Sign in with Hosted UI.
4. Confirm all subscription workers reach `connected`.
5. Lock the device screen and leave the app idle for around 2 to 3 minutes.
6. Unlock the device.
7. Repeatedly switch between this app and other apps so the repro app cycles through background and foreground several times after unlocking.
8. Observe the aggregate connection badge, worker cards, and event log.
Expected behavior
Expected behavior
After app lock/unlock and repeated background/foreground transitions, all subscription workers should eventually reconnect and return to connected without requiring a full app restart.
Amplify Framework Version
2.58.1
Amplify Categories
API
Dependency manager
Swift PM
Swift version
5.9
CLI version
13.0.0
Xcode version
26.3 (17C529)
Relevant log output
<details>
<summary>Log Messages</summary>
INSERT LOG MESSAGES HERE
</details>
Is this a regression?
No
Regression additional context
No response
Platforms
No response
OS Version
26.4.2
Device
iPhone 12
Specific to simulators
No response
Additional context
No response
Describe the bug
Summary
We have a repro repo for an iOS GraphQL subscription reconnection issue after app lifecycle transitions.
With the current
feature/multi-subscription-reprobranch, we are now able to reproduce a stronger failure mode that is closer to our production app:connectingThis stuck state is not reproducing on the simpler
mainbranch of the repro repo. It is currently reproducing only on the multi-subscription variant.We also observe a difference between build configurations:
DebugReleaseRepro repository
https://github.com/akiramur/amplify-swift-ios-reprosfeature/multi-subscription-repro6daca6d404771ab3cdac435976eacf0577958b40Repro shape
This repro app uses:
onCreatesubscription workersEnvironment
2.58.126.326.4.2iPhone 12Amplify Gen 2 sandboxActual behavior
After repeating lock/unlock and app switching several times, one or more subscription workers eventually enter
connectingand remain stuck there.Once this happens:
connectedIn other words, after the stuck state is reached, a full app restart is the only reliable recovery we have observed.
Important observation
This behavior is currently reproducing only on the
feature/multi-subscription-reprobranch, which runs multiple concurrent subscription workers.We are not reproducing the same stuck
connectingstate on the simplermainbranch of the repro repo.This multi-subscription branch appears closer to our production shape, where multiple subscriptions and lifecycle-driven restarts are active concurrently.
This suggests the issue may be related to one or more of:
Steps To Reproduce
Expected behavior
Expected behavior
After app lock/unlock and repeated background/foreground transitions, all subscription workers should eventually reconnect and return to
connectedwithout requiring a full app restart.Amplify Framework Version
2.58.1
Amplify Categories
API
Dependency manager
Swift PM
Swift version
5.9
CLI version
13.0.0
Xcode version
26.3 (17C529)
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
No response
OS Version
26.4.2
Device
iPhone 12
Specific to simulators
No response
Additional context
No response