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 349149 - Crash in sftp module
Crash in sftp module
Status: RESOLVED DUPLICATE of bug 332028
Product: rhythmbox
Classification: Other
Component: general
0.9.5
Other other
: High critical
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-07-29 07:39 UTC by bugbuddy-20060729
Modified: 2006-08-11 09:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14



Description bugbuddy-20060729 2006-07-29 07:39:46 UTC
Distribution: Debian testing/unstable
Package: rhythmbox
Severity: Normal
Version: GNOME2.14.2 0.9.5
Gnome-Distributor: Debian
Synopsis: Crash when SFTP-accessed library loses connection during playback
Bugzilla-Product: rhythmbox
Bugzilla-Component: general
Bugzilla-Version: 0.9.5
BugBuddy-GnomeVersion: 2.0 (2.14.1)
Description:
Description of the crash:

Rhythmbox crashes when playing a song from a library accessed over SFTP,
to which connectivity is lost.

How often does this happen?

Every time.



Debugging Information:

Backtrace was generated from '/usr/bin/rhythmbox'

Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 47674855786656 (LWP 13681)]
[New Thread 1124362592 (LWP 13754)]
[New Thread 1099184480 (LWP 13690)]
[New Thread 1074006368 (LWP 13683)]
0x00002b5c2655b0ff in waitpid () from /lib/libpthread.so.0

Thread 1 (Thread 47674855786656 (LWP 13681))

  • #0 waitpid
    from /lib/libpthread.so.0
  • #1 gnome_gtk_module_info_get
    from /usr/lib64/libgnomeui-2.so.0
  • #2 <signal handler called>
  • #3 raise
    from /lib/libc.so.6
  • #4 abort
    from /lib/libc.so.6
  • #5 g_logv
    from /usr/lib64/libglib-2.0.so.0
  • #6 g_log
    from /usr/lib64/libglib-2.0.so.0
  • #7 g_malloc
    from /usr/lib64/libglib-2.0.so.0
  • #8 ??
    from /usr/lib/gnome-vfs-2.0/modules/libsftp.so
  • #9 ??
    from /usr/lib/gnome-vfs-2.0/modules/libsftp.so
  • #10 gnome_vfs_open_uri_cancellable
    from /usr/lib64/libgnomevfs-2.so.0
  • #11 gst_gnome_vfs_src_get_type
    from /usr/lib/gstreamer-0.10/libgstgnomevfs.so
  • #12 gst_base_src_get_type
    from /usr/lib64/libgstbase-0.10.so.0
  • #13 gst_base_src_get_type
    from /usr/lib64/libgstbase-0.10.so.0
  • #14 gst_base_src_get_type
    from /usr/lib64/libgstbase-0.10.so.0
  • #15 gst_base_src_get_type
    from /usr/lib64/libgstbase-0.10.so.0
  • #16 gst_pad_check_pull_range
    from /usr/lib64/libgstreamer-0.10.so.0
  • #17 gst_ghost_pad_new_no_target
    from /usr/lib64/libgstreamer-0.10.so.0
  • #18 gst_pad_check_pull_range
    from /usr/lib64/libgstreamer-0.10.so.0
  • #19 gst_type_find_element_get_type
    from /usr/lib/gstreamer-0.10/libgstcoreelements.so
  • #20 gst_pad_set_active
    from /usr/lib64/libgstreamer-0.10.so.0
  • #21 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #22 gst_iterator_fold
    from /usr/lib64/libgstreamer-0.10.so.0
  • #23 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #24 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #25 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #26 gst_type_find_element_get_type
    from /usr/lib/gstreamer-0.10/libgstcoreelements.so
  • #27 gst_element_continue_state
    from /usr/lib64/libgstreamer-0.10.so.0
  • #28 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #29 gst_bin_add
    from /usr/lib64/libgstreamer-0.10.so.0
  • #30 ??
    from /usr/lib/gstreamer-0.10/libgstdecodebin.so
  • #31 gst_element_continue_state
    from /usr/lib64/libgstreamer-0.10.so.0
  • #32 gst_element_continue_state
    from /usr/lib64/libgstreamer-0.10.so.0
  • #33 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #34 gst_bin_add
    from /usr/lib64/libgstreamer-0.10.so.0
  • #35 gst_pipeline_set_new_stream_time
    from /usr/lib64/libgstreamer-0.10.so.0
  • #36 gst_play_base_bin_get_type
    from /usr/lib/gstreamer-0.10/libgstplaybin.so
  • #37 ??
    from /usr/lib/gstreamer-0.10/libgstplaybin.so
  • #38 gst_element_continue_state
    from /usr/lib64/libgstreamer-0.10.so.0
  • #39 gst_element_release_request_pad
    from /usr/lib64/libgstreamer-0.10.so.0
  • #40 rb_player_gst_sync_pipeline
    at rb-player-gst.c line 601
  • #41 rb_player_gst_open
    at rb-player-gst.c line 737
  • #42 rb_shell_player_set_playing_entry
    at rb-shell-player.c line 1018
  • #43 rb_shell_player_do_next
    at rb-shell-player.c line 1480
  • #44 eos_cb
    at rb-shell-player.c line 2435
  • #45 do_next_idle
    at rb-shell-player.c line 1101
  • #46 g_main_context_dispatch
    from /usr/lib64/libglib-2.0.so.0
  • #47 g_main_context_check
    from /usr/lib64/libglib-2.0.so.0
  • #48 g_main_loop_run
    from /usr/lib64/libglib-2.0.so.0
  • #49 IA__gtk_main
    at gtkmain.c line 1003
  • #50 main
    at main.c line 375
  • #0 waitpid
    from /lib/libpthread.so.0




------- Bug created by bug-buddy at 2006-07-29 07:39 -------

Comment 1 James "Doc" Livingston 2006-07-29 14:39:15 UTC
That looks like it's crashing inside GnomeVFS's sftp module.

Is there any chance you could try copying a file with Nautilus or other gnomevfs-using application, and delibrately making the network connection die (by pulling out the network cord or something)?
Comment 2 Devin Carraway 2006-07-29 19:15:26 UTC
I tried reproducing the behavior a couple of ways:

gnomevfs-cat: had it pull a large file across an sftp connection, then killed the corresponding sshd child on the remote host.  This produced some error reporting (which, retrying with RB, I find produced there also) but a clean exit without crashing:

(process:14862): gnome-vfs-modules-CRITICAL **: Could not read 1 bytes
(process:14862): gnome-vfs-modules-CRITICAL **: Could not read 4 bytes
(process:14862): gnome-vfs-modules-CRITICAL **: ID mismatch (4286513152 != 3069)
(process:14862): gnome-vfs-modules-CRITICAL **: Expected SSH2_FXP_STATUS(101) packet, got 0
(process:14862): gnome-vfs-modules-CRITICAL **: Could not read 4 bytes
close `sftp://jezebel/home/aqua/lyrics.tar.gz': Generic error
$ echo $?
1

nautilus: same repro procedure.  Nautilus popped up an I/O error dialog offerring options to retry or cancel.  To be fair to RB, Nautilus did spin the CPU while doing this, something I've seen RB do as well but have not been able to reproduce on a debug build.
Comment 3 Devin Carraway 2006-07-29 19:20:12 UTC
Looking through gnomevfs' bug list, this might be a case of Bug#332028, which going purely on the submitter's description could account for both behaviors.
Comment 4 Jonathan Matthew 2006-08-10 04:19:11 UTC
It looks like you're running rhythmbox with G_DEBUG=fatal_warnings or fatal_criticals, which will cause it to abort when the gnome-vfs sftp method logs a critical message.  When I tried to reproduce this, I got the same set of messages you got from gnomevfs-cat, but no crash.  I think nautilus is using different gnome-vfs methods, so it might get different results.
Comment 5 Devin Carraway 2006-08-11 08:52:01 UTC
Okay, I see it.  It's not $G_DEBUG, it's a malloc failure, which triggers an abort regardless of what $G_DEBUG is set to.  The failure is induced by g_new() being called with an uninitialized int32.  On my amd64 box, this tends to point to a negative value, which is translated into a very large positive one.  Here's the top of the trace:

  • #1 abort
    from /lib/libc.so.6
  • #2 IA__g_logv
    at gmessages.c line 497
  • #3 IA__g_log
    at gmessages.c line 517
  • #4 IA__g_malloc
    at gmem.c line 135
  • #5 iobuf_read_handle
    at sftp-method.c line 440
  • #6 do_open
    at sftp-method.c line 1800
  • #7 gnome_vfs_open_uri_cancellable
    at gnome-vfs-cancellable-ops.c line 57

The faulty routines are buffer_read_block(), buffer_read_gint32() and buffer_read() in gnome-vfs, modules/sftp-method.c.  buffer_read_block() includes this (p_len is passed on the stack):

        *p_len = buffer_read_gint32 (buf);
        data = g_new (gchar, *p_len);
        buffer_read (buf, data, *p_len);

buffer_read_gint32() calls buffer_read, with a bit of debugging and casting afterward:

static gint32
buffer_read_gint32 (Buffer *buf)
{
        gint32 data;
[...]
        buffer_read (buf, &data, sizeof (gint32));
[...]
        return GINT32_TO_BE (data);
}

and buffer_read(), attempting to avoid reading beyond the end of its buffer, performs a bounds check, but has no way of signalling to its caller that the read has in fact failed:

static void
buffer_read (Buffer *buf, gpointer data, guint32 size)
{
        guint32 len;
[...]
        if (buf->write_ptr - buf->read_ptr < size)
                g_critical ("Could not read %d bytes", size);

        len = MIN (size, buf->write_ptr - buf->read_ptr);
        memcpy (data, buf->read_ptr, len);
        buf->read_ptr += len;
}

In this instance, after the ssh connection breaks, buf->write_ptr == buf->read_ptr, and hence the memcpy() becomes a no-op.  buffer_read_gint32() has no way of checking for this and so it returns a uint32's worth of data off the stack to buffer_read_block(), which has no way of knowing either, and calls g_new(char, *p_len) where *p_len has just been filled with garbage.  g_malloc raises an abort and RB dies.

So... either the read should never have happened following the SIGPIPE, or these gnome-vfs read routines should be returning actually-read counts, not just values.

This looks like a gnome-vfs bug, unless there's a peculiarity about the vfs failure-mode interface concerning signals I'm unaware of.
Comment 6 James "Doc" Livingston 2006-08-11 09:42:05 UTC
Marking as a dupe of bug 332028, since it looks to be the same.

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