elementary / files

File browser designed for elementary OS

Home Page:https://elementary.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Crash]Switching to View as Grid with large thumbnails and containing a link to an image crashes Files

peteruithoven opened this issue · comments

What Happened?

When I switch Files from List view to Grid view from a folder with a lot of Files it crashes. No issue when switching from a folder with just a few files.
For example my Downloads (24 folders, 666 other items) or Screenshots (518 items) folders.
Switching from Grid to List or Columns view or between List and Column view is no problem.
When in Grid view view navigating from and to these folders is no problem.

No that's I'm not switching fast. I'm in a fully settles List view, then press the View as Grid view once. So this is probably not a duplicate of #2075

Steps to Reproduce

  1. Open a folder with a lot of files
  2. Make sure you're in List or Columns view
  3. Switch to Grid view

Expected Behavior

Files doesn't crash.

OS Version

7.x (Horus)

Software Version

Latest release (I have run all updates)

Log Output

Using gdb:

#0  0x00007ffff7f20f0c in files_abstract_slot_get_current_slot () at /lib/x86_64-linux-gnu/libpantheon-files-core.so.6
#1  0x00007ffff7f213d0 in files_abstract_slot_get_directory () at /lib/x86_64-linux-gnu/libpantheon-files-core.so.6
#2  0x00005555555b4a9f in  ()
#3  0x00005555555a8fdd in  ()
#4  0x00007ffff7e11c44 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff7e67258 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007ffff7e0f3e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007ffff7c63fb5 in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#8  0x0000555555589963 in main ()

Hardware Info

No response

When you say "crashes" do you mean "hangs"? The posted backtrace does not seem to show a segfault or other error?

The gridview is notoriously slow in displaying more than a few thousand files.

Ah, OK - I have confirmed it does crash switch from ListView to GridView but not vice versa. This is a regression.
Using a folder with 2000 0byte files.

Also switching from Column View to GridView (but not ColumnView to ListView or vice versa).

My backtrace:

Thread 1 "io.elementary.f" received signal SIGSEGV, Segmentation fault.
0x00007ffff7ed2849 in files_abstract_slot_get_current_slot (self=0x555555d33740) at ../libcore/AbstractSlot.vala:101
101	        public abstract unowned AbstractSlot? get_current_slot ();
(gdb) bt
#0  0x00007ffff7ed2849 in files_abstract_slot_get_current_slot (self=0x555555d33740) at ../libcore/AbstractSlot.vala:101
#1  0x00007ffff7ed342c in files_abstract_slot_get_directory (self=0x555555d33740) at ../libcore/AbstractSlot.vala:26
#2  0x00005555555da79b in files_abstract_directory_view_update_thumbnail_info_and_plugins (self=0x555555dfbbe0, file=0x555555ec15c0) at ../src/View/AbstractDirectoryView.vala:2831
#3  0x00005555555ce7b8 in __lambda82_ (_data29_=0x5555558a5540) at ../src/View/AbstractDirectoryView.vala:1370
#4  0x00005555555ce8fb in ___lambda82__gsource_func (self=0x5555558a5540) at /home/jeremy/Elementary/files/build/AbstractDirectoryView.c:8090
#5  0x00007ffff7dbdc44 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007ffff7e13258 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007ffff7dbb3e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007ffff7c0ffb5 in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#9  0x00005555555977e1 in _vala_main (args=0x7fffffffddc8, args_length1=1) at ../src/main.vala:28
#10 0x0000555555597828 in main (argc=1, argv=0x7fffffffddc8) at ../src/main.vala:16

Not obvious why the behaviour is asymmetric since the crash occurs in code shared by all views 🤷

Investigating this, I now cannot reproduce with a folder containing 2000 files, although no relevant changes appear to have been made. With a folder containing 20,000 files it crashed with a different error. but only if I switched views before GridView completed drawing. Investigating further ...

@peteruithoven Could you confirm that you are still experiencing this after the latest system updates? And what the version of Files running is with io.elementary.files --version? I now cannot reproduce.

Yes I'm afraid I still experience this.

$ io.elementary.files --version
io.elementary.files 6.5.2

More details on the Screenshots where it happens:

  • 540 files
  • 380MB total
  • No and later 1 folder.
  • Files ranging from 5.2MB to a few bytes

I had some some very big png files 2x 20.8MB and 2x 14.3 MB files in the folder and a 0 bytes file, all of which I moved into a folder, but that seems to make no difference.

I was thinking of sharing the files, but there is some sensitive, work related stuff in there.

@peteruithoven Strange. 540 files is not that many and filesize should not matter. Might be worth purging the pantheon-files package then reinstalling (which is what I did to make sure no development version was interfering). Kill any persisting pantheon-files processes before reopening.

I used htop to kill any running elementary.files processes. I could not find pantheon-files processes.
Then ran:

sudo apt purge pantheon-files
sudo apt install pantheon-files  --reinstall

Still happens.

GDB output:

