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

Infinity loop crash when sending a tracking event property with a single-value array, e.g., ["test": [[1]]] #239

Closed
datoutwo opened this issue Nov 11, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@datoutwo
Copy link

datoutwo commented Nov 11, 2024

Expected Behavior

  • Should not crash when event property's value is one single-value in the array.

Current Behavior

  • App crash in the infinity loop of extension.
extension UnkeyedDecodingContainer {
    mutating func decode(_ type: [Any].Type) throws -> [Any] {

Possible Solution

  • Flat data if it just one value

Steps to Reproduce

  1. Change track event to Amplitude.testInstance.track(eventType: eventType, eventProperties: ["test": [[1]]])
  2. Send the event.
image

Reproducible example project

  1. Open AmplitudeSwiftUIExample.xcodeproj in the attach file.
  2. Run in xcode.
  3. Click button in the GENERAL EVENT.
  4. Few seconds app crash in the UnkeyedDecodingContainer decode function.

Amplitude-Swift.zip

Environment

  • SDK Version: v1.10.1
  • OS Info: Xcode 15.4
  • iOS Version: iPhone 15 pro 17.4 (every version should crash)
@datoutwo datoutwo added the bug Something isn't working label Nov 11, 2024
@crleona
Copy link
Collaborator

crleona commented Nov 11, 2024

Hi @datoutwo, the example you've provided does not reproduce for me after checking with multiple iOS versions and multiple versions of Xcode. Are you able to provide a more specific reproduction case?

@datoutwo datoutwo changed the title Infinity loop crash when sending a tracking event property with a single-value array, e.g., ["test": [1]] Infinity loop crash when sending a tracking event property with a single-value array, e.g., ["test": [[1]]] Nov 11, 2024
@datoutwo
Copy link
Author

datoutwo commented Nov 11, 2024

Hi @crleona, sorry the data should be

Amplitude.testInstance.track(eventType: eventType, eventProperties: ["test": [[1]]])  

Please check the video below and this infinity loop takes few seconds to cause the crash.
Also, please let me know if there's anything I can help to provide more data to reproduce it.

work.2024-11-11.at.22.29.19.mov

@crleona
Copy link
Collaborator

crleona commented Nov 12, 2024

Hi @datoutwo, thank you for the report and the PR. I've added another fix that also adds some tests in #242. Could you please confirm that this also fixes the issue on your end?

@datoutwo
Copy link
Author

Hi @crleona just check the pr it works like a charm from my side. Thanks for the speedy reply and fix.

@crleona
Copy link
Collaborator

crleona commented Nov 13, 2024

The fix is released in 1.10.2.

@crleona crleona closed this as completed Nov 13, 2024
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