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

Crashes while going through a large library in multithreaded mode can lead to data loss. #50

Closed
Mihara opened this issue Jan 19, 2023 · 5 comments

Comments

@Mihara
Copy link

Mihara commented Jan 19, 2023

When rsgain stumbles into a damaged unplayable file -- which do exist in sufficiently large libraries -- it's liable to segfault:

[102904.055817] rsgain[277209]: segfault at 0 ip 00007fd13ca704d3 sp 00007ffd20513768 error 4 in libswresample.so.3.5.100[7fd13ca60000+16000]
[102904.055840] Code: 00 00 0f 85 59 ff ff ff 48 8d 34 96 48 8d 0c 91 48 8d 3c 97 48 f7 da 66 0f 6f 2d d8 80 00 00 66 0f 6f 04 96 66 0f 6f 4c 96 10 <66> 0f 6f 14 91 66 0f 6f5c 91 10 0f 59 c5 0f 59 cd 0f 59 d5 0f 59

Unfortunately, if that happens while it's running in multithreaded mode, and the other thread is saving replaygain tags, the crash can lose you data -- unrelated, undamaged files get renamed.

It would be nice if this sort of segfault was caught and damaged files reported instead, because that makes multithreaded mode unusable.

@complexlogic
Copy link
Owner

Based on your log, the segfault is occurring in the FFmpeg library swresample. Do you know which file is causing the segfault? Are you able to reproduce it?

@Mihara
Copy link
Author

Mihara commented Jan 19, 2023

I have since (foolishly) deleted all the files on which it choked, but I've just started a full re-generation of replaygain in my library. If it trips on one that was previously ignored because it already had replaygain tags, I'll get back to you with it, but I can't make any promises otherwise.

@Mihara
Copy link
Author

Mihara commented Jan 19, 2023

...Alas, no other files which crashed rsgain were found. ☹️

@Mihara
Copy link
Author

Mihara commented Jan 21, 2023

...And then I suddenly acquired a new file on which rsgain always segfaults. :)

https://transfer.sh/JO59AY/foo.mp3

Beware, this link has an expiration date.

@complexlogic
Copy link
Owner

@Mihara Thanks for that file. I was able to reproduce the segfault.

After investigation, I believe this is a bug in FFmpeg as I had previously suspected. The decoder is giving a corrupt audio frame without returning an error code. Nevertheless, I was able to implement a workaround to detect corrupt audio frames and ignore them c27fa5e.

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

2 participants