-
Notifications
You must be signed in to change notification settings - Fork 29
Closing and opening files leads to Iina to crash and not respond #17
Comments
Investigating. |
IINA v1.2.0-21 is from 6 days ago and is missing the fix for my fix from 4 days ago. This report got me to look at the fix again and I've just pushed another commit that tweaks it some more to hopefully make really sure the hang is fixed. @CarterLi Please create a new build when you get a chance. |
I'd like to use Github Actions building M1 versions when supported. Ref: actions/runner-images#2187 |
Spindump.txt |
@ViRo3, @CarterLi New plan. Stablize IINA-Plus:
I've just pushed a commit that backs out the changes made to fix iina#3601. The issue iina#3601 is about wasting a minor amount of energy. Desirable to eventually fix, but not critical to fix it right now with the "fix" causing so much trouble. Unfortunately the timing on my Mac is such that so far I've not been able to reproduce these hangs. So I've been taking a "stab in the dark" as to what is going wrong and how to fix it. Clearly that is not working. More important to focus on other issues. I alway hate to give up on fixing an issue but that seems like the right decision on this one for now. I did leave in one change made as a part of this fix which was to add guarding that guard let duration = videoDuration, let position = videoPosition else { return } That seems like a safe useful change. The change that was triggering the problem is the attempt to stop and start the timer that synchronizes the OSC based on whether the OSC is visible or not. Backing out the change puts IINA back to updating the OSC even though it is not visible to the user. This wastes some energy, but the vast majority of CPU time consumed is in the code that displays the video. |
By the way, there is an IINA hang out there lurking, the issue "Main thread hang in mpv_render_context_create during startup". So if IINA hangs during startup don't assume it was one of these recent issues. Always need a sample of IINA to have a chance of knowing what the issue is. I hit that hang once with the released version of IINA. I also hit it once with a development version of IINA using mpv 0.34.0. I made a concerted effort to reproduce it, running a test designed to trigger it thousands of times. No luck. Whatever that problem is, it is rare. |
Yes, its a very specific file that completely freezes Iina. (Have link it above) so as such it isn't really a major issue |
New binary released. Please test it |
So It's not caused by fixing iina#3601. Please test this version: https://github.com/iina-plus/iina/releases/tag/v1.2.0-25 |
I'm currently tired and may not be thinking straight... From a quick look I am stunned and confused. The process sample shows the same main thread lockup with This movie plays fine with the released verion of IINA? The hang only occurs with IINA Plus? There is one other change in IINA Plus that has to do with When exactly is this hang triggered? When it hangs what is the video doing? Just freezes? I will be taking a closer at the other threads in the spin dump to see if I can spot something that looks wrong. Might have to pull some of these other fixes and see what effect that has on the problem. I guess we first see if the new build makes any sort of difference. |
I encountered freezing after using I just removed it. Let's see what's happening next |
@ViRo3 Are you able to play the video using mpv without problems? I'm thinking we should take a look at the IINA and mpv log files. Usually log files don't help that much with hangs. But if there is trouble with playback we might find some clues in the mpv log. The sample shows the main thread completely locked up:
As I had just added a change involving This is the mpv method that is being called by IINA code: int mpv_get_property(mpv_handle *ctx, const char *name, mpv_format format,
void *data)
{
if (!ctx->mpctx->initialized)
return MPV_ERROR_UNINITIALIZED;
if (!data)
return MPV_ERROR_INVALID_PARAMETER;
if (!get_mp_type_get(format))
return MPV_ERROR_PROPERTY_FORMAT;
struct getproperty_request req = {
.mpctx = ctx->mpctx,
.name = name,
.format = format,
.data = data,
};
run_locked(ctx, getproperty_fn, &req);
return req.status;
} That method is stopped calling // Run a command in the playback thread.
static void run_locked(mpv_handle *ctx, void (*fn)(void *fn_data), void *fn_data)
{
mp_dispatch_lock(ctx->mpctx->dispatch);
fn(fn_data);
mp_dispatch_unlock(ctx->mpctx->dispatch);
} That method is stopped calling // Grant exclusive access to the target thread's state. While this is active,
// no other thread can return from mp_dispatch_lock() (i.e. it behaves like
// a pthread mutex), and no other thread can get dispatch items completed.
// Other threads can still queue asynchronous dispatch items without waiting,
// and the mutex behavior applies to this function and dispatch callbacks only.
// The lock is non-recursive, and dispatch callback functions can be thought of
// already holding the dispatch lock.
void mp_dispatch_lock(struct mp_dispatch_queue *queue)
{
pthread_mutex_lock(&queue->lock); So the main thread is blocked trying to run a get property request on the playback thread. Maybe this particular video is causing trouble for the playback thread. |
@CarterLi I submitted a PR for IINA that has a simple workaround for iina#3211. Was not sure if we are currently holding off adding changes to IINA+ until we sort this issue? Or do you want me to add that fix? By the way Daniel on Telegram said nice things about IINA+ HDR support. @ViRo3 I've been hoping you would have time to see if you can reproduce the same problem in the mpv player. If mpv plays it without issues we focus more on how we are configuring mpv and interacting with it. If mpv has trouble that would explain our trouble trying to track down the problem. |
Like I said before, this repo is built for experimenting latest features / bug fixes that may not be very stable. You may just push your changes. We can revert the change if it causes serious issues. |
I was nervous due to the issues with my previous fix. This fix is small and should be safe. Just finished pushing it. |
I'm very sorry that I removed your commit with a force-push by accident. Can you push it again? |
Not a problem at all. I've pushed the fix to VideoView again. |
Can you build iina-plus yourself now? You may make a new release if necessary @low-batt |
It is painful for me to build the dependencies part as I operate under a limited account that does not have the access needed for brew, so I have to build that part under an admin account. I just tried and the build worked up to the very end which failed because it could not find create-dmg. I see some shell scripts with that name on GitHub. Where did you get it? |
The problem is still reproducible right now. Tested on version 1.2.0-22, 1.2.0-28 and 1.2.0-29. It's okay on IINA 1.2.0. |
Unfortunately freezes can be very senstive to the specific timing of hardware and configuration and the like. So far I've not been able to reproduce this hang which makes it much harder to debug. There is a ton of differences between IINA 1.2.0 and IINA+ builds. One major difference is that IINA+ uses the latest mpv. There are some known hangs in mpv. We are hoping someone can test and see if mpv is working fine on the same files or not just to confirm that it is something IINA is doing rather than something in the new mpv. Hangs are hard to debug. With a hang we always need a process sample. To take a process sample bring up the Activity Monitor while IINA is frozen. Select IINA in the Activity Monitor. Then under the View menu select Sample Process. That should create a report like you see above. From that we should be able to tell if you are hitting the same freeze or not. It might or might not provide an additional clue to the problem. |
I made more tests. It seems to be 100% reproducible for my environment, which is MBP M1 Pro. Testing clip is LG Earth Dolby Vision Demo, but it actually freezes on many of my clips, if not all. I tested mpv 0.34.1 prebuilt from here. It successfully quits without hangs or freezes. It's an x86_64 build. Sorry but I'm not able to find an arm64 binary distribution. I made a process sample and pasted the text to this gist. Config file used: profile=gpu-hq
icc-profile-auto=yes
gamma-auto=yes
sub-auto=fuzzy
sub-codepage=utf8:gb18030
osd-font='PingFangSC-Light'
sub-font='PingFangSC-Light'
autofit-larger=90%x80%
hwdec=auto Disable loading mpv config file doesn't help. |
Understood. As you can see from that mpv manual clip the mpv project has encountered a lot of problems with hardware drivers and takes a dim view of them. We seemed to have stumbled across one of the many issues. |
I hate parallelism. |
@low-batt Latest builds seem to Intel and not universal ? |
Warning. Dealing with a big winter storm. I'm totally exhausted from snow shoveling. This post might be incoherent... Thanks for telling me. I missed that. @CarterLi did not educate me on how to post a release. I was able to figure out some of it from GitHub documentation. Looking at the README I don't think he has been building a universal binary? At the end are links to GitHub actions, the CI build for the Intel binary and to the releases section for the Apple Silicon build. I missed that. The build I posted was from the GitHub CI build, seems to be Intel only. Not sure how CarterLi is creating the Apple Silicon build. Maybe building by hand on his machine? I could build one that way. It would only be good for macOS 12.1+ due to the build issue #31. I need to update my PRs in the main IINA repository with the fixes made to IINA+. Then I need to rebase IINA+ to remove the commits that were adding debug messages to avoid future merge conflicts when the fork is updated from the main. I also need to restore a bug fix that was pulled as we initially thought it might be causing this hang. Once I get that done I'll need to create a new IINA+ release. I'll be sure to post both versions when making that release. |
wow. Take it easy and slow, batt.No problem at all with you taking it slow. Really appreciate your efforts into the project and its sustenance along with the amazing responses as you work on them. |
Indeed. I'm investigating how to build universal binaries ( for 3rd party dylibs ). However before that, we must release them independently. For M1 version, we have to build them on our local machine. |
I'm currently trying to fix build issue #31. If that goes well I will release a new build and correctly post a M1 version. |
A new release has been published containing IINA+ built for Apple Silicon. |
@ViRo3 Can you please verify if the latest fix work for you? |
There are two bugs referenced here . The one related to iina has been; the other is mpv. |
The hang this issue was opened for has now been reproduced in mpv when hardware decoding is enabled. Using software decoding works. So this is an "upstream" issue for IINA. It might be an "upstream" issue for mpv as well as it appears to be a problem in the hardware drivers. I've added the upstream label. The second hang was a regression due to my changes to correct shutdown issues. That turned out to be two problems. I did not know how to trigger one of the ways you can quit IINA. Turns out you type "q" in the IINA window. The hang seems to be a problem in AppKit. A fix that corrects these problems has been merged into IINA+. @CarterLi, do you want leave "upstream" issues open? If not then this one can be closed. |
Lets leave them open for now |
When files are opened and closed successively, Iina freezes on opening a file and then doesn't respond.
System and IINA version:
Expected behavior:
Doesn't crash/freeze
Actual behavior:
Iina crashes and freezes on quickly opening and closing files.
Crash report:
Sample of IINA.txt
Spindump.txt
Spindump2.txt
Steps to reproduce:
Keep opening and closing a file (doesn't require much but 3 cycles for me)
How often does this happen?
Always
PS : File responsible hxxps://nyaa<.>si/view/1390968
The text was updated successfully, but these errors were encountered: