Skip to content

[iOS] Network Timeout during fetch(user: nil) results in fallback despite "[Experiment] Retry success" log #83

@BigVeila

Description

@BigVeila

I am using Amplitude Experiment integrated with Amplitude Analytics via the ConnectorUserProvider mechanism

I encountered a scenario where the initial network request times out (Error -1001). The SDK logs indicate that a retry was attempted and succeeded ([Experiment] Retry success). However, the value received in the completion handler seems to remain the fallback value (Variant A), or the behavior is inconsistent regarding when the completion handler is actually called in this retry flow.
This raises a risk where the app might be stuck in a Fallback state despite a successful retry, or the logs are misleading regarding the actual variant applied.
Observe the logs.

Task <075AD00F-06B0-4C2B-B78B-FEC372C81232>.<8> 
finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x300d1fbd0 
{Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" 
UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, 
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <075AD00F-06B0-4C2B-B78B-FEC372C81232>.<8>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <075AD00F-06B0-4C2B-B78B-FEC372C81232>.<8>"
), NSLocalizedDescription=The request timed out.,
 NSErrorFailingURLStringKey=https://api.lab.amplitude.com/sdk/v2/vardata?v=0, 
NSErrorFailingURLKey=https://api.lab.amplitude.com/sdk/v2/vardata?v=0, _kCFStreamErrorDomainKey=4}
Optional("a") - Optional("a")  -- these are my test key and value
[Experiment] Retry success

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions