Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-2410

Realm crash when accessing PersistableEnum

      How frequently does the bug occur?

      Sometimes

      Description

      We are seeing a huge uptick in crashes by our users. We are currently unable to replicate the issue.

      0  Riverside                      0x16d96b0 protocol witness for static _Persistable._rlmGetProperty(_:_:) in conformance StudioRecordingSet.RecordingType + 2552184
      1  Riverside                      0x16d9600 protocol witness for static _Persistable._rlmGetProperty(_:_:) in conformance StudioRecordingSet.RecordingInputType + 2552008
      

      The very strange thing is that in the crashing func I see the call to get one of the @Persisted public var that is crashing (recordingInputType) but not to the other one (recordingType)

      This is how they are defined, and the crashing func

          public enum RecordingType: String, PersistableEnum {
              case studioRecording
              case testRecording
          }
          public enum RecordingInputType: String, PersistableEnum {
              case screen
              case cameraAndMicrophone
              
              public var streamInputType: ParticipantInputType {
                  switch self {
                  case .screen: return .screen
                  case .cameraAndMicrophone: return .camera
                  }
              }
          }
      
          @Persisted public var recordingType: RecordingType = .studioRecording
          @Persisted public var recordingInputType: RecordingInputType = .cameraAndMicrophone
      
      
          public var archiveId: String { <--- here is the crash
              // editor team expects the screenshare recordings to have a specific prefix
              let prefix = self.recordingInputType == .screen ? "screenshare_" : "" 
              return "\(prefix)\(self.cleanParticipantName)-\(self.archiveNumber)"
          }
      

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      0  Riverside                      0x16d96b0 protocol witness for static _Persistable._rlmGetProperty(_:_:) in conformance StudioRecordingSet.RecordingType + 2552184
      1  Riverside                      0x16d9600 protocol witness for static _Persistable._rlmGetProperty(_:_:) in conformance StudioRecordingSet.RecordingInputType + 2552008
      2  RealmSwift                     0x6090c $s10RealmSwift9PersistedV3getyxSo13RLMObjectBaseCF + 720
      3  RealmSwift                     0x60614 $s10RealmSwift9PersistedV18_enclosingInstance7wrapped7storagexqd___s24ReferenceWritableKeyPathCyqd__xGAHyqd__ACyxGGtcSo13RLMObjectBaseCRbd__luigZ + 104
      4  Riverside                      0x16dd7e4 StudioRecordingSet.archiveId.getter + 111 (StudioRecordingSet.swift:111)
      5  Riverside                      0x16e3c7c StudioRecordingSet._getBaseRecordingObject() + 476 (StudioRecordingSet.swift:476)
      6  Riverside                      0x16e4508 StudioRecordingSet.getUpdateRecordingObject() + 429 (StudioRecordingSet.swift:429)
      7  Riverside                      0x16ebcd0 StudioRecordingsManager._handleRecordingEnded(_:log:) + 128 (StudioRecordingsManager.swift:128)
      8  Riverside                      0x16eb488 StudioRecordingsManager._updateRecordingsOnServerDB() + 90 (StudioRecordingsManager.swift:90)
      9  Riverside                      0x16ea740 closure #1 in StudioRecordingsManager._startUpdaterTimer() + 63 (StudioRecordingsManager.swift:63)
      10 Riverside                      0x26c8e4 thunk for @escaping @callee_guaranteed () -> () + 4302997732 (<compiler-generated>:4302997732)
      11 libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
      12 libdispatch.dylib              0x746c _dispatch_continuation_pop + 504
      13 libdispatch.dylib              0x1aa58 _dispatch_source_invoke + 1588
      14 libdispatch.dylib              0x15a6c _dispatch_root_queue_drain + 396
      15 libdispatch.dylib              0x16284 _dispatch_worker_thread2 + 164
      16 libsystem_pthread.dylib        0xdbc _pthread_wqthread + 228
      17 libsystem_pthread.dylib        0xb98 start_wqthread + 8
      

      Can you reproduce the bug?

      No

      Reproduction Steps

      The crash is happening a lot for our users.

      Version

      Realm (10.45.3) RealmSwift (10.45.3)

      What Atlas Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      iOS (16.2, 17.4.1, 17.5.1)

      Build environment

      Xcode version: 15.2
      Dependency manager and version: Cocoapods

            Assignee:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: