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 609007 - Getting info of the same ssh uri from multiple threads crashes gnomevfs
Getting info of the same ssh uri from multiple threads crashes gnomevfs
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: ssh/sftp
2.24.x
Other Linux
: Normal blocker
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
: 608901 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-02-04 18:02 UTC by tiagokatcipis
Modified: 2010-02-18 14:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source code to reproduce the problem (20.00 KB, application/x-tar)
2010-02-04 18:02 UTC, tiagokatcipis
  Details
patch to fix the bug (1.34 KB, patch)
2010-02-17 19:59 UTC, Paulo Pizarro
none Details | Review

Description tiagokatcipis 2010-02-04 18:02:41 UTC
Created attachment 153027 [details]
source code to reproduce the problem

When you just open and read the same ssh uri multiple times on multiple threads, it works fine. But if you try to read and access the info of the same ssh uri from multiple threads, it crashes. if you start something like 30
worker threads it always give a:

GLib-ERROR **: /build/buildd/glib2.0-2.22.3/glib/gmem.c:175: failed to allocate
[lot of] bytes),
and a lot of protocol errors and i/o errors gets printed.

It looks that gnomevfs has a problem with thread safety when you require info
about the same ssh uri from multiple threads (other protocols looks to work
fine).

Source code without info that works fine:
https://svn.inf.ufsc.br/katcipis/c/gnomevfs_bug/ok_test.c

Source code with info that crashes:
https://svn.inf.ufsc.br/katcipis/c/gnomevfs_bug/crash_test.c

Source code with info and with mutex that works fine:
https://svn.inf.ufsc.br/katcipis/c/gnomevfs_bug/ok_mutex_test.c

This bug started as a bug on gstreamer gnomevfssrc plugin, but since the problem can be reproduced directly on gnomevfs it looks like the problem is on gnomevfs and ssh support. Here is the gstreamer bug:

https://bugzilla.gnome.org/show_bug.cgi?id=608901

I tested with simple files and http and it works fine, it would be good to use the tests i wrote with other protocols and see if it only happens with ssh/sftp.
Comment 1 Paulo Pizarro 2010-02-17 19:59:16 UTC
Created attachment 154075 [details] [review]
patch to fix the bug
Comment 2 Paulo Pizarro 2010-02-17 20:46:25 UTC
The function "do_get_file_info_from_handle" in the module "sftp-method" was not thread-safe. The patch in the attachment fix it.
Comment 3 Sebastian Dröge (slomo) 2010-02-18 05:44:32 UTC
*** Bug 608901 has been marked as a duplicate of this bug. ***
Comment 4 tiagokatcipis 2010-02-18 14:12:43 UTC
Very nice, it seens it is resolved, thanks for the help Paulo.