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
Crash in mpv_set_property during termination #3596
Comments
The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
AnalysisThis is a race condition during shutdown. Failing Call SequenceThe failing call sequence is as follows: The method func windowDidExitFullScreen(_ notification: Notification) {
...
videoViewConstraints.values.forEach { $0.constant = 0 }
videoView.needsLayout = true
videoView.layoutSubtreeIfNeeded()
videoView.videoLayer.resume()
fsState.finishAnimating() The method enum FullScreenState: Equatable {
mutating func finishAnimating() {
switch self {
case .windowed, .fullscreen: assertionFailure("something went wrong with the state of the world. One must be .animating to finishAnimating. Not \(self)")
case .animating(let toFullScreen, let legacy, let frame):
if toFullScreen {
self = .fullscreen(legacy: legacy, priorWindowedFrame: frame)
} else{
self = .windowed Changing the value of var fsState: FullScreenState = .windowed {
didSet {
switch fsState {
case .fullscreen: player.mpv.setFlag(MPVOption.Window.fullscreen, true)
case .animating: break
case .windowed: player.mpv.setFlag(MPVOption.Window.fullscreen, false) The method func setFlag(_ name: String, _ flag: Bool) {
var data: Int = flag ? 1 : 0
mpv_set_property(mpv, name, MPV_FORMAT_FLAG, &data)
} The mpv method Failing Event SequenceThe failing event sequence is as follows:
Whether a crash occurs or not depends upon when the framework calls IINA needs to coordinate mpv termination such that once the quit command has been sent to mpv IINA no longer attempts to use the mpv context for anything other than completing the termination. Layering ViolationsFrom code reading it seemed like
But it seems like
This suggests FixingThe commit in the pull request will:
|
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
This was also reported against IINA in issue iina#3596 The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
The commit in the pull request will: - Rename the PlayerCore property isMpvTerminated to isMpvTerminating to reflect that termination has been initiated and being processed asynchronously - Change existing references to isMpvTerminated to use new name - Change PlayerCore.terminateMPV to set isMpvTerminating to true right before starting the termination process - Change PlayerCore.syncUI to do nothing if mpv is terminating - Change MPVController.mpvQuit to remove observers MPVController registered before sending the quit command to mpv - Change many MPVController methods to check to see if mpv is being terminated
The fix in PR #3961 closes windows before shutting down mpv. That should prevent this crash. |
This is fixed in the released version of IINA. |
System and IINA version:
Expected behavior:
IINA quits without crashing.
Actual behavior:
If IINA is running in full-screen mode it may crash when quitting.
This issue filed against IINA-Plus: CarterLi#11 reports a crash during shutdown. IINA-Plus already contains the changes in this IINA PR #3591 which cause IINA to properly wait for mpv to shutdown. This makes it more likely that existing issues with coordination of threads in the shutdown process will be exposed. Therefore this same crash may be possible in IINA, just currently less likely.
The full crash report is available in the IINA-Plus issue, so I have only included the top of the stack off the crashing thread here.
Crash report:
Steps to reproduce:
This is an event / thread race condition, so very difficult to reproduce.
I have already reproduced the problem. I will post an analysis and proposed fix shortly.
This is an IINA problem.
How often does this happen?
If the fix to wait for mpv to shutdown is applied it is not hard to reproduce.
The text was updated successfully, but these errors were encountered: