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

Custom instance name appears to cause issues reconciling past events, causing memory leak and crashes #128

Open
davidjhodge opened this issue Feb 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@davidjhodge
Copy link

Expected Behavior

The SDK should be able to manage sending events and flushing the data store properly when using a custom instance name (as recommended here: https://www.docs.developers.amplitude.com/data/sdks/ios-swift/#security).

Current Behavior

When initializing the Amplitude iOS SDK with a custom instance name, the SDK uploads thousands of past events on every app launch, even if no actions are taken in the app and reset() has already been called.

Possible Solution

Removing my custom instance name and using the default configuration seems to have resolved the issue.

Steps to Reproduce

  1. Initialize the SDK with a custom instance name and DEBUG level logging.
  2. Track any number of events.
  3. Restart the app and monitor for old events being uploaded. After 30 seconds, the debugger may warn you that Background Task (123) ("amplitude"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination.
  4. If you've logged enough events and you wait long enough, the app actually will terminate.

Related Amplitude Support Ticket: https://help.amplitude.com/hc/en-us/requests/306102

error-examples-additional-logging.txt
error-logs-example.txt

Environment

  • SDK Version: 1.1.0
  • Device: iPhone X, 2021 MacBook Pro 16-inch M1
  • OS Version: iOS 16.7.5, Mac OS 14.0
Screenshot 2024-02-24 at 5 02 14 PM
@davidjhodge davidjhodge added the bug Something isn't working label Feb 25, 2024
@izaaz
Copy link
Collaborator

izaaz commented Feb 27, 2024

@davidjhodge thank you for raising this bug. We are taking a look at this and will update this issue.

@izaaz
Copy link
Collaborator

izaaz commented Feb 27, 2024

@davidjhodge - I am trying to repro this issue but I am unable to do this in our test app.

Can you share your init configuration? And do you call flush after every event is tracked?

@izaaz
Copy link
Collaborator

izaaz commented Feb 28, 2024

@davidjhodge - when you were testing this, were you seeing a lot of requests failing with a 400 response code? There's an issue where the SDK keeps retrying when the server returns a 400 because of bad user id/device ids.

@izaaz izaaz transferred this issue from amplitude/Amplitude-iOS Feb 28, 2024
@izaaz
Copy link
Collaborator

izaaz commented Feb 28, 2024

Might be similar to #126

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

No branches or pull requests

2 participants