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

sessionprojector.app crashes when disk running out of space #23

Open
unstabler opened this issue Oct 26, 2023 · 1 comment
Open

sessionprojector.app crashes when disk running out of space #23

unstabler opened this issue Oct 26, 2023 · 1 comment

Comments

@unstabler
Copy link
Collaborator

ENVIRONMENT

  • Mac Mini (M1, 2020, 16GB)
  • macOS 14 Sonoma (14.0; 23A344)

SUMMARY

// Thread 34 Queue : com.apple.NSXPCConnection.m-user.com.apple.replayd (serial)
// #2	0x0000000100e01e7c in SCScreenRecorder.stream(_:didStopWithError:) at /Users/cheesekun/works/ulalaca/sessionprojector/sessionprojector/recorder/SCScreenRecorder.swift:217

extension SCScreenRecorder: SCStreamDelegate {
    public func stream(_ stream: SCStream, didStopWithError error: Error) {
        logger.error("didStopWithError: \(error.localizedDescription)")
        //                                ^^^^^ Thread 34: EXC_BAD_ACCESS (code=1, address=0x0)

        delegateQueue.async {
            self.delegate?.screenRecorder(didStopWithError: error)
        }
    }
}
; Thread 34 Queue : com.apple.NSXPCConnection.m-user.com.apple.replayd (serial)
; #4	0x00000001f28f71f0 in -[SCStreamManager stream:didStopWithError:] ()

    0x1f28f71d4 <+428>: bl     0x1f291cb80               ; objc_msgSend$delegate
    0x1f28f71d8 <+432>: mov    x29, x29
    0x1f28f71dc <+436>: bl     0x1f290a5f8               ; symbol stub for: objc_retainAutoreleasedReturnValue
    0x1f28f71e0 <+440>: mov    x21, x0
    0x1f28f71e4 <+444>: mov    x2, x22
    0x1f28f71e8 <+448>: mov    x3, x20
    0x1f28f71ec <+452>: bl     0x1f291fa80               ; objc_msgSend$stream:didStopWithError:
->  0x1f28f71f0 <+456>: mov    x0, x21
    0x1f28f71f4 <+460>: bl     0x1f290a5b8               ; symbol stub for: objc_release
    0x1f28f71f8 <+464>: b      0x1f28f7218               ; <+496>
    0x1f28f71fc <+468>: cmp    w8, #0x2
    0x1f28f7200 <+472>: b.hi   0x1f28f7218               ; <+496>


