Control: affects -1 + gdk-pixbuf Il 22/10/2021 05:21, Johan Croft ha scritto:
Thanks for your contribution, I don't have time to look better to this now, I think will be better to check on gdk-pixbuf if a better fix is needed on itHello,I decided to take another shot at this and I still can't believe it, but I actually ended up fixing it.Hooking a debugger to Nemo and stopping it in the middle of the freeze shows that it's hanging inside libgdk_pixbuf-2.0.so. More specifically, once Nemo calls gdk_pixbuf_loader_write() inside get_pixbuf_for_content() (in nemo-directory-async.c) the function takes a very long time to return or never returns at all for very large GIFs. Most likely, this means there's a regression inside libgdk_pixbuf-2.0.so, which also makes sense in the context of my original report: the bug is present in Debian 11 and Arch (both use version 2.42), but not in Debian 10 (which uses version 2.38) nor in Mint 20.1 (which uses version 2.40). The code of get_pixbuf_for_content() between Debian and Mint's source packages is also the same, and doesn't change for Nemo 5.0.3 either, so the whole picture is congruent. I tried "forward-porting" Buster's libgdk_pixbuf just for confirmation, but unfortunately that doesn't seem compatible with the rest of the system.When looking at get_pixbuf_for_content(), there's a comment mentioning the need to call gdk_pixbuf_loader_write() with chunks of the file to process, however Nemo's implementation doesn't actually do this and shoves the whole file in one go at gdk_pixbuf_loader_write() which then seems to choke on it. Making slight adjustments so that the file is actually served in chunks as the comment mentions actually fixes the whole issue. I recompiled Nemo with such changes and the fix seems to hold.Nemo's original get_pixbuf_for_content() is pretty self-contained so it can be extracted into a standalone program of just a handful of lines as a minimal reproducible example. I did it and tried it both on Debian 11 and Mint 20.1 and the behavior is as expected: it freezes on Debian but works on Mint. I also tested the changes in this way to take time measurements for different chunk sizes and compare performance between the fixed version and the original one on Mint.I'm attaching a patch for Nemo's get_pixbuf_for_content() as well as the examples mentioned (which aren't very nice, but should be good enough to illustrate). I hope this is useful. This is my first time reporting an issue on and making a submission to an open source project, so I apologize if something doesn't turn out to be tidy enough.My only other question is whether there's any chance of seeing this properly fixed for Bullseye in some way in the future.
Description: OpenPGP public key
Description: OpenPGP digital signature