! 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 !
Hangs when Places/Bookmark target is autofs and doesn't exist/not available
Status:
RESOLVED: DUPLICATE

Comments

Description Tj 2019-08-06 18:43:29 CEST
Experiencing this on Xubuntu 18.04, This affects Thunar 1.6.15 and is also reproduced in Xubuntu 19.10 daily LiveISO with Thunar 1.8.6-0ubuntu1.

Seems to be related to #12467 and #12265.

I get this for 2 scenarios:

1. Having previously added GTK3 bookmarks (Places) that point to autofs mount-points I start Thunar when the mount target is not available / does not exist
2. An autofs network CIFS share previously added as GTK3 bookmark (Places) that isn't reachable

Can be reproduced using a couple of systemd unit files that (for testing) point to a non-existent device target.

The problem is Thunar, or the underlying gvfs backend, are repeatedly retrying every 5 to 10 seconds or so and Thunar isn't responsive to the operator.

Steps:

$ sudo mkdir /mnt/test


# Now start Thunar and create a bookmark (Place) by dragging /mnt/test/ to the Places area.
# Close/quit Thunar
# Create unit files that will use autofs - note that /dev/sdz2 is almost guaranteed not to exist which is what we need

$ systemctl cat mnt-test.{,auto}mount
# /run/systemd/system/mnt-test.mount
[Unit]
Description=Test Mount

[Mount]
What=/dev/sdz2
Where=/mnt/test
DirectoryMode=0750

# /run/systemd/system/mnt-test.automount
[Unit]
Before=local-fs.target
Before=mnt-test.mount

[Automount]
Where=/mnt/test
DirectoryMode=0750
TimeoutIdleSec=60

$ sudo mkdir /run/systemd/system/local-fs.target.wants
$ sudo ln -s ../mnt-test.automount /run/systemd/system/local-fs.target.wants/

$ sudo systemctl daemon-reload
$ sudo systemctl restart local-fs.target

Start Thunar and try to use it. With 1.8.6 it hangs even before drawing its window resulting in the window showing the desktop background. Watching the logs it shows a thread belonging to Thunar repeatedly triggering a mount attempt on the non-existent device. I used strace to see that it is trying to open() the directory.

$ journalctl -f 

Aug 06 16:23:09 xubuntu systemd[1]: mnt-test.automount: Got automount request for /mnt/test, triggered by 3644 (gmain)
Aug 06 16:24:39 xubuntu systemd[1]: dev-sdz2.device: Job dev-sdz2.device/start timed out.
Aug 06 16:24:39 xubuntu systemd[1]: Timed out waiting for device /dev/sdz2.
Aug 06 16:24:39 xubuntu systemd[1]: Dependency failed for Test Mount.
Aug 06 16:24:39 xubuntu systemd[1]: mnt-test.mount: Job mnt-test.mount/start failed with result 'dependency'.
Aug 06 16:24:39 xubuntu systemd[1]: dev-sdz2.device: Job dev-sdz2.device/start failed with result 'timeout'.
Aug 06 16:24:39 xubuntu systemd[1]: mnt-test.automount: Got automount request for /mnt/test, triggered by 3644 (gmain)
Aug 06 16:26:09 xubuntu systemd[1]: dev-sdz2.device: Job dev-sdz2.device/start timed out.
Aug 06 16:26:09 xubuntu systemd[1]: Timed out waiting for device /dev/sdz2.
Aug 06 16:26:09 xubuntu systemd[1]: Dependency failed for Test Mount.
Aug 06 16:26:09 xubuntu systemd[1]: mnt-test.mount: Job mnt-test.mount/start failed with result 'dependency'.
Aug 06 16:26:09 xubuntu systemd[1]: dev-sdz2.device: Job dev-sdz2.device/start failed with result 'timeout'.
Aug 06 16:26:09 xubuntu systemd[1]: mnt-test.automount: Got automount request for /mnt/test, triggered by 3644 (gmain)
...

The same occurs for an autofs CIFS mount that is only accessible over a VPN. When the VPN is not available journalctl shows Thunar repeatedly trying to access it when it is added as a GTK3 bookmark in Places.

From /etc/fstab:

//S1023760.slbs.local/Data$ /mnt/SLBS/Data cifs noauto,_netdev,uid=1000,gid=1000,credentials=/home/tj/.config/SLBS.cifs.creds,x-systemd.automount,x-systemd.idle-timeout=120,x-systemd.device-timeout=2

$ systemctl cat mnt-SLBS-Data.{,auto}mount
# /run/systemd/generator/mnt-SLBS-Data.mount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)

[Mount]
Where=/mnt/SLBS/Data
What=//S1023760.slbs.local/Data$
Type=cifs
Options=noauto,_netdev,uid=1000,gid=1000,credentials=/home/tj/.config/SLBS.cifs.creds,x-systemd.automount,x-systemd.idle-timeout=120

# /run/systemd/generator/mnt-SLBS-Data.automount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Before=remote-fs.target

[Automount]
Where=/mnt/SLBS/Data
TimeoutIdleSec=2min
Comment 1 alexxcons editbugs 2019-08-06 23:40:19 CEST
Thanks for reporting & for the detailed reproducer !  I'll take a try for it when I have some free time !
(Please feel free to further debug thunar, if you can ... currently I am a bit busy with reallife )
Comment 2 Tj 2019-08-07 12:24:26 CEST
For debugging I'm working from Xubuntu 18.04 so this backtrace and strace are from v1.6.15 but for the purpose of identifying what is going on I don't think it makes much difference.

The traces were captured just after Thunar was started and had hung without drawing its content window.  There's an attempt to access the currently disconnected/unreachable autofs CIFS mount to /mnt/SLBS/Data which is triggering repeated autofs mount attempts (reported by journalctl -f).


$ gdb --args /usr/bin/thunar /tmp/test
...
(gdb) bt full

#0  0x00007ffff45f82d7 in inotify_add_watch () at ../sysdeps/unix/syscall-template.S:78
#1  0x00007ffff5165e95 in _ik_watch (path=<optimised out>, mask=mask@entry=16789454, err=err@entry=0x7fffffffd534)
    at ../../../../../gio/inotify/inotify-kernel.c:425
        wd = -1
        __func__ = "_ik_watch"
#2  0x00007ffff51669d2 in _ip_start_watching (sub=sub@entry=0x5555558756d0) at ../../../../../gio/inotify/inotify-path.c:264
        wd = <optimised out>
        err = 0
        dir = 0x0
        __func__ = "_ip_start_watching"
#3  0x00007ffff51673a8 in _ih_sub_add (sub=0x5555558756d0) at ../../../../../gio/inotify/inotify-helper.c:107
#4  0x00007ffff513a8a6 in g_local_file_monitor_start (local_monitor=local_monitor@entry=0x7fffe0013690 [GInotifyFileMonitor], filename=filename@entry=0x555555c5aca0 "/mnt/SLBS/Data", is_directory=is_directory@entry=1, flags=flags@entry=(G_FILE_MONITOR_WATCH_MOUNTS | G_FILE_MONITOR_SEND_MOVED), context=0x0) at ../../../../gio/glocalfilemonitor.c:789
        class = 0x555555b8a000
        __func__ = "g_local_file_monitor_start"
#5  0x00007ffff513a9f6 in g_local_file_monitor_new_for_path (pathname=0x555555c5aca0 "/mnt/SLBS/Data", is_directory=1, flags=(G_FILE_MONITOR_WATCH_MOUNTS | G_FILE_MONITOR_SEND_MOVED), error=<optimised out>) at ../../../../gio/glocalfilemonitor.c:873
        monitor = 0x7fffe0013690 [GInotifyFileMonitor]
        is_remote_fs = <optimised out>
#6  0x00005555555914e7 in thunar_file_watch (file=0x555555c37420 [ThunarFile]) at thunar-file.c:3898
        file_watch = 0x5555558ee7b0
        error = 0x0
#7  0x00005555555bb7f1 in thunar_shortcuts_model_add_shortcut_with_path (model=0x5555559246a0 [ThunarShortcutsModel], shortcut=0x7fffe0013630, path=0x0) at thunar-shortcuts-model.c:1137
        iter = {stamp = 0, user_data = 0x3, user_data2 = 0x7fffe0013630, user_data3 = 0x555555c37420}
        sorted_path = 0x0
#8  0x00005555555d91b2 in thunar_util_load_bookmarks (bookmarks_file=<optimised out>, foreach_func=foreach_func@entry=0x5555555bc980 <thunar_shortcuts_model_load_line>, user_data=user_data@entry=0x5555559246a0) at thunar-util.c:235
        bookmarks_path = <optimised out>
        line = "file:///mnt/SLBS/Data\000"
        name = 0x0                                                                                                                        
        space = <optimised out>                                                                                                           
        fp = 0x555555c39c00                                                                                                               
        row_num = 4
        file = 0x55555588a200
#9  0x00005555555bc958 in thunar_shortcuts_model_load (data=<optimised out>) at thunar-shortcuts-model.c:1302
        model = 0x5555559246a0 [ThunarShortcutsModel]
#10 0x00007ffff4b32285 in g_main_dispatch (context=0x555555859400) at ../../../../glib/gmain.c:3176
        dispatch = 0x7ffff4b2ec10 <g_idle_dispatch>
        prev_source = 0x0
        was_in_call = 0
        user_data = 0x5555559246a0
        callback = 0x5555555bc920 <thunar_shortcuts_model_load>
        cb_funcs = 0x7ffff4dfb280 <g_source_callback_funcs>
        cb_data = 0x5555558f6ca0
        need_destroy = <optimised out>
        source = 0x5555558f8c20
        current = 0x555555885e00
        i = 9


$ strace -o /tmp/thunar.strace -f /usr/bin/thunar /tmp/test

...
9739  access("/home/tj", W_OK)          = 0
9739  stat("/home/tj", {st_mode=S_IFDIR|0750, st_size=32768, ...}) = 0
9739  lstat("/home/tj/Documents", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
9739  access("/home/tj/Documents", R_OK) = 0
9739  access("/home/tj/Documents", W_OK) = 0
9739  access("/home/tj/Documents", X_OK) = 0
9739  lstat("/home/tj", {st_mode=S_IFDIR|0750, st_size=32768, ...}) = 0
9739  lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  lstat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  lstat("/home/tj/Documents", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
9739  inotify_add_watch(12, "/home/tj/Documents", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = 6
9739  access("/mnt/SLBS", W_OK)         = -1 EACCES (Permission denied)
9739  stat("/mnt/SLBS", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  lstat("/mnt/SLBS/Data", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
9739  openat(AT_FDCWD, "/mnt/SLBS/.hidden", O_RDONLY) = -1 ENOENT (No such file or directory)
9739  write(7, "\1\0\0\0\0\0\0\0", 8)   = 8
9740  <... poll resumed> )              = 1 ([{fd=7, revents=POLLIN}])
9739  access("/mnt/SLBS/Data", R_OK <unfinished ...>
9740  read(7,  <unfinished ...>
9739  <... access resumed> )            = 0
9740  <... read resumed> "\1\0\0\0\0\0\0\0", 16) = 8
9739  access("/mnt/SLBS/Data", W_OK <unfinished ...>
9740  poll([{fd=7, events=POLLIN}, {fd=12, events=POLLIN}], 2, 4118 <unfinished ...>
9739  <... access resumed> )            = -1 EACCES (Permission denied)
9739  access("/mnt/SLBS/Data", X_OK)    = 0
9739  lstat("/mnt/SLBS", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  lstat("/mnt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  lstat("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
9739  eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 18
9739  write(18, "\1\0\0\0\0\0\0\0", 8)  = 8
9739  write(9, "\1\0\0\0\0\0\0\0", 8)   = 8
9741  <... poll resumed> )              = 1 ([{fd=9, revents=POLLIN}])
9739  poll([{fd=18, events=POLLIN}], 1, 25000 <unfinished ...>
9741  read(9,  <unfinished ...>
9739  <... poll resumed> )              = 1 ([{fd=18, revents=POLLIN}])
9741  <... read resumed> "\1\0\0\0\0\0\0\0", 16) = 8
9739  read(18, "\1\0\0\0\0\0\0\0", 16)  = 8
9741  sendmsg(8, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\0\1\10\0\0\0K\0\0\0v\0\0\0\10\1g\0\2uu\0\1\1o\0\25\0\0\0"..., iov_len=144}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL <unfinished ...>
9739  poll([{fd=18, events=POLLIN}], 1, 25000 <unfinished ...>
9741  <... sendmsg resumed> )           = 144
9741  poll([{fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=15, events=POLLIN}], 3, -1) = 1 ([{fd=8, revents=POLLIN}])
9741  write(9, "\1\0\0\0\0\0\0\0", 8)   = 8
9741  recvmsg(8, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\2\1\1\5\0\0\0\202\6\0\0.\0\0\0", iov_len=16}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 16
9741  poll([{fd=8, events=POLLIN}], 1, 0) = 1 ([{fd=8, revents=POLLIN}])
9741  recvmsg(8, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\1g\0\1s\0\0\5\1u\0K\0\0\0\6\1s\0\6\0\0\0:1.173\0\0"..., iov_len=53}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 53
9741  write(9, "\1\0\0\0\0\0\0\0", 8)   = 8
9741  write(9, "\1\0\0\0\0\0\0\0", 8)   = 8
9741  poll([{fd=9, events=POLLIN}, {fd=15, events=POLLIN}], 2, 0) = 1 ([{fd=9, revents=POLLIN}])
9741  read(9, "\3\0\0\0\0\0\0\0", 16)   = 8
9741  write(18, "\1\0\0\0\0\0\0\0", 8)  = 8
9739  <... poll resumed> )              = 1 ([{fd=18, revents=POLLIN}])
9741  poll([{fd=8, events=POLLIN}], 1, 0 <unfinished ...>
9739  read(18,  <unfinished ...>
9741  <... poll resumed> )              = 0 (Timeout)
9739  <... read resumed> "\1\0\0\0\0\0\0\0", 16) = 8
9741  write(9, "\1\0\0\0\0\0\0\0", 8 <unfinished ...>
9739  write(18, "\1\0\0\0\0\0\0\0", 8 <unfinished ...>
9741  <... write resumed> )             = 8
9739  <... write resumed> )             = 8
9739  futex(0x55beaa9e2d10, FUTEX_WAKE_PRIVATE, 2147483647 <unfinished ...>
9741  poll([{fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=15, events=POLLIN}], 3, -1 <unfinished ...>
9739  <... futex resumed> )             = 0
9741  <... poll resumed> )              = 1 ([{fd=9, revents=POLLIN}])
9739  close(18 <unfinished ...>
9741  read(9,  <unfinished ...>
9739  <... close resumed> )             = 0
9741  <... read resumed> "\1\0\0\0\0\0\0\0", 16) = 8
9741  poll([{fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=15, events=POLLIN}], 3, -1 <unfinished ...>
9739  lstat("/mnt/SLBS/Data", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
9739  inotify_add_watch(12, "/mnt/SLBS/Data", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 EINTR (Interrupted system call)
9739  --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
Comment 3 alexxcons editbugs 2020-04-13 15:38:57 CEST
Thanks for the trace .. though I still dont have time to look into it.

 .. .looks like your are not the first. Closing this one in favor of the existing bug. Seems to be related to CIFS.

*** This bug has been marked as a duplicate of bug 12467 ***

Bug #15789

Reported by:
Tj
Reported on: 2019-08-06
Last modified on: 2020-04-13

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Attachments

Additional information