After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 697782 - file transfer, opening images, playing videos hang by using gvfs
file transfer, opening images, playing videos hang by using gvfs
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: fuse
1.16.x
Other Linux
: High normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 693396 706257 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-04-11 11:27 UTC by claudio
Modified: 2013-12-11 06:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backtrace gvfsd-smb hangs (5.71 KB, text/plain)
2013-04-11 13:58 UTC, claudio
  Details
backtrace gvfsd-smb hangs 2 (18.05 KB, text/plain)
2013-04-15 06:34 UTC, claudio
  Details
backtrace gvfsd-smb hangs 3 (9.74 KB, text/plain)
2013-04-22 04:56 UTC, Nikolay Martynov
  Details
Patch to fix the problem (1.89 KB, patch)
2013-09-21 20:56 UTC, Ross Lagerwall
none Details | Review
Patch to fix the problem (v2) (2.22 KB, patch)
2013-09-21 21:20 UTC, Ross Lagerwall
none Details | Review
Patch to fix the problem (v3) (3.38 KB, patch)
2013-09-22 20:58 UTC, Ross Lagerwall
accepted-commit_now Details | Review

Description claudio 2013-04-11 11:27:18 UTC
my systems:

- Mint 14 Nadia Cinnamon 64 with gvfs version 1.14.0-0ubuntu6
- Ubuntu 13.04 Raring 64 with gvfs version 1.16.0-1ubuntu4

I connect to a windows share in our network and play a large (125MB) mpeg video with any player e. g. vlc. See the output of ps after a few hangs of vlc:

0 S  1000  2014     1  0  80   0 - 49533 poll_s ?        00:00:00 gvfsd
0 S  1000  2018     1  0  80   0 - 250396 futex_ ?       00:00:00 gvfsd-fuse

0 S  1000  4249     1  0  80   0 - 373099 futex_ ?       00:00:00 vlc
0 S  1000  4488     1  0  80   0 - 233207 futex_ ?       00:00:00 vlc
0 S  1000  4667     1  0  80   0 - 373100 futex_ ?       00:00:00 vlc
0 S  1000  4917     1  0  80   0 - 233207 futex_ ?       00:00:00 vlc
0 S  1000  5025     1  0  80   0 - 233394 futex_ ?       00:00:00 vlc

gvfs and vlc processes hang with futex, some kind of blocking / locking. 
vlc processes cant be killed, even with -9.

If I do the same by mounting the windows share with cifs, everything works fine, no hangs:

sudo mount -t cifs //140.1.1.14/public ~/public -o domain=WINDOWSDOMAINNAME,user=WINDOWSUSER,pass=WINDOWSPASSWORD

I also get this error by copying large files from the windows share, sometimes the file manager hangs (like vlc above).
Or by viewing images on the windows share, sometimes the viewer hangs (like vlc above).

see also bug description on launchpad, a lot of people seem to be affected:
https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1075923
Comment 1 Tomas Bzatek 2013-04-11 11:30:02 UTC
May I ask you for a backtrace of the backend process (gvfsd-smb)? It looks like bug 675181
Comment 2 claudio 2013-04-11 11:46:00 UTC
never done a backtrace, can you point me in the right direction?
Comment 3 claudio 2013-04-11 13:23:11 UTC
found how to do a backtrace.
But if I attach gdb to the running gvfsd-smb and continue, 
gdb does not react on hitting ctrl-c, so I cant backtrace
Comment 4 Tomas Bzatek 2013-04-11 13:40:05 UTC
Right, sorry, should've posted a link here: http://fedoraproject.org/wiki/StackTraces (it's generally applicable to other distros as well)

(In reply to comment #3)
> But if I attach gdb to the running gvfsd-smb and continue, 
> gdb does not react on hitting ctrl-c, so I cant backtrace

It should, seems like a problem with gdb then. I think there's also a call to grab backtrace right away, maybe with little gdb scripting.
Comment 5 claudio 2013-04-11 13:58:29 UTC
Created attachment 241254 [details]
backtrace gvfsd-smb hangs
Comment 6 claudio 2013-04-11 13:59:08 UTC
thanks, attached the backtrace,
do I need to install debug symbols or debug info packages?
Comment 7 whoop 2013-04-12 00:38:30 UTC
I am having random freezes when playing (vlc, totem) media files, but not all the time... Is this bug happening always or random like with me?
Comment 8 claudio 2013-04-12 06:18:31 UTC
it is random, not all the time, but when it starts, it gets worse.
I can play a video like 5-10 times and then it starts, so I get this very fast.
Comment 9 joe 2013-04-12 12:08:35 UTC
xkill works when kill -9 doesn't.
Comment 10 Tomas Bzatek 2013-04-12 12:24:44 UTC
(In reply to comment #9)
> xkill works when kill -9 doesn't.

Oh god... 

(In reply to comment #6)
> thanks, attached the backtrace,
> do I need to install debug symbols or debug info packages?

Yes please, they're essential to have a trace with human readable symbols.
Comment 11 claudio 2013-04-12 14:26:27 UTC
@Thomas:
thought the same about xkill ;-)
I'll try to get you the backtrace with debug info on monday,
its my linux machine at work.
Comment 12 whoop 2013-04-13 19:32:42 UTC
It get's worse for me also... When totem fails once, it keeps on failing until I reboot (although there might be a more efficient way to get it working again).
Comment 13 claudio 2013-04-15 06:34:28 UTC
Created attachment 241547 [details]
backtrace gvfsd-smb hangs 2
Comment 14 Nikolay Martynov 2013-04-22 04:56:18 UTC
Created attachment 242114 [details]
 backtrace gvfsd-smb hangs 3

Looks like I'm experiencing same issue. I'm using xubuntu raring beta.

The problem occurs when I try to directory containing many photos from windows XP machine. That is: directory with some subdirectories containing jpg files (several megs in size) and some small metadata files. It starts copying fine but hangs at random file.

Attaching backtrace - looks very similar to one attached before.

I would be happy to help debugging this issue.
Comment 15 Romano Giannetti 2013-05-03 10:33:21 UTC
There is a quite popular bug open on Launchpad about this issue. It seems that it is a regression introduced in the upgrade from 1.13 to 1.14, and still with us. Debian Wheezy is not affected and everything after that seems that is.  

Please see https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1075923

Given the potential effects of this bug (I can workaround with directly mounting with cifs or smbmount, but that's not a normal user action, or using NFS in a linux-only setup), and the widespread use of gvfs-smb mounts, I advocate for raising the importance of the bug. 

Thanks for the attention, and as ever a thank to all the developers,
Have a nice day,
Romano
Comment 16 Romano Giannetti 2013-05-03 10:39:31 UTC
(In reply to comment #15)
> There is a quite popular bug open on Launchpad about this issue. It seems that
> it is a regression introduced in the upgrade from 1.13 to 1.14, and still with
> us. Debian Wheezy is not affected and everything after that seems that is.  

Sorry, from 1.12 to 1.14.
Comment 17 Forest 2013-05-04 06:17:26 UTC
Speaking as yet another person suffering from this bug, I think it's safe to mark this as confirmed.  It crops up on my Xubuntu Quantal amd64 system (gvfs-backends 1.14.0) quite often when I copy gigabyte-size files to my NAS, freezing Thunar until I kill gvfsd-smb.
Comment 18 lazzari_alessandro 2013-05-04 07:30:42 UTC
Ubuntu Raring 64, gvfs 1.16.1, Nautilus 3.6.3

Transferred 26678 files, 48,3 GB without issues.
gvfsd-smb memory usage grew from about 3 to 15 Mb, and nautilus' from 10 to about 50Mb during the copy.
At the end of the copy, I noticed that neither process had released any memory.

So I started a second copy.
gvfd-smb grew to 32 Mb and nautilus to 74. Again, no memory release. I noticed that both processes memory usage grows much more quickly when transferring many small files, than when dealing with few but large ones.

Third time, gvfsd-smb up to 46 and nautilus up to 99

So I kept trying until I finally had the copy hang.
gvfsd-smb memory usage had grown to about 130Mb and nautilus' to about 250 Mb.

Is this behaviour normal?
Comment 19 Forest 2013-05-08 17:30:29 UTC
For the record, these hangs do not occur when accessing the same file server via mount.cifs.
Comment 20 Romano Giannetti 2013-05-21 10:14:14 UTC
Hi, 
I think this is a very serious regression --- can I humbly suggest that the developers confirm and raise the priority of this bug? It's a quite unpredictable hang and there is even a case of data loss (see the launchpad thread).
Comment 21 Tomas Bzatek 2013-05-21 10:24:37 UTC
(In reply to comment #18)
> Ubuntu Raring 64, gvfs 1.16.1, Nautilus 3.6.3

Okay, gvfs-1.16.1 got the gvfschannel fixes I was referring to.

> So I kept trying until I finally had the copy hang.

Can you please grab a backtrace of the backend process (gvfsd-smb) and nautilus at the moment of hang?

> gvfsd-smb memory usage had grown to about 130Mb and nautilus' to about 250 Mb.
> 
> Is this behaviour normal?

You've probably found a memory leak, if you're certain with that, please open a separate bugreport preferably with valgring log (see https://live.gnome.org/Valgrind for usage).
Comment 22 Tomas Bzatek 2013-05-21 10:29:21 UTC
As there are multiple reporters, I would like to know the way the files are accessed. The original report talks about accessing through the fuse daemon while e.g. the reporter in comment 18 is talking about Nautilus, which is a native GIO client. We may be dealing with two issues here actually.

(In reply to comment #20)
> It's a quite unpredictable hang and there is even a case of data loss (see the launchpad thread).

Nobody is going to read that 155 comments, can you post an excerpt here talking about data loss?
Comment 23 claudio 2013-05-21 10:43:30 UTC
@Thomas:

In Mint 14 Nadia Cinnamon 64 I use nemo to connect to the windows share.
In Ubuntu 13.04 Raring 64 I use nautilus to connect to the windows share.

Nautilus and Nemo in Menue: File => Connect to server:
smb://xxx.xxx.xxx.xxx/public
Comment 24 claudio 2013-05-21 10:44:55 UTC
@Thomas:

In Mint 14 Nadia Cinnamon 64 I use nemo to connect to the windows share.
In Ubuntu 13.04 Raring 64 I use nautilus to connect to the windows share.

Nautilus and Nemo in Menue: File => Connect to server:
smb://xxx.xxx.xxx.xxx/public
Comment 25 Romano Giannetti 2013-05-21 10:55:38 UTC
@Tomas: you're right, sorry. The data loss report is 

https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1075923/comments/150

although at first glance it seems more a bug of the frontend for not checking the success of the operation before removing the source file. 

I triggered the bug using nautilus (ubuntu 12.10, gnome shell desktop with the nautilus from the distribution --- it says 3.4.2. When I connect to a SMB-share, it spawns 

romano   13269  0.0  0.1  59140  6300 ?        SLl  12:43   0:00 /usr/lib/gvfs/gvfsd-smb --spawner :1.4 /org/gtk/gvfs/exec_spaw/3

I don't understand very well your comment about GIO --- I suspect that Nautilus is using gvfs-fuse and gvfs-smb nowadays.
Comment 26 Tomas Bzatek 2013-05-21 11:39:00 UTC
(In reply to comment #25)
> I don't understand very well your comment about GIO --- I suspect that Nautilus
> is using gvfs-fuse and gvfs-smb nowadays.

The FUSE daemon is provided only as a fallback to non-Gnome applications (simply speaking), Natilus and his clones have been native GIO clients from beginning. 

I.e. the vlc from the first post is an example of application that doesn't support GIO (unless ported to it) and needs to go through the compatibility (FUSE) POSIX layer.
Comment 27 Tomas Bzatek 2013-05-21 11:46:03 UTC
(In reply to comment #25)
> @Tomas: you're right, sorry. The data loss report is 
> 
> https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1075923/comments/150
> 
> although at first glance it seems more a bug of the frontend for not checking
> the success of the operation before removing the source file. 

Thanks, though the post contains very little technical information and we can't even guess what was the situation about. And the last paragraph is simply amusing.

There's a possibility that the error reporting is not working as expected but we need to know more information in order to fix that. Basically error reporting is developer's biggest concern yet due to multiple stacks involved (e.g. libsmbclient -> gvfsd-smb -> gvfsd -> libgvfsdbus.so -> GIO -> gvfsd-fuse -> POSIX application) the possibility of mistake is large by nature.
Comment 28 Romano Giannetti 2013-05-21 13:01:12 UTC
(In reply to comment #26)
> 
> The FUSE daemon is provided only as a fallback to non-Gnome applications
> (simply speaking), Natilus and his clones have been native GIO clients from
> beginning. 
> 
OK --- clearer now. I had the bug simply copying files though. I was copying photos with nautilus while viewing them with gthumb. Maybe could be a race between native and non-native applications? 

If you can think of a test case I can try to repeat the hang --- I have since switched to using rsync to copy stuff but I can try ;-)
Comment 29 Neuropa 2013-05-30 16:58:45 UTC
It also affects me.
When I try to copy files from QNAP NAS share, samba randomly hangs without any notice.
Using a clean install of Ubuntu 12.10 and Ubuntu 13.04 (64 bit).
This problem was not present in Ubuntu 12.04.
Comment 30 Brian Harkness 2013-06-08 17:18:08 UTC
Okay, this explains some issues I am having with Ubuntu 13.04, raring.  Actually, it even happens when transferring files to an SD card, with and fstab entry for that device.  No other file manager experiences this hang.
Comment 31 Jeffrey Katz 2013-07-29 01:26:16 UTC
I have 2 machines running 13.10 Saucy amd64 mixed Ubuntu/Xubuntu/Kubuntu/etc

Problem still exist with Nautilus, Nemo, PCManFM

gvfs 1.17.2-0ubuntu3

Dolphin works fine.
Comment 32 Jeffrey Katz 2013-07-29 20:51:41 UTC
I should add:

nautilus 1:3.8.2-0ubuntu1
Comment 33 S. 2013-09-01 13:59:47 UTC
Just got bit by this bug. I have two laptops running Ubuntu 13.04. The faster one with an Intel Core I5 is running x86, and the slower one is running amd64. (I prefer x86, but the slower laptop had a different bug that prevented me from using x86.) The fast laptop doesn't have any Nautilus / Samba / GVFS problems, but the slow laptop is completely broken for file transfers. I don't know if this has to do with the speed or if 32bit vs 64bit makes the difference.

Is this bug exclusive to Ubuntu?
Comment 34 whoop 2013-09-07 15:17:56 UTC
(In reply to comment #33)
> Is this bug exclusive to Ubuntu?

No, I am having this issue on two arch machines...
Comment 35 Edouard 2013-09-07 15:43:46 UTC
Have this bug on Fedora, at least the part where nautilus hangs when transfering files from remote samba shares. Seems more stable when disabling thumbnails in nautilus settings.
Comment 36 Ross Lagerwall 2013-09-21 20:56:07 UTC
I think I have pinpointed the problem and come up with a fix (patch attached).
FWIW, I could hit this issue by running:
gvfs-mount 'smb://ip/share' && cp -rv /run/user/1000/gvfs/smb-share\:server\=ip\,share\=share/path /tmp

commit 75ebd95d899f52e1d14b3492b38906bad91b10b8
Author: Ross Lagerwall <rosslagerwall@gmail.com>
Date:   Sat Sep 21 22:22:27 2013 +0200

    daemon: Emit signal before returning dbus value
    
    In gvfsjobopenforread.c, the dbus method returns a value in create_reply
    which eventually results in a GVfsJobRead job to be sent to the backend.
    This could happen before the "new-source" signal is emitted.  If this
    happens, the job is not queued because the "new_job" signal would not
    have been connected to a job source yet.  The read then hangs because
    the GVfsJobRead is lost.
    
    This is hit often when performing large smb transfers (see
    https://bugzilla.gnome.org/show_bug.cgi?id=697782 and
    https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1075923).
    It can be reproduced by putting a small sleep before the
    g_signal_emit_by_name call.
    
    Fix this by emitting the "new-source" signal *before* the dbus method
    value is returned.  This ensures that the "new_job" signal is set up
    before any further jobs are sent.
Comment 37 Ross Lagerwall 2013-09-21 20:56:44 UTC
Created attachment 255499 [details] [review]
Patch to fix the problem
Comment 38 Ross Lagerwall 2013-09-21 21:20:17 UTC
Created attachment 255500 [details] [review]
Patch to fix the problem (v2)

Updated patch.
Comment 39 Forest 2013-09-22 18:09:20 UTC
Sounds promising.  Is there a corresponding fix to be made for writes?  It seems to me that I've run into this problem when copying files *to* my samba server.
Comment 40 Ross Lagerwall 2013-09-22 20:57:40 UTC
Yes, I just managed to reproduce that too.  I have attached an updated patch which fixes it.
Comment 41 Ross Lagerwall 2013-09-22 20:58:32 UTC
Created attachment 255536 [details] [review]
Patch to fix the problem (v3)

Add the same fix for gvfsjobopenforwrite.c.
Comment 42 claudio 2013-09-23 10:33:12 UTC
@Ross

thanks for your patch. I want to test it on my machine, but I'm not very familiar with the build system.

I downloaded the sourcecode of gvfs by:
sudo apt-get build-dep gvfs
sudo apt-get source gvfs

Now I have a folder called "gvfs-1.16.1" in my home. I can add your patch here.
But how do I build and install the patched version on my machine?
Comment 43 claudio 2013-09-23 10:36:56 UTC
@Ross

thanks for your patch. I want to test it on my machine, but I'm not very familiar with the build system.

I downloaded the sourcecode of gvfs by:
sudo apt-get build-dep gvfs
sudo apt-get source gvfs

Now I have a folder called "gvfs-1.16.1" in my home. I can add your patch here.
But how do I build and install the patched version on my machine?
Comment 44 Ross Lagerwall 2013-09-23 12:23:47 UTC
I have it in a PPA here: https://launchpad.net/~rosslagerwall/+archive/bugfixes

Or else try this:
cd gvfs-1.16.1
patch -p1 < 0001-daemon-Emit-signal-before-returning-dbus-value.patch
dpkg-buildpackage -us -uc
sudo dpkg -i ../*deb
Comment 45 claudio 2013-09-23 14:27:36 UTC
@Ross

installed your ppa.
Checked installation, your ppa seems to be installed:


dpkg -l | grep gvfs


ii  gvfs:amd64                                  1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - GIO module
ii  gvfs-backends                               1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - backends
ii  gvfs-bin                                    1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - binaries
ii  gvfs-common                                 1.16.1-0ubuntu2~rc2                        all          userspace virtual filesystem - common data files
ii  gvfs-daemons                                1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - servers
ii  gvfs-fuse                                   1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - fuse server
ii  gvfs-libs:amd64                             1.16.1-0ubuntu2~rc2                        amd64        userspace virtual filesystem - private libraries


rebooted, and did the steps in my post #1.
Video player still hangs. I get the same behaviour as before.

Am I doing something wrong? Can I give you some more input?
I can produce this effect very easily by running Mint 15 in a virtual box.
Seems to have something to do with speed of computers?
Comment 46 Ross Lagerwall 2013-09-23 15:24:56 UTC
(In reply to comment #45)
> @Ross
> 
> rebooted, and did the steps in my post #1.
> Video player still hangs. I get the same behaviour as before.
> 
> Am I doing something wrong? Can I give you some more input?
> I can produce this effect very easily by running Mint 15 in a virtual box.
> Seems to have something to do with speed of computers?

Well it's possible that there's more than one problem :-(
The patch I posted certainly fixed performing a large copy from a windows share for me.


I guess for debugging purposes, it would be useful to run something like:
pkill gvfsd
GVFS_DEBUG=all GVFS_SMB_DEBUG=6 /usr/lib/gvfs/gvfsd &> log.txt

Then do the thing that fails (playing a video), press Ctrl-C and upload log.txt somewhere...
Comment 47 claudio 2013-09-23 15:44:30 UTC
thanks, I can get you the log tomorrow
Comment 48 claudio 2013-09-27 08:18:13 UTC
I have to revise my comment #45:

The patch from Ross is working for copying large files.
So this is definitely an improvement to gvfs.

I still sometimes have problems playing videos, but I don't know, 
how far this is related to gvfs. 

Thanks!
Comment 49 Alexander Larsson 2013-09-30 08:47:10 UTC
Review of attachment 255536 [details] [review]:

Great catch!
Comment 50 Alexander Larsson 2013-09-30 09:14:20 UTC
Pushed this to master as bdc3babbe21e5fed06876db4d56d1b13915fe1cb.
I guess we need a new release with this...
Comment 51 Bastien Nocera 2013-09-30 12:49:30 UTC
*** Bug 706257 has been marked as a duplicate of this bug. ***
Comment 52 Ross Lagerwall 2013-12-11 06:44:44 UTC
*** Bug 693396 has been marked as a duplicate of this bug. ***