GNOME Bugzilla – Bug 609007
Getting info of the same ssh uri from multiple threads crashes gnomevfs
Last modified: 2010-02-18 14:14:47 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.
Created attachment 154075 [details] [review] patch to fix the bug
The function "do_get_file_info_from_handle" in the module "sftp-method" was not thread-safe. The patch in the attachment fix it.
*** Bug 608901 has been marked as a duplicate of this bug. ***
Very nice, it seens it is resolved, thanks for the help Paulo.