pendo-mobile-sdk
pendo-mobile-sdk copied to clipboard
Pendo iOS SDK API timeouts cause unbounded memory growth
Platform + Version iOS 17
SDK Version 3.3.1
Framework Native iOS, mostly UIKit with some SwiftUI
Describe the bug We observed a scenario that results in unbounded memory growth from the Pendo SDK when Pendo API calls timeout.
This problem initially manifest to us through reports of app terminations due to high memory usage. Here's a plot showing memory usage by the app over the course of an hour with and without Pendo's API calls timing out.
When the API calls timed out 100% of the time, we would see the app's memory growth climb from our typical 100 MB to 1.6 GB and then be terminated by the OS.
Our app is primarily used in restricted network environments. Although we are aware of the guidance on which hostnames should be allowed, one of our customers did not have Pendo hosts allowed, resulting in all API calls to Pendo being routed to the customer's internal network rather than to your API. These calls would eventually fail with timeouts.
In my testing, after launching the app with Pendo's API blocked by a proxy, starting a session, and triggering a few events, I observe Pendo getting stuck in an infinite attempt to get an access token. pendo-logs.txt has a snapshot of the logs that we see repeating every approx 30 seconds once this loop begins.
Our customers use the app continuously for 1-2 hours at a time, and during that time a significant number of screen change events are generated. My light investigation suggests that over time as more and more events are generated, each one in starting up more and more attempts to get an access token, and each attempt continues looping. Over time this eventually results in the memory growth shown in the graph above.
For our customers
To Reproduce Steps to reproduce the behavior:
- Configure a network proxy (I used Proxyman) to treat all calls to
data.pendo.io
with 100% packet loss. - Enable
PendoManager.shared.setDebugMode(true)
- Setup Pendo with an appKey
- Call
pendoManager.startSession(...)
with a user's details - Run the app triggering
screenContentChanged()
as screens change. - Stop interacting with the app and watch Pendo logs continue to repeat in the console.
Expected behavior We expect the SDK to be more resilient to failing network conditions and gracefully handle 100% packet loss without resulting in unbounded memory growth.
Logs pendo-logs.txt
Sample Code n/a