diff --git a/.github/workflows/slack-notify.yml b/.github/workflows/slack-notify.yml index c86e9b81..0b4ae379 100644 --- a/.github/workflows/slack-notify.yml +++ b/.github/workflows/slack-notify.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Send message to Slack channel id: slack - uses: slackapi/slack-github-action@v1.26.0 + uses: slackapi/slack-github-action@v1.27.0 env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} PROJECT_NAME: 'iOS SDK' diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aaf966f..705db858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.30.0](https://github.com/rudderlabs/rudder-sdk-ios/compare/v1.29.1...v1.30.0) (2024-11-11) + + +### Features + +* upgrade the maximum event size limit ([#548](https://github.com/rudderlabs/rudder-sdk-ios/issues/548)) ([892892d](https://github.com/rudderlabs/rudder-sdk-ios/commit/892892ddf234b7d76abc4fa9ad2f629bb08517f7)) + + +### Bug Fixes + +* memory issue crash happening on CloudModeProcessor ([#544](https://github.com/rudderlabs/rudder-sdk-ios/issues/544)) ([a71ac44](https://github.com/rudderlabs/rudder-sdk-ios/commit/a71ac444393b750a9dcbe5dd094924e72f60799f)) + ### [1.29.1](https://github.com/rudderlabs/rudder-sdk-ios/compare/v1.29.0...v1.29.1) (2024-10-07) diff --git a/Podfile.lock b/Podfile.lock index 2cf5214f..53c24735 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -3,7 +3,7 @@ PODS: - RSCrashReporter (= 1.0.1) - RudderKit (= 1.4.0) - RSCrashReporter (1.0.1) - - Rudder (1.28.1): + - Rudder (1.29.1): - MetricsReporter (= 2.0.0) - RudderKit (1.4.0) - SQLCipher (4.5.4): @@ -33,7 +33,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: MetricsReporter: 364b98791e868b10e9d512eb50af28d8c11e5cdb RSCrashReporter: 6b8376ac729b0289ebe0908553e5f56d8171f313 - Rudder: 07c2c7f8f02a91a3c8343d7284d3b3b49f8da969 + Rudder: 731095848aee39d27ff5d0e78233aa5ad8febb0b RudderKit: d9d6997696e1642b753d8bdf94e57af643a68f03 SQLCipher: 905b145f65f349f26da9e60a19901ad24adcd381 diff --git a/README.md b/README.md index 9eb942c5..17a74229 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
@@ -39,7 +39,7 @@ The iOS SDK is available through [**CocoaPods**](https://cocoapods.org), [**Cart To install the SDK, simply add the following line to your Podfile: ```xcode -pod 'Rudder', '1.29.1' +pod 'Rudder', '1.30.0' ``` ### Carthage @@ -47,7 +47,7 @@ pod 'Rudder', '1.29.1' For Carthage support, add the following line to your `Cartfile`: ```xcode -github "rudderlabs/rudder-sdk-ios" "v1.29.1" +github "rudderlabs/rudder-sdk-ios" "v1.30.0" ``` > Remember to include the following code in all `.m` and `.h` files where you want to refer to or use the RudderStack SDK classes, as shown: @@ -71,7 +71,7 @@ You can also add the RudderStack iOS SDK via Swift Package Mangaer, via one of t * Enter the package repository (`git@github.com:rudderlabs/rudder-sdk-ios.git`) in the search bar. -* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.29.1` as the value, as shown: +* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.30.0` as the value, as shown:  @@ -99,7 +99,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "git@github.com:rudderlabs/rudder-sdk-ios.git", from: "1.29.1") + .package(url: "git@github.com:rudderlabs/rudder-sdk-ios.git", from: "1.30.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/Classes/Headers/RSVersion.h b/Sources/Classes/Headers/RSVersion.h index cf5b4eab..51a1fbcf 100644 --- a/Sources/Classes/Headers/RSVersion.h +++ b/Sources/Classes/Headers/RSVersion.h @@ -8,6 +8,6 @@ #ifndef RSVersion_h #define RSVersion_h -NSString *const SDK_VERSION = @"1.29.1"; +NSString *const SDK_VERSION = @"1.30.0"; #endif /* RSVersion_h */ diff --git a/Sources/Classes/RSCloudModeManager.m b/Sources/Classes/RSCloudModeManager.m index b82675aa..c98125d6 100644 --- a/Sources/Classes/RSCloudModeManager.m +++ b/Sources/Classes/RSCloudModeManager.m @@ -39,55 +39,48 @@ - (void) startCloudModeProcessor { [RSLogger logDebug:@"RSCloudModeManager: CloudModeProcessor: Starting the Cloud Mode Processor"]; int sleepCount = 0; while (YES) { - @try { - [strongSelf->lock lock]; - RSNetworkResponse* response = nil; - [strongSelf->dbPersistentManager clearOldEventsWithThreshold: strongSelf->config.dbCountThreshold]; - [RSLogger logDebug:@"RSCloudModeManager: CloudModeProcessor: Fetching events to flush to server"]; - RSDBMessage* dbMessage = [strongSelf->dbPersistentManager fetchEventsFromDB:(strongSelf->config.flushQueueSize) ForMode:CLOUDMODE]; - if ((dbMessage.messages.count >= strongSelf->config.flushQueueSize) || (dbMessage.messages.count > 0 && (sleepCount >= strongSelf->config.sleepTimeout))) { - NSString* payload = [RSCloudModeManager getPayloadFromMessages:dbMessage]; - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Payload: %@", payload]]; - [RSLogger logInfo:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: EventCount: %lu", (unsigned long)dbMessage.messageIds.count]]; - [RSMetricsReporter report:SDKMETRICS_CM_EVENT forMetricType:COUNT withProperties:@{SDKMETRICS_TYPE: SDKMETRICS_MESSAGES} andValue:(float)dbMessage.messages.count]; - if (payload != nil) { - response = [strongSelf->networkManager sendNetworkRequest:payload toEndpoint:BATCH_ENDPOINT withRequestMethod:POST]; - if (response.state == NETWORK_SUCCESS) { - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Updating status as CLOUDMODEPROCESSING DONE for events (%@)",[RSUtils getCSVStringFromArray:dbMessage.messageIds]]]; - [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_SUCCESS forMetricType:COUNT withProperties:nil andValue:(float)dbMessage.messages.count]; - [strongSelf->dbPersistentManager updateEventsWithIds:dbMessage.messageIds withStatus:CLOUD_MODE_PROCESSING_DONE]; - [strongSelf->dbPersistentManager clearProcessedEventsFromDB]; - sleepCount = 0; - [self->backOff reset]; - } + [strongSelf->lock lock]; + RSNetworkResponse* response = nil; + [strongSelf->dbPersistentManager clearOldEventsWithThreshold: strongSelf->config.dbCountThreshold]; + [RSLogger logDebug:@"RSCloudModeManager: CloudModeProcessor: Fetching events to flush to server"]; + RSDBMessage* dbMessage = [strongSelf->dbPersistentManager fetchEventsFromDB:(strongSelf->config.flushQueueSize) ForMode:CLOUDMODE]; + if ((dbMessage.messages.count >= strongSelf->config.flushQueueSize) || (dbMessage.messages.count > 0 && (sleepCount >= strongSelf->config.sleepTimeout))) { + NSString* payload = [RSCloudModeManager getPayloadFromMessages:dbMessage]; + [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Payload: %@", payload]]; + [RSLogger logInfo:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: EventCount: %lu", (unsigned long)dbMessage.messageIds.count]]; + [RSMetricsReporter report:SDKMETRICS_CM_EVENT forMetricType:COUNT withProperties:@{SDKMETRICS_TYPE: SDKMETRICS_MESSAGES} andValue:(float)dbMessage.messages.count]; + if (payload != nil) { + response = [strongSelf->networkManager sendNetworkRequest:payload toEndpoint:BATCH_ENDPOINT withRequestMethod:POST]; + if (response.state == NETWORK_SUCCESS) { + [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Updating status as CLOUDMODEPROCESSING DONE for events (%@)",[RSUtils getCSVStringFromArray:dbMessage.messageIds]]]; + [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_SUCCESS forMetricType:COUNT withProperties:nil andValue:(float)dbMessage.messages.count]; + [strongSelf->dbPersistentManager updateEventsWithIds:dbMessage.messageIds withStatus:CLOUD_MODE_PROCESSING_DONE]; + [strongSelf->dbPersistentManager clearProcessedEventsFromDB]; + sleepCount = 0; + [self->backOff reset]; } } - [strongSelf->lock unlock]; - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: cloudModeSleepCount: %d", sleepCount]]; - sleepCount += 1; - - if(response == nil) { - sleep(1); - } else if (response.state == WRONG_WRITE_KEY) { - [RSLogger logError:@"RSCloudModeManager: CloudModeProcessor: Wrong WriteKey. Aborting the Cloud Mode Processor"]; - break; - } else if (response.state == INVALID_URL) { - [RSLogger logError:@"RSCloudModeManager: CloudModeProcessor: Invalid Data Plane URL. Aborting the Cloud Mode Processor"]; - [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_ABORT forMetricType:COUNT withProperties:@{SDKMETRICS_TYPE: SDKMETRICS_DATA_PLANE_URL_INVALID} andValue:1]; - break; - } else if (response.state == NETWORK_ERROR) { - int delay = [self->backOff nextDelay]; - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Retrying in: %@", [RSUtils secondsToString:delay]]]; - [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_RETRY forMetricType:COUNT withProperties:nil andValue:1]; - sleep(delay); - } else { // To handle the status code RESOURCE_NOT_FOUND(404) & BAD_REQUEST(400) - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Retrying in: 1s"]]; - sleep(1); - } } - @catch (NSException *exception) { - [strongSelf->lock unlock]; - [RSLogger logError:[NSString stringWithFormat:@"RSCloudModeManager: CloudModeProcessor: Failed to flush current batch, reason: %@", exception.reason]]; + [strongSelf->lock unlock]; + [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: cloudModeSleepCount: %d", sleepCount]]; + sleepCount += 1; + + if(response == nil) { + sleep(1); + } else if (response.state == WRONG_WRITE_KEY) { + [RSLogger logError:@"RSCloudModeManager: CloudModeProcessor: Wrong WriteKey. Aborting the Cloud Mode Processor"]; + break; + } else if (response.state == INVALID_URL) { + [RSLogger logError:@"RSCloudModeManager: CloudModeProcessor: Invalid Data Plane URL. Aborting the Cloud Mode Processor"]; + [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_ABORT forMetricType:COUNT withProperties:@{SDKMETRICS_TYPE: SDKMETRICS_DATA_PLANE_URL_INVALID} andValue:1]; + break; + } else if (response.state == NETWORK_ERROR) { + int delay = [self->backOff nextDelay]; + [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Retrying in: %@", [RSUtils secondsToString:delay]]]; + [RSMetricsReporter report:SDKMETRICS_CM_ATTEMPT_RETRY forMetricType:COUNT withProperties:nil andValue:1]; + sleep(delay); + } else { // To handle the status code RESOURCE_NOT_FOUND(404) & BAD_REQUEST(400) + [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSCloudModeManager: CloudModeProcessor: Retrying in: 1s"]]; sleep(1); } } diff --git a/Sources/Classes/RSDBPersistentManager.m b/Sources/Classes/RSDBPersistentManager.m index 65c56d36..73811aa6 100644 --- a/Sources/Classes/RSDBPersistentManager.m +++ b/Sources/Classes/RSDBPersistentManager.m @@ -490,48 +490,54 @@ -(RSDBMessage*) fetchAllEventsFromDBForMode:(MODES) mode { } - (RSDBMessage *) getEventsFromDB :(NSString*) querySQLString { - [RSLogger logDebug:[[NSString alloc] initWithFormat:@"RSDBPersistentManager: getEventsFromDB: fetchEventSql: %@", querySQLString]]; - - const char* querySQL = [querySQLString UTF8String]; - NSMutableArray