(lldb) register read --all
General Purpose Registers:
       x19 = 0x00006000007039c0
       x20 = 0x0000000000000000 ; <-- ???????????????????????????
       x21 = 0x00006000020c78d0
       x22 = 0x0000600002ec0700
       x23 = 0x0000000000000001
       x24 = 0x0000000000000001
       x25 = 0x0000000000000000
       x26 = 0x0000600002dc0000
       x27 = 0x0000000000000001
       x28 = 0x000060000076eb40
        fp = 0x000000016f0c1f60
        sp = 0x000000016f0c1ef0
        pc = 0x00000001f28f71f0  ScreenCaptureKit`-[SCStreamManager stream:didStopWithError:] + 456
       w19 = 0x007039c0
       w20 = 0x00000000
48 registers were unavailable.
  • ScreenCaptureKit calls SCStreamDelegate::stream: (SCStream!) stream didStopWithError: (Error!) error when something is going wrong
    • error parameter is marked as nonnull, but ScreenCaptureKit(or ReplayKit) actually passes nil

어떻게 해야 하지

  • Apple에 버그 리포트?

  • guard let error = (error as? Any) as? Error 같은 임시 조치를 해야 하는데, 이게 먹을까?

  • nonnull이라면서 왜 null인데.. 얼탱이 X

@unstabler unstabler changed the title SCScreenRecorder: stream:didStopWithError: has called with nil error SCScreenRecorder: stream:didStopWithError: called with nil error Oct 26, 2023
@unstabler unstabler changed the title SCScreenRecorder: stream:didStopWithError: called with nil error SCScreenRecorder: stream:didStopWithError: called but error is nil Oct 26, 2023
@unstabler
Copy link
Collaborator Author

결론

default	04:25:13.294591+0900	deleted	[0x157759840] activating connection: mach=true listener=false peer=false name=com.apple.replayd-cache-delete
default	04:25:13.295043+0900	replayd	[0x126065bc0] activating connection: mach=false listener=false peer=true name=com.apple.replayd-cache-delete.peer.0x126065bc0
default	04:25:13.295308+0900	replayd	servicePurge QOS: 17
default	04:25:13.295357+0900	replayd	 [INFO] -[RPRecordingManager volumeMatchesCachePath:]:231 _mountOnName=<private>, volume=<private>, match=1
default	04:25:13.295587+0900	replayd	 [INFO] -[RPRecordingManager purge:urgency:]:253 cacheDeleteUrgencyHigh
default	04:25:13.295732+0900	replayd	 [INFO] -[RPClient handleMemoryWarningForCurrentActiveSession]:905
default	04:25:13.295762+0900	replayd	 [INFO] -[RPClient handleMemoryWarningForCurrentActiveSession]:930 We don't have a current active session.
default	04:25:13.296358+0900	replayd	 [INFO] -[RPClient stopAllStreamsWithError:]:1224
default	04:25:13.296392+0900	replayd	 [INFO] -[RPClient notifyManagerCallBack:forStreamID:withContentFilter:withStreamConfig:]:1041 control center client <private> managerStream=3
default	04:25:13.296425+0900	replayd	 [INFO] -[RPClientProxy purgePickersForApplicationBundleID:]:228
default	04:25:13.296648+0900	replayd	 [INFO] -[RPClient stopAllStreamsWithError:]:1224
default	04:25:13.296674+0900	replayd	 [INFO] -[SCCaptureSession stopAndInvalidateWithStreamData:completionHandler:]:771 session=0x126141560 streamID=<private>
default	04:25:13.296827+0900	ControlCenter	 [INFO] -[RPDaemonProxy purgePickersForApplicationBundleID:]:1175
default	04:25:13.296782+0900	replayd	 [INFO] SCRemoteQueue_StopSenderQueue:244 streamID=<private> remoteQueue=0x126109660
default	04:25:13.296839+0900	replayd	 [INFO] SCRemoteQueue_StopSenderQueue:244 streamID=<private> remoteQueue=0x126309c70
default	04:25:13.296971+0900	ControlCenter	 [INFO] -[SCControlCenterManager updatePickersWithType:config:bundleID:]_block_invoke:661 didMatch 0 with type 5 and object (null)
default	04:25:13.296931+0900	replayd	 [INFO] -[SCScreenCaptureSession stopWithError:]:179 0x126512b30: streamID=<private>
default	04:25:13.296973+0900	replayd	-[SLContentStream stop:]: self = 0x12650a190
default	04:25:13.297142+0900	sessionprojector-debug	 [INFO] -[RPDaemonProxy stopRemoteQueue:type:]:1111
default	04:25:13.297250+0900	sessionprojector-debug	 [INFO] -[SCStreamManager stopRemoteQueue:type:]:96 0x6000028b8ec0 streamId=B1E39CEB-3B4F-49A7-954B-4E4BFEC36135
default	04:25:13.297296+0900	sessionprojector-debug	 [INFO] SCRemoteQueue_Destroy:257 remoteQueue=0x6000025cc210
default	04:25:13.297466+0900	replayd	 [INFO] SCCaptureSession_frameHandler:1261 Content stream frame status stopped for session=0x126141560 streamID=<private>
default	04:25:13.298187+0900	sessionprojector-debug	 [INFO] -[RPDaemonProxy stopRemoteQueue:type:]:1111
default	04:25:13.298193+0900	NotificationCenter	Performing scheduled flush of powerlog view entries
default	04:25:13.298261+0900	sessionprojector-debug	 [INFO] -[SCStreamManager stopRemoteQueue:type:]:96 0x6000028b8ec0 streamId=B1E39CEB-3B4F-49A7-954B-4E4BFEC36135
default	04:25:13.298261+0900	NotificationCenter	No powerlog view entries to flush.
default	04:25:13.298324+0900	sessionprojector-debug	 [INFO] SCRemoteQueue_Destroy:257 remoteQueue=0x6000025f2820
default	04:25:13.298671+0900	replayd	 [INFO] +[RPReportingAgent sendReportEventWithType:dictionary:withServiceName:clientBundleId:sessionID:]:105 reported eventType:1
default	04:25:13.298729+0900	replayd	 [INFO] -[SCScreenCaptureSession dealloc]:185 self=0x126512b30
default	04:25:13.298757+0900	replayd	-[SLContentStream dealloc]: self = 0x12650a190
default	04:25:13.298856+0900	WindowServer	Dead sharing context E38B7F09-9D21-4993-B554-67081C217B84
default	04:25:13.298875+0900	WindowServer	Ending sharing context E38B7F09-9D21-4993-B554-67081C217B84
default	04:25:13.299345+0900	replayd	-[SLContentFilter dealloc]: self = 0x12650b900
default	04:25:13.299420+0900	replayd	 [INFO] -[RPClient stopAllStreamsWithError:]_block_invoke:1235 Stopped stream=<private>
default	04:25:13.299463+0900	replayd	 [INFO] -[RPClientProxy stream:didStopWithError:]:164
default	04:25:13.299591+0900	replayd	 [INFO] -[RPClient notifyManagerCallBack:forStreamID:withContentFilter:withStreamConfig:]:1041 control center client <private> managerStream=2
default	04:25:13.299622+0900	replayd	 [INFO] -[RPClientProxy streamDidStopWithConfiguration:contentFilter:]:196
default	04:25:13.299709+0900	sessionprojector-debug	 [INFO] -[RPDaemonProxy stream:didStopWithError:]:1119
default	04:25:13.299860+0900	replayd	 [INFO] -[SCCaptureSession dealloc]:236 session=0x126141560
default	04:25:13.299776+0900	sessionprojector-debug	 [INFO] -[SCStreamManager stream:didStopWithError:]:101 0x6000028b8ec0 didStopWithError=(null) for streamID=B1E39CEB-3B4F-49A7-954B-4E4BFEC36135

Screenshot 2023-10-27 at 4 37 03 AM

  • deleted will forcibly stop screen recording session when the disk runs out of space

  • 디스크 용량이 없으면 deleted 데몬에서 ReplayKit에게 캐시 삭제를 시킨다.

  • ReplayKit은 캐시를 삭제하면서 진행 중인 녹화를 전부 정지한다.

  • 그런데 내부 처리에 문제가 있는지 녹화 정지 알림이 나가면서 오류는 null로 나간다 -> 터진다 (^o^)/

@unstabler unstabler changed the title SCScreenRecorder: stream:didStopWithError: called but error is nil sessionprojector.app crashes when disk running out of space Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant