Re: [Rhythmbox-devel] gnomevfs.async_xfer segfaulting



On Wed, 2006-02-08 at 15:04 +1000, James "Doc" Livingston wrote:
> progress_update_callback is called from one of GnomeVFS's worker
> threads, and as such it doesn't hold the GDK when it's called. This
> means you can't call any Gtk/Gdk functions safely.
> 
> One option would be to add "gtk.gdk.threads_enter()" at the start of the
> callback, and "gtk.gdk.threads_leave()" at the end. A better option
> (which is requires for some non-X systems, like Windows) would be not do
> any work in the callback thread itself, but instead add an idle callback
> (which runs in the main thread) which done what you want.

Excellent, thanks for that information. It seems like there's so many
little bits of info like that which you just have to pick up to write a
proper program :).

I've put the 2 progress bar lines into a function that gets called by
gobject.idle_add, as well as the lines in the update function that
destroy the progress bar window. It doesn't immediately crash anymore,
which is always a good thing ;).

Now however, my plugin is behaving rather erratically. Some (seemingly
random, it changes) time through the download process, rhythmbox exits.
Sometimes, it shows the message:
"Fatal Python error: GC object already tracked
Fatal Python error: GC object already tracked
Multiple segmentation faults occurred; cannot display error dialogue
adam midnight:~$ ptrace: Operation not permitted.
/home/adam/1: No such file or directory.
No stack." (or variations on that general theme)
and I can't get a backtrace from bug-buddy, sometimes it prints nothing
at all and I can (attached). Is there code I missed that needs to be run
in the main thread? Is it some other problem?

--
Adam Zimmerman <adam_zimmerman sfu ca>

CREATIVITY  - http://mirrors.creativecommons.org/movingimages/Building_on_the_Past.mpg
ALWAYS      - http://www.musiccreators.ca/
BUILDS      - http://www.ubuntu.com/
ON THE PAST - http://www.theopencd.org/
--

 The whole world is a tuxedo and you are a pair of brown shoes.
		-- George Gobel
Backtrace was generated from '/usr/bin/rhythmbox'

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1227524416 (LWP 10869)]
[New Thread -1280316496 (LWP 10906)]
[New Thread -1271923792 (LWP 10882)]
[New Thread -1242715216 (LWP 10871)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7be948b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb7b218e6 in libgnomeui_module_info_get () from /usr/lib/libgnomeui-2.so.0
#3  <signal handler called>
#4  0xb7c78030 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#5  0xb7c79d46 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#6  0xb7c2b4f9 in PyFunction_SetClosure () from /usr/lib/libpython2.4.so.1.0
#7  0xb7c10e3e in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#8  0xb7c18a7b in PyMethod_New () from /usr/lib/libpython2.4.so.1.0
#9  0xb7c10e3e in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#10 0xb7c72cc8 in PyEval_CallObjectWithKeywords ()
   from /usr/lib/libpython2.4.so.1.0
#11 0xb7c10e05 in PyObject_CallObject () from /usr/lib/libpython2.4.so.1.0
#12 0xb54dc92a in ?? ()
   from /usr/lib/python2.4/site-packages/gtk-2.0/gobject.so
#13 0xb30d2284 in ?? ()
#14 0xb4f6386c in ?? ()
#15 0xbfd8d0b8 in ?? ()
#16 0xb70d0234 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0xb7be4e60 in pthread_mutex_destroy ()
   from /lib/tls/i686/cmov/libpthread.so.0
#18 0xb7072bf2 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#19 0xb70708d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#20 0xb7073996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#21 0xb7073cb8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#22 0xb77fe765 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#23 0x0806cfc1 in main (argc=1, argv=0xbfd8d444) at main.c:375

Thread 4 (Thread -1242715216 (LWP 10871)):
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb6fb38c4 in poll () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#2  0xb70737e8 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#3  0xb7073cb8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#4  0xb733c70e in link_thread_io_context () from /usr/lib/libORBit-2.so.0
No symbol table info available.
#5  0xb708c5a2 in g_static_private_free () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#6  0xb7be3341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#7  0xb6fbd4ee in clone () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.

Thread 3 (Thread -1271923792 (LWP 10882)):
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7be5eec in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#2  0xb72185dc in ?? () from /usr/lib/libgthread-2.0.so.0
No symbol table info available.
#3  0x087cd888 in ?? ()
No symbol table info available.
#4  0x082d7cc8 in ?? ()
No symbol table info available.
#5  0xb42ff334 in ?? ()
No symbol table info available.
#6  0x08ef59c8 in ?? ()
No symbol table info available.
#7  0x00000001 in ?? ()
No symbol table info available.
#8  0x00000008 in ?? ()
No symbol table info available.
#9  0x08ef59d8 in ?? ()
No symbol table info available.
#10 0x080b092e in rb_metadata_load (md=0x87cd888, uri=0x82d7cc8 "", 
    error=0xb42ff400) at rb-metadata-dbus-client.c:410
	message = (DBusMessage *) 0x0
	response = (DBusMessage *) 0x0
	iter = {dummy1 = 0xb721ae4c, dummy2 = 0x82d7cc8, dummy3 = 142399624, 
  dummy4 = -1271925944, dummy5 = -1222539812, dummy6 = 142399624, 
  dummy7 = 137198792, dummy8 = -1271925964, dummy9 = 149903816, dummy10 = 1, 
  dummy11 = 8, pad1 = 149903832, pad2 = 134940974, pad3 = 0x813d610}
	dbus_error = {name = 0xb70150d4 "double free or corruption (fasttop)", 
  message = 0x3a98 <Address 0x3a98 out of bounds>, dummy1 = 0, dummy2 = 0, 
  dummy3 = 0, dummy4 = 1, dummy5 = 1, padding1 = 0x0}
	ok = 364201000
	fake_error = (GError *) 0x44d1541b
	__FUNCTION__ = "rb_metadata_load"
#11 0xb705ad8c in g_async_queue_push_sorted () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#12 0xb705b03a in g_async_queue_timed_pop () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x080ccabf in action_thread_main (db=0x82d9810) at rhythmdb.c:1907
	result = <value optimized out>
	__FUNCTION__ = "action_thread_main"
	__PRETTY_FUNCTION__ = "action_thread_main"
#14 0xb708c5a2 in g_static_private_free () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#15 0xb7be3341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#16 0xb6fbd4ee in clone () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.

Thread 2 (Thread -1280316496 (LWP 10906)):
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7be5c76 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#2  0xb741666f in gnome_vfs_async_get_job_limit ()
   from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#3  0xb7417012 in gnome_vfs_job_get_count () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#4  0xb743030d in gnome_vfs_volume_to_corba () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#5  0xb7431540 in gnome_vfs_volume_to_corba () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#6  0xb7431d4b in gnome_vfs_volume_to_corba () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#7  0xb7432cee in gnome_vfs_volume_to_corba () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#8  0xb74333fb in gnome_vfs_volume_to_corba () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#9  0xb741783b in gnome_vfs_job_get_count () from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#10 0xb74160ab in gnome_vfs_is_primary_thread ()
   from /usr/lib/libgnomevfs-2.so.0
No symbol table info available.
#11 0xb708e448 in g_thread_pool_free () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#12 0xb708c5a2 in g_static_private_free () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0xb7be3341 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#14 0xb6fbd4ee in clone () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.

Thread 1 (Thread -1227524416 (LWP 10869)):
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7be948b in __waitpid_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#2  0xb7b218e6 in libgnomeui_module_info_get () from /usr/lib/libgnomeui-2.so.0
No symbol table info available.
#3  <signal handler called>
No symbol table info available.
#4  0xb7c78030 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#5  0xb7c79d46 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#6  0xb7c2b4f9 in PyFunction_SetClosure () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#7  0xb7c10e3e in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#8  0xb7c18a7b in PyMethod_New () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#9  0xb7c10e3e in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#10 0xb7c72cc8 in PyEval_CallObjectWithKeywords ()
   from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#11 0xb7c10e05 in PyObject_CallObject () from /usr/lib/libpython2.4.so.1.0
No symbol table info available.
#12 0xb54dc92a in ?? ()
   from /usr/lib/python2.4/site-packages/gtk-2.0/gobject.so
No symbol table info available.
#13 0xb30d2284 in ?? ()
No symbol table info available.
#14 0xb4f6386c in ?? ()
No symbol table info available.
#15 0xbfd8d0b8 in ?? ()
No symbol table info available.
#16 0xb70d0234 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#17 0xb7be4e60 in pthread_mutex_destroy ()
   from /lib/tls/i686/cmov/libpthread.so.0
No symbol table info available.
#18 0xb7072bf2 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#19 0xb70708d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#20 0xb7073996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#21 0xb7073cb8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#22 0xb77fe765 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#23 0x0806cfc1 in main (argc=1, argv=0xbfd8d444) at main.c:375
	program = (GnomeProgram *) 0x81ffc38
	session_bus = (DBusGConnection *) 0x824b104
	error = (GError *) 0x0
	rb_shell = (RBShell *) 0x82d4050
	new_argv = (char **) 0x8146ea8
	poptContext = (poptContext) 0x8202000
	context_as_value = {g_type = 68, data = {{v_int = 136323072, 
      v_uint = 136323072, v_long = 136323072, v_ulong = 136323072, 
      v_int64 = 136323072, v_uint64 = 136323072, v_float = 4.81858644e-34, 
      v_double = 6.7352546610742753e-316, v_pointer = 0x8202000}, {v_int = 0, 
      v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, 
      v_float = 0, v_double = 0, v_pointer = 0x0}}}
	__FUNCTION__ = "main"
	popt_options = {{longName = 0x8135a75 "debug", shortName = 100 'd', 
    argInfo = 0, arg = 0x813d3e0, val = 0, 
    descrip = 0x811177a "Enable debug output", argDescrip = 0x0}, {
    longName = 0x811178e "debug-match", shortName = 68 'D', argInfo = 1, 
    arg = 0x813d3dc, val = 0, 
    descrip = 0x8111a44 "Enable debug output matching a specified string", 
    argDescrip = 0x0}, {longName = 0x811179a "no-update", shortName = 0 '\0', 
    argInfo = 0, arg = 0x813d3d8, val = 0, 
    descrip = 0x8111a74 "Do not update the library with file changes", 
    argDescrip = 0x0}, {longName = 0x81117a4 "no-registration", 
    shortName = 110 'n', argInfo = 0, arg = 0x813d3d4, val = 0, 
    descrip = 0x81117b4 "Do not register the shell", argDescrip = 0x0}, {
    longName = 0x81117ce "dry-run", shortName = 0 '\0', argInfo = 0, 
    arg = 0x813d3d0, val = 0, 
    descrip = 0x8111aa0 "Don't save any data permanently (implies --no-registration)", argDescrip = 0x0}, {longName = 0x81117d6 "rhythmdb-file", 
    shortName = 0 '\0', argInfo = 1, arg = 0x813d3cc, val = 0, 
    descrip = 0x81117e4 "Path for database file to use", argDescrip = 0x0}, {
    longName = 0x8111802 "playlists-file", shortName = 0 '\0', argInfo = 1, 
    arg = 0x813d3c8, val = 0, 
    descrip = 0x8111adc "Path for playlists file to use", argDescrip = 0x0}, {
    longName = 0x8111e11 "quit", shortName = 113 'q', argInfo = 0, 
    arg = 0x813d3c4, val = 0, descrip = 0x8111811 "Quit Rhythmbox", 
    argDescrip = 0x0}, {longName = 0x0, shortName = 0 '\0', argInfo = 0, 
    arg = 0x0, val = 0, descrip = 0x0, argDescrip = 0x0}}
#0  0xffffe410 in __kernel_vsyscall ()
	def __purchase_download_update_cb(self, _reserved, info, data):
		if info.phase == gnomevfs.XFER_PHASE_COMPLETED:
			to_file_uri = data[0]
			library_location = data[1]
			
			if self.cancelled:
				self.purchase_filesize -= gnomevfs.get_file_info(to_file_uri).size
				del self.__downloads[str(to_file_uri)]
				gnomevfs.unlink(to_file_uri)
				if self.purchase_filesize == 0:
					gobject.idle_add(self.__destroy_progress_window)
			else:
				self.purchase_filesize -= gnomevfs.get_file_info(to_file_uri).size
				del self.__downloads[str(to_file_uri)]
				album = zipfile.ZipFile(to_file_uri.path)
				for track in album.namelist():
					track_uri = gnomevfs.URI(library_location + "/" + track)
					out = create_if_needed(track_uri, gnomevfs.OPEN_WRITE)
					out.write(album.read(track))
					out.close()
				album.close()
				gnomevfs.unlink(to_file_uri)
				if self.purchase_filesize == 0:
					gobject.idle_add(self.__destroy_progress_window)
				self.__db.add_uri("file://" + urllib.quote(track_uri.dirname))
		return 1
	
	def __purchase_download_progress_cb(self, info, to_file):
		if self.cancelled:
			return 0
		
		self.__downloads[to_file] = info.bytes_copied
		purchase_downloaded = 0
		for i in self.__downloads.values():
			purchase_downloaded += i
		purchase_fraction = purchase_downloaded / float(self.purchase_filesize)
		print str(purchase_downloaded) + " " + str(self.purchase_filesize) + " " + str(purchase_fraction)
		gobject.idle_add(self.__update_progress_bar, purchase_fraction)
		return 1
	
	def __update_progress_bar(self, purchase_fraction):
		self.progress_dialog.get_widget("download_pbar").set_fraction(purchase_fraction)
		self.progress_dialog.get_widget("download_pbar").set_text(str(int(purchase_fraction * 100)) + "%")
		return False
	
	def __destroy_progress_window(self):
		self.progress_dialog.get_widget("download_window").destroy()
		self.progress_dialog = None
		return False


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]