Code Monkey home page Code Monkey logo

Comments (11)

sync-by-unito avatar sync-by-unito commented on August 24, 2024

➤ PM Bot commented:

Jira ticket: RCOCOA-2302

from realm-swift.

nirinchev avatar nirinchev commented on August 24, 2024

@michael-wb can you take a look at this one?

from realm-swift.

sync-by-unito avatar sync-by-unito commented on August 24, 2024

➤ michael-wb commented:

This looks like it is related to RCORE-1982 that I am currently working on. The error reported by core is not fatal, but the sync session will not attempt to reconnect. Both of these will be addressed.

The current workaround is to is to ignore the error for now and the reconnect should occur (at least on Cocoa) once the device is connected to the network.

from realm-swift.

nirinchev avatar nirinchev commented on August 24, 2024

I think the problem is that we're hitting an assertion failure in handle_location_update_failed, so there's no obvious way to ignore the error here.

from realm-swift.

gyratorycircus avatar gyratorycircus commented on August 24, 2024

Thanks all! We've received more information from users, and it seems to be occurring when a network connection appears to exist (local wifi), but that connection may be restricted to most outside sources. Unfortunately this is fairly common use case for our users, so it's quite impactful at the moment.

It looks like the assertion was introduced in realm-core 13.26.0 in this commit.

I was wondering if it would be safe for a production app to rollback from Realm Swift v10.47 to v10.45.3, reverting to the previous version of realm-core?

from realm-swift.

sync-by-unito avatar sync-by-unito commented on August 24, 2024

➤ michael-wb commented:

Thanks for the update - the error happens any time the location update fails (e.g. no internet) when a realm is opened. One workaround is to capture the error and just ignore it, as described from a different ticket (copied below). A fix is in progress and I am currently adding tests to verify.

{quote}
If they keep using 10.45.3 (https://github.com/realm/realm-swift/releases/tag/v10.45.3)
A workaround on the meantime is to ignore connection errors while we work on a fix for this, there is already a Core ticket for it https://jira.mongodb.org/browse/RCORE-1982.
An example of the code
{quote}

app.syncManager.errorHandler = { syncError, syncSession in
   if let syncError = syncError as? SyncError {
      if syncError.code == .connectionFailed {
          return
      }
      self.error = syncError
   }
} 

{quote}
This will hide the error message while offline. The sync session will be resumed when the device goes online without the need of any extra code (Like previous behaviour).
{quote}

from realm-swift.

gyratorycircus avatar gyratorycircus commented on August 24, 2024

That doesn't appear to be our experience. No sync error is reported, and the application is killed from the realm sync thread.

from realm-swift.

sync-by-unito avatar sync-by-unito commented on August 24, 2024

➤ michael-wb commented:

Sorry for the inconvenience this has caused.
Are you able to tell if the crash is coming from this line? (fwiw - the handle_location_update_failed function this is part of is being removed as part of the fix):
https://github.com/realm/realm-core/blob/master/src/realm/object-store/sync/sync_session.cpp#L253
REALM_ASSERT(m_state == State::WaitingForAccessToken);

from realm-swift.

gyratorycircus avatar gyratorycircus commented on August 24, 2024

It seems likely. The next call in the stack trace is to realm::util::terminate, which would track with that REALM_ASSERT macro. Is it possible to disable assertions from the Realm Swift SDK (installed via CocoaPods)?

I'm also happy to rollback to v10.45.3 for a while if there wouldn't be any compatibility issues with apps that had already been running v10.47

from realm-swift.

michael-wb avatar michael-wb commented on August 24, 2024

Hi @gyratorycircus,
This has been updated in the Swift SDK v10.49.1 (based on Realm v14.4.1) to no longer throw the fatal error if the location update fails while offline. However, there is still an outstanding issue (realm/realm-core#7527) regarding @AutoOpen, where it will not exit the .connecting state if the location needs to be updated and the client is offline. There is a fix for this issue in review and will be merged shortly.

from realm-swift.

michael-wb avatar michael-wb commented on August 24, 2024

@gyratorycircus - Sorry for the delay, the Realm Swift v10.50.0 release includes a fix (in Realm Core PR #7528) that is part of Core v16.5.2 so the @AutoOpen class so it will fall through and open the local realm if the asynchronous sync/update is not able to successfully update the realm (e.g. currently offline).

Please reopen this ticket or file a new one if you find that it is still not working for you.

from realm-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.