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

Crash with empty artwork file mask #1079

Closed
Oleksiy-Yakovenko opened this issue Mar 12, 2015 · 5 comments
Closed

Crash with empty artwork file mask #1079

Oleksiy-Yakovenko opened this issue Mar 12, 2015 · 5 comments
Labels

Comments

@Oleksiy-Yakovenko
Copy link
Member

Original issue 1177 created by Alexey-Yakovenko on 2014-08-18T13:34:25.000Z:

What steps will reproduce the problem?
Какие шаги приводят к воспроизведению
проблемы?

  1. Open artwork preferences
  2. Delete the file mask
  3. Change and apply some prefs a few times

What is the expected output? What do you see instead?
Какой ожидаемый вывод? Что вы видите
вместо него?
Eventually will crash

What version of the product are you using? On what operating system and CPU
architecture?
Какую версию продукта вы используете? На
какой операционной системе и
архитектуре CPU?
0.6.2
Crunchbang Linux
Pentium 4

How did you install the product?
Как вы установили продукт?
Static build

Please provide any additional information below.
Пожалуйста, предоставьте любую
дополнительную информацию ниже.
This is caused by files_count being uninitialised when declared. If the file mask is empty then the custom filter scandir is never called and files_count is still uninitialised. If files_count is not zero then the jpeg mask is never called and the dirent files array is referenced even though it is still NULL (or worse!).

The fix is trivial, just set files_count to zero when declared. I've done this in my working copy along with some other fixes, but maybe this should be released immediately? Or slightly more fancy, set the mask to the default if it is empty?

@Oleksiy-Yakovenko
Copy link
Member Author

Comment #1 originally posted by Alexey-Yakovenko on 2014-08-18T13:44:56.000Z:

Great, thanks for the detailed description, etc, but wouldn't it have been easier to just submit a patch? :)

@Oleksiy-Yakovenko
Copy link
Member Author

Comment #2 originally posted by Alexey-Yakovenko on 2014-08-18T15:16:25.000Z:

I will at some point, but if it is an immediate problem then I have an immediate solution.

Do you think resetting a blank mask to the default makes sense? An empty mask is almost equivalent to setting the checkbox off. An empty mask actually still searches for *.jpg and *.jpeg, but that isn't obvious to the users.

@Oleksiy-Yakovenko
Copy link
Member Author

Comment #3 originally posted by Alexey-Yakovenko on 2014-08-18T19:52:06.000Z:

Hey, attachments allowed again. Make my day! Here's a quick patch to fix the crash.

Still lots of ideas:

  • blanking the mask sets it back to the default;
  • symlinking local files instead of copying them;
  • only retrying http fetches for missing files every hour or so, and maybe only retrying local searches at a shorter interval, but not many times a second as now;
  • still don't know what an API between decoders and artwork (for non-junk tags) should look like.

Also spotted a possible (well, pretty certain, but not tested yet) memory leak in the file globbing code. The individual array strings from scandir are freed but not the array itself. Will add a fix to my development version.

@Oleksiy-Yakovenko
Copy link
Member Author

Comment #4 originally posted by Alexey-Yakovenko on 2014-08-18T20:29:23.000Z:

I forgot to mention ideas for cache cleanup ...

When artwork is unavailable, an empty directory is still created. Might become moot if unavailable artwork needs to be tracked to avoid too many lookups.

Even invalidated cache files still remain on disk forever. No imminent nightmare, but they should probably be culled when they're thoroughly expired. Would probably need to be done on a separate thread, slowly.

@Oleksiy-Yakovenko
Copy link
Member Author

Comment #5 originally posted by Alexey-Yakovenko on 2014-08-18T20:34:07.000Z:

This will have to become a sort of garbage collector. Or just add an explicit button to delete all expired files, with a progress bar. A topic for a separate bug/request though. Closing this one, the patch is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant