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

RCOCOA-2310: Fix a crash when receiving 401/403 when opening a watch stream #8536

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

nirinchev
Copy link
Member

It looks like we can end up in a situation where URLSession:didCompleteWithError is invoked with nil error, which results in a crash if we try to insert it as a value for NSError.userInfo dictionary. With this change we insert [NSNull null] for NSUnderlyingErrorKey instead.

I've added a test that uses the watch functionality as that appears to be the only thing that exercises the RLMEventSessionDelegate codepaths. It's not the cleanest test, but I couldn't come up with anything better that reproduces the crash.

Fixes #8519

Copy link
Contributor

@dianaafanador3 dianaafanador3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!, Just a few comments

Realm/ObjectServerTests/SwiftObjectServerTests.swift Outdated Show resolved Hide resolved
@@ -26,10 +26,13 @@ final public class WatchTestUtility: ChangeEventDelegate {
private let openExpectation: XCTestExpectation
private let closeExpectation: XCTestExpectation
private var changeExpectation: XCTestExpectation?
private let expectError: Bool
public var closeError: Error?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public var closeError: Error?
public var didCloseError: Error?

CHANGELOG.md Outdated Show resolved Hide resolved
@nirinchev nirinchev merged commit 2974253 into master Apr 8, 2024
131 of 133 checks passed
@nirinchev nirinchev deleted the ni/nil-error-on-revoke branch April 8, 2024 22:47
nirinchev added a commit that referenced this pull request Apr 10, 2024
* master:
  RCOCOA-2305: Update base url to point to services.cloud.mongodb.com (#8537)
  Update docs URL (#8538)
  RCOCOA-2310: Fix a crash when receiving 401/403 when opening a watch stream (#8536)
  Add core version to build-binaries workflow (#8525)
  Add an empty changelog section
  Upgrade to core 14.4.1 (#8526)
  Release v10.49.0
  Upgrade to core 14 (#8496)
  RCOCOA-2308: Add GHA workflow for core prebuilds (#8517)
  Release 10.48.1
  Add NSPrivacyAccessedAPICategoryDiskSpace to the privacy manifest (#8511)
  🔄 Synced file(s) with realm/ci-actions (#8520)
  Add build-binaries workflow (#8515)
  Only commit the changelog in the add empty changelog release step (#8505)
  Release 10.48.0
  Introduce `_customRealmProperties()` to all Realm Objects to allow for client-generated RLMProperties (via Swift Macros) (#8490)
  Update packaging for Xcode 15.3 (#8502)

# Conflicts:
#	Realm/RLMAsyncTask.mm
#	Realm/RLMSyncSession.mm
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when user sessions are revoked
2 participants