-
-
Notifications
You must be signed in to change notification settings - Fork 975
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
ugoira conversion: ffmpeg process sometimes becomes stopped on linux, making gallery-dl hang #2296
Comments
Have you tried adding gallery-dl/gallery_dl/postprocessor/ugoira.py Line 163 in b17e2dc
or just -y to the arguments for ffmpeg?
I doubt this has any effect if
Same. I think this is the first time I have heard about |
Haven't tried the stdin=subprocess.DEVNULL thing but my guess would be that it would have solved the problem on the system where |
Added a global In a configuration file this options needs to be set at the top level, i.e. the same level as As a command-line option, |
Thanks, I think this can be closed now. |
On some ugoiras, the ffmpeg process can become "stopped" on Linux, making gallery-dl hang and never finish the conversion. It does not seem to be reliably reproducable, but I think I found the root cause.
My ugoira postprocessor config:
On my PC, the problem occurs on this ugoira:
https://www.pixiv.net/en/artworks/88748768
Looking in the process manager, I see that the process has become "stopped" for some reason (gallery-dl is called from another Python script here, from a thread started with
daemon=True
, which might or might not be relevant):Attaching to it with
strace
, I get:I redirect the output of gallery-dl, and thus ffmpeg, into a file, which ends like this when the hang occurs:
Nothing obviously wrong here.
Looking up SIGTTOU:
Can't say I fully understand, but seems like it has to do with writing to the terminal. However, ffmpeg-output is set to true (the default) in the gallery-dl config, which means it will be redirected to gallery-dl's stdout, which I redirect to a file.
However, further searching I find that:
So I try adding
-nostdin
to the ffmpeg args in gallery-dl config, and the issue seems to be fixed. If I remove it, ffmpeg hangs again.So this seems to be the root cause. I have no idea what ffmpeg is trying to do with stdin, especially that I don't see any prompt in the stdout, but adding this option fixed it, whatever it was. I think it should be part of the default config.
Update
On another PC, the above
-nostdin
fix was not enough. We tried various things like turning off job control and playing around with tty flags that should have prevented SIGTTOU, but for some reason none of it helped. Something must be different in the configuration between systems, but I do not know what, or even why these signals were sent.What ended up helping in the end is adding
signal.signal(signal.SIGTTOU, signal.SIG_IGN)
to the script that starts gallery-dl (I guess this is then inherited by child processes). This is a more drastic solution than the ffmpeg flag above, but I think it might still be worth adding to gallery-dl itself, probably behind a configuration flag (and also doing the same for SIGTTIN).The text was updated successfully, but these errors were encountered: