! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Segmentation fault whenever dialogue appears for more than ~1 second
Status:
RESOLVED: MOVED

Comments

Description Victor Engmark 2018-03-16 22:24:59 CET
Every time I copy, move or delete lots of files Thunar segfaults at the end of the operation.

This is easily reproducible (just did it twice in a row, moving files back and forth):

1. `cd -- "$(mktemp --directory)"`
2. `mkdir foo`
3. Create lots of files, for example with `touch {0..299}`
4. Open the directory in Thunar
5. Mark all the files (not the directory)
6. Press Ctrl-x
7. Navigate to the "foo" directory
8. Press Ctrl-v

Actual behaviour: Copies all the files and then crashes.

Expected behaviour: Shouldn't crash :)

Backtrace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f54821896d6 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
[Current thread is 1 (Thread 0x7f548356d980 (LWP 871))]
(gdb) bt
#0  0x00007f54821896d6 in  () at /usr/lib/libgtk-x11-2.0.so.0
#1  0x00007f5481c6ae1f in  () at /usr/lib/libgdk-x11-2.0.so.0
#2  0x00007f5481c6c180 in  () at /usr/lib/libgdk-x11-2.0.so.0
#3  0x00007f5481c6dc8a in  () at /usr/lib/libgdk-x11-2.0.so.0
#4  0x00007f5481c6dd2f in  () at /usr/lib/libgdk-x11-2.0.so.0
#5  0x00007f54800f3e38 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#6  0x00007f54800f4081 in  () at /usr/lib/libglib-2.0.so.0
#7  0x00007f54800f43b2 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#8  0x00007f5481ff3df3 in gtk_main () at /usr/lib/libgtk-x11-2.0.so.0
#9  0x000055f9a94eaf60 in  ()
#10 0x00007f547faf4f4a in __libc_start_main () at /usr/lib/libc.so.6
#11 0x000055f9a94eb0ba in  ()
Comment 1 Victor Engmark 2018-03-16 22:27:50 CET
PS: I believe this has been happening at least since September 2017, when I started using Thunar <https://github.com/l0b0/root/commit/1574fed43478d9dd26d9f6afa6564a97b1710946>.
Comment 2 Andre Miranda editbugs 2018-03-17 04:39:23 CET
Unfortunately I can't reproduce here with Thunar from master and 1.6.14, I have used touch {0..1000} and all three view modes (Icons, Detailed and Compact).
I know you opened the bug against 1.6.14, but could please confirm you're using this version? A couple of previous versions were crashing on simple file operations. Besides that, which distro are you running?
Comment 3 Victor Engmark 2018-03-17 04:47:35 CET
I'm using Arch Linux. Details:

$ thunar --version | head -1
Thunar 1.6.14 (Xfce 4.12)

$ uname --kernel-name --kernel-release --kernel-version --machine --processor --hardware-platform --operating-system
Linux 4.15.9-1-ARCH #1 SMP PREEMPT Sun Mar 11 17:54:33 UTC 2018 x86_64 unknown unknown GNU/Linux

$ cat ~/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml
<?xml version="1.0" encoding="UTF-8"?>

<channel name="thunar" version="1.0">
  <property name="last-view" type="string" value="ThunarDetailsView"/>
  <property name="last-icon-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_NORMAL"/>
  <property name="last-window-width" type="int" value="958"/>
  <property name="last-window-height" type="int" value="1178"/>
  <property name="last-window-maximized" type="bool" value="false"/>
  <property name="last-details-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_SMALLER"/>
  <property name="last-details-view-column-widths" type="string" value="50,151,50,50,965,50,50,81,200"/>
  <property name="misc-single-click" type="bool" value="false"/>
  <property name="misc-thumbnail-mode" type="string" value="THUNAR_THUMBNAIL_MODE_NEVER"/>
  <property name="misc-date-style" type="string" value="THUNAR_DATE_STYLE_ISO"/>
  <property name="last-separator-position" type="int" value="170"/>
  <property name="last-show-hidden" type="bool" value="false"/>
  <property name="last-sort-column" type="string" value="THUNAR_COLUMN_NAME"/>
  <property name="last-sort-order" type="string" value="GTK_SORT_ASCENDING"/>
</channel>
Comment 4 alexxcons editbugs 2018-03-17 19:29:56 CET
I just took a try with thunar 1.6.14 as well

used your xfconf configuration
touch {0..299} and later touch {0..1000}

However I cannot reproduce the bug.

It looks like something else is making the difference.

Can you reproduce the bug when thunar is started from command line, and when you quit any possible running thunar-daemon ?
thunar -q; thunar

Possibly you installed some extra thunar-plugins ?

Maybe a different filesystem ? I tested on ext4.

Could you generate and attach the coredump + the thunar binary used ?
Comment 5 alexxcons editbugs 2018-03-17 19:37:26 CET
When using touch {0..2000}, a spinner appears after the dialog for me and my CPU load goes max for some seconds ... possibly a performance issue.

- Can you reproduce the bug on other systems ?
Comment 6 Victor Engmark 2018-03-17 19:54:50 CET
I did reproduce it from the command line to see if there were any useful messages. This is the entire output (the warning pops up every time I change directory during normal use):

$ thunar -q; thunar

(thunar:5815): Gdk-WARNING **: gdk_window_set_icon_list: icons too large
Segmentation fault (core dumped)

I never used Thunar as a daemon.

No plugins are installed:

$ pacman --query | grep thunar
thunar 1.6.14-1

The crash is reproducible on tmpfs and encrypted EXT4 LVM:

$ df -h /tmp /home/$USER
Filesystem           Size  Used Avail Use% Mounted on
tmpfs                7.9G  2.0M  7.9G   1% /tmp
/dev/mapper/vg-home  111G   83G   23G  79% /home

$ mount | grep /home
/dev/mapper/vg-home on /home type ext4 (rw,relatime,data=ordered)

I'm able to reproduce with the commands I specified on both my laptop and desktop machine (including stopping any running Thunar instances beforehand). It might be relevant that even moving files is incredibly slow in Thunar. Moving the 300 files in the test takes about 3-4 seconds within the same tmpfs on both machines, which is kind of ludicrous.

My setup is mostly automated:

- Base install: https://l0b0.wordpress.com/2016/10/07/full-disk-encryption-with-arch-linux-footnotes/
- Software installed: https://github.com/l0b0/root/
- User configuration: https://github.com/l0b0/tilde/
Comment 7 Victor Engmark 2018-03-17 19:56:12 CET
Do you have somewhere I can put a 300 MB core dump?
Comment 8 Victor Engmark 2018-03-17 19:57:01 CET
Created attachment 7641 
Thunar binary
Comment 9 alexxcons editbugs 2018-03-17 20:20:01 CET
Thanks for the info !
Possibly the disk encryption makes a difference .. have to test that.
On a unencrypted ssd the movement of 300 files is something like 1-2 sec. for me ... did not compare with other file managers so far.

For the coredump, maybe this one would be an option: https://www.transfernow.net/ ?
Comment 10 Victor Engmark 2018-03-17 20:33:19 CET
Thanks! Core dump: https://www.transfernow.net/4aj3d4w2haab
Comment 11 Andre Miranda editbugs 2018-03-17 22:14:00 CET
Created attachment 7642 
patch

I was finally able to reproduce the bug after many attempts. However, I found an easier way to force the crash: keep switching between the target folder and its parent, Thunar will certainly crash.

These are the warnings messages it normally emits before crashing (not in this order):
(thunar:4043): GLib-GObject-WARNING **: invalid cast from 'GtkCssImageBuiltin' to 'ThunarFolder'
(thunar:4244): GLib-GObject-WARNING **: invalid cast from 'GtkCssTransition' to 'ThunarFolder'
(thunar:4170): GLib-GObject-WARNING **: invalid uninstantiatable type '(null)' in cast to 'ThunarFolder'
(thunar:4170): thunar-WARNING **: Content type loading failed for 370: Error when getting information for file “/tmp/tmp.KJj2GZa3j3/foo/370”: No such file or directory

And this is the backtrace (sometimes it segfaults at line 424):
#0  0x000055555559f2a9 in thunar_folder_content_type_loader_idle (data=<optimized out>) at thunar-folder.c:429
#1  0x00007ffff4c80ca6 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#2  0x00007ffff4c81081 in  () at /usr/lib/libglib-2.0.so.0
#3  0x00007ffff4c8110e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#4  0x00007ffff524696e in g_application_run () at /usr/lib/libgio-2.0.so.0
#5  0x000055555557ac8d in main (argc=2, argv=0x7fffffffe008) at main.c:165

My suspicion is that we're facing a race condition, where multiple threads are moving files, meanwhile Thunar is trying to update its view and then it uses an invalid reference to a folder.

I have prepared a patch that prevents crashes, but it acts on the problem effects, not on the cause, so CRITICAL messages are emitted. I just ask that you (Victor), if possible, could test it so we are sure to be on the right track.
Comment 12 alexxcons editbugs 2018-03-18 00:05:30 CET
Did not get any more info out of the coredump, anyhow thanks for sending it !
Offtopic, for next time: If you gzip the coredump it will shrink down to 3,8 MB
Comment 13 Victor Engmark 2018-05-06 00:03:50 CEST
Thank you Andre, that seems to have fixed it!

Build instructions for reproducibility and other testers:

1. The repo doesn't have build instructions. I found a build command in the thunar-git AUR package: ./autogen.sh     --prefix=/usr     --sysconfdir=/etc     --libexecdir=/usr/lib     --localstatedir=/var     --disable-static     --enable-gio-unix     --enable-dbus     --enable-startup-notification     --enable-gudev     --enable-exif     --enable-pcre     --enable-gtk-doc     --disable-debug
1. libxfce4ui-2 needs to be at least version 4.13.2 to build master.
1. There is no 1.6.15 tag on master. Found "thunar-1.6.15" it on the xfce-4.12 branch.
Comment 14 Git Bot editbugs 2018-07-29 22:36:59 CEST
Andre Miranda referenced this bugreport in commit 2f4a4dec0c4dde4db737e125247a9787edf5eded

Avoid segfault on file operations (Bug #14281)

https://git.xfce.org/xfce/thunar/commit?id=2f4a4dec0c4dde4db737e125247a9787edf5eded
Comment 15 Git Bot editbugs 2018-07-29 22:37:43 CEST
Andre Miranda referenced this bugreport in commit e124624880a470aa6ad807368b555cfbd39447ac

Avoid segfault on file operations (Bug #14281)

https://git.xfce.org/xfce/thunar/commit?id=e124624880a470aa6ad807368b555cfbd39447ac
Comment 16 Git Bot editbugs 2018-07-29 22:38:51 CEST
Andre Miranda referenced this bugreport in commit a754e7f95ea6080d72c6344670d14ab111062bf8

Avoid segfault on file operations (Bug #14281)

https://git.xfce.org/xfce/thunar/commit?id=a754e7f95ea6080d72c6344670d14ab111062bf8
Comment 17 Andre Miranda editbugs 2018-07-29 22:42:16 CEST
@Victor, sorry for the delay, I haven't had the time to check this again, for now the stopgap will do.
Let's keep this bug open until a proper fix is released.
And thanks for reporting and testing!
Comment 18 Git Bot editbugs 2020-05-26 23:35:00 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/thunar/-/issues/192.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #14281

Reported by:
Victor Engmark
Reported on: 2018-03-16
Last modified on: 2020-05-26

People

Assignee:
Xfce Bug Triage
CC List:
5 users

Version

Version:
1.6.14

Attachments

Thunar binary (660.88 KB, application/octet-stream)
2018-03-17 19:57 CET , Victor Engmark
no flags
patch (696 bytes, patch)
2018-03-17 22:14 CET , Andre Miranda
no flags

Additional information