Starting program: /usr/bin/io.elementary.files 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2dff640 (LWP 244711)]
[New Thread 0x7ffff25fe640 (LWP 244712)]
[New Thread 0x7ffff1dfd640 (LWP 244713)]
[New Thread 0x7ffff15bb640 (LWP 244714)]
[New Thread 0x7fffe3fff640 (LWP 244716)]
[Thread 0x7fffe3fff640 (LWP 244716) exited]
[New Thread 0x7fffe3fff640 (LWP 244717)]
[New Thread 0x7fffe33ff640 (LWP 244718)]
[Thread 0x7fffe3fff640 (LWP 244717) exited]
[Thread 0x7fffe33ff640 (LWP 244718) exited]
[New Thread 0x7fffe33ff640 (LWP 244720)]
[New Thread 0x7fffe3fff640 (LWP 244721)]
[Thread 0x7fffe33ff640 (LWP 244720) exited]
[Thread 0x7fffe3fff640 (LWP 244721) exited]
[New Thread 0x7fffe3fff640 (LWP 244723)]
[New Thread 0x7fffe33ff640 (LWP 244724)]
[Thread 0x7fffe3fff640 (LWP 244723) exited]
[Thread 0x7fffe33ff640 (LWP 244724) exited]
[New Thread 0x7fffe33ff640 (LWP 244725)]
[New Thread 0x7fffe3fff640 (LWP 244726)]
[New Thread 0x7fffe15ff640 (LWP 244728)]
[New Thread 0x7fffe0dfe640 (LWP 244729)]
[New Thread 0x7fffd61ff640 (LWP 244730)]
[New Thread 0x7fffd59fe640 (LWP 244731)]
[Thread 0x7fffe15ff640 (LWP 244728) exited]
[Thread 0x7fffd59fe640 (LWP 244731) exited]
[Thread 0x7fffe0dfe640 (LWP 244729) exited]
[Thread 0x7fffe33ff640 (LWP 244725) exited]
[Thread 0x7ffff15bb640 (LWP 244714) exited]
[Thread 0x7fffe3fff640 (LWP 244726) exited]
[New Thread 0x7fffe3fff640 (LWP 244736)]
[New Thread 0x7ffff15bb640 (LWP 244737)]
[New Thread 0x7fffd59fe640 (LWP 244738)]
[New Thread 0x7fffe0dfe640 (LWP 244739)]
[New Thread 0x7fffe33ff640 (LWP 244740)]
[Thread 0x7fffe33ff640 (LWP 244740) exited]
[Thread 0x7fffe0dfe640 (LWP 244739) exited]
[Thread 0x7ffff15bb640 (LWP 244737) exited]
[Thread 0x7fffe3fff640 (LWP 244736) exited]
[Thread 0x7fffd61ff640 (LWP 244730) exited]
[New Thread 0x7fffe3fff640 (LWP 244744)]
[New Thread 0x7fffe33ff640 (LWP 244745)]
[New Thread 0x7ffff15bb640 (LWP 244746)]
[Thread 0x7ffff15bb640 (LWP 244746) exited]
[Thread 0x7fffe3fff640 (LWP 244744) exited]
[Thread 0x7fffd59fe640 (LWP 244738) exited]
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug


(io.elementary.files:244708): Gtk-CRITICAL **: 19:22:29.613: gtk_widget_queue_draw_area: assertion 'width >= 0' failed

(io.elementary.files:244708): Gtk-CRITICAL **: 19:22:29.613: gtk_widget_queue_draw_area: assertion 'width >= 0' failed

Thread 1 "io.elementary.f" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f20f18 in files_abstract_slot_get_current_slot () from /lib/x86_64-linux-gnu/libpantheon-files-core.so.6
(gdb) bt
#0  0x00007ffff7f20f18 in files_abstract_slot_get_current_slot () at /lib/x86_64-linux-gnu/libpantheon-files-core.so.6
#1  0x00007ffff7f213d0 in files_abstract_slot_get_directory () at /lib/x86_64-linux-gnu/libpantheon-files-core.so.6
#2  0x00005555555b4a9f in  ()
#3  0x00005555555a8fdd in  ()
#4  0x00007ffff7e11c44 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff7e67258 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007ffff7e0f3e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007ffff7c63fb5 in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#8  0x0000555555589963 in main ()

@peteruithoven Thanks for trying! Yes, sorry the package is pantheon-files but the process is io.elementary.files which is confusing. At some point we will have to get the package renamed. I have tried constructing a picture folder containing a similar number of files to you and tried various sort orders but without getting any crashes. Perhaps a race condition that depends on hardware factors? I'll study the code to see if I can spot anything.

Running a 13" Framework laptop.
i7-1185G7
32GB Memory
1TB Storage
13.5" 3:2 2256x1504
No dedicated graphics card.

Do you think there is a way to possibly hone into a specific file that might be causing this?

I'll try removing all files and see when it starts happening, maybe I can hone into something that way.

It looks like a source or signal handler is using slot.directory after it has been destroyed in both your and my backtraces. However, my backtrace has an extra line so I am not sure they are due to the same issue. I'll try armoring the code against the issue in my backtrace and see whether it fixes your problem.

@peteruithoven I have pushed a PR addressing one possible cause of your problem. If you are able to build and test this that would be helpful, thanks.

Yeah happy to 👍
I checked out the branch, build and installed it.
I'm afraid it still crashes.

GDB logs:

Starting program: /usr/bin/io.elementary.files 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2dff640 (LWP 272821)]
[New Thread 0x7ffff25fe640 (LWP 272822)]
[New Thread 0x7ffff1dfd640 (LWP 272823)]
[New Thread 0x7ffff1579640 (LWP 272824)]
[New Thread 0x7fffe3fff640 (LWP 272825)]
[Thread 0x7fffe3fff640 (LWP 272825) exited]
[New Thread 0x7fffe3fff640 (LWP 272826)]
[New Thread 0x7fffe33ff640 (LWP 272827)]
[Thread 0x7fffe3fff640 (LWP 272826) exited]
[Thread 0x7fffe33ff640 (LWP 272827) exited]
[New Thread 0x7fffe33ff640 (LWP 272828)]
[New Thread 0x7fffe3fff640 (LWP 272829)]
[Thread 0x7fffe33ff640 (LWP 272828) exited]
[Thread 0x7fffe3fff640 (LWP 272829) exited]
[New Thread 0x7fffe3fff640 (LWP 272830)]
[New Thread 0x7fffe33ff640 (LWP 272831)]
[Thread 0x7fffe3fff640 (LWP 272830) exited]
[Thread 0x7fffe33ff640 (LWP 272831) exited]
[New Thread 0x7fffe33ff640 (LWP 272832)]
[New Thread 0x7fffe3fff640 (LWP 272833)]
[New Thread 0x7fffe15ff640 (LWP 272834)]
[New Thread 0x7fffe0dfe640 (LWP 272835)]
[New Thread 0x7fffd61ff640 (LWP 272836)]
[New Thread 0x7fffd59fe640 (LWP 272837)]
[New Thread 0x7fffd51fd640 (LWP 272838)]
[New Thread 0x7fffd49fc640 (LWP 272839)]
[Thread 0x7fffd59fe640 (LWP 272837) exited]
[Thread 0x7fffd49fc640 (LWP 272839) exited]
[Thread 0x7fffe3fff640 (LWP 272833) exited]
[Thread 0x7fffd61ff640 (LWP 272836) exited]
[Thread 0x7ffff1579640 (LWP 272824) exited]
[Thread 0x7fffe0dfe640 (LWP 272835) exited]
[Thread 0x7fffd51fd640 (LWP 272838) exited]
[Thread 0x7fffe33ff640 (LWP 272832) exited]

Thread 1 "io.elementary.f" received signal SIGSEGV, Segmentation fault.
0x00007ffff7ed9849 in files_abstract_slot_get_current_slot (self=0x555555e06df0) at ../libcore/AbstractSlot.vala:101
101	        public abstract unowned AbstractSlot? get_current_slot ();
(gdb) bt
#0  0x00007ffff7ed9849 in files_abstract_slot_get_current_slot (self=0x555555e06df0) at ../libcore/AbstractSlot.vala:101
#1  0x00007ffff7eda42c in files_abstract_slot_get_directory (self=0x555555e06df0) at ../libcore/AbstractSlot.vala:26
#2  0x00005555555da69a in files_abstract_directory_view_update_thumbnail_info_and_plugins (self=0x555555ed0730, file=0x555556147c90)
    at ../src/View/AbstractDirectoryView.vala:2826
#3  0x00005555555ce7aa in __lambda82_ (_data29_=0x5555558cf900) at ../src/View/AbstractDirectoryView.vala:1370
#4  0x00005555555ce80b in ___lambda82__gsource_func (self=0x5555558cf900)
    at /home/peteruithoven/Projects/elementaryOS/files/build/AbstractDirectoryView.c:8017
#5  0x00007ffff7dc4c44 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007ffff7e1a258 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007ffff7dc23e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007ffff7c16fb5 in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#9  0x00005555555977e1 in _vala_main (args=0x7fffffffdc68, args_length1=1) at ../src/main.vala:28
#10 0x0000555555597828 in main (argc=1, argv=0x7fffffffdc68) at ../src/main.vala:16

I no longer see the pixman error and gtk_widget_queue_draw_area: assertion 'width >= 0' failed, so this might be an improvement even when it doesn't solve the issue I'm experiencing.

I think I might have a lead! I have a "link to PNG image" type file in the folder. After removing it Files no longer crashes when switching to Grid view.
Screenshot from 2023-10-08 21 27 29@2x

If I remove all files, except that link it crashes.

Reproduction:

  1. Create a new folder
  2. Add the screenshot from this comment
  3. Alt drag then release the file to create a link
  4. Make sure you're in List or Column view
  5. Switch to Grid view

OK, I have now reproduced the crash - but only if the thumbnail size is above a certain size (which is probably why I could not before). So there are two preconditions:

  • The folder contains a link to an image
  • The thumbnail size is set to"large" (one of the two largest sizes) in the IconView (it is clamped in the List View to smaller sizes)

With this info I should be able to find a fix. Thanks for your investigating!

@peteruithoven I have pushed a simpler PR that fixes this issue for me.

Yes perfect, that solves the issue for me 🎉
And the code change is even much simpler.