Bug 141758

Summary: Ktorrent crashes and gives error SIGABRT at startup
Product: [Applications] ktorrent Reporter: William Lee <sales>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash CC: erik.sohns
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description William Lee 2007-02-15 22:03:12 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Ubuntu Packages
Compiler:          Don't know, Mepis 6.0 
OS:                Linux

When launching KTorrent, I get a message that the program has crashed and gave the error SIGABRT.  

I removed and reinstalled the program via synaptic and then downloaded the newest .deb file and installed that. No change.  Help?


(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1216910848 (LWP 32300)]
[New Thread -1225049168 (LWP 32349)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#5  0x4f420a97 in raise () from /lib/tls/libc.so.6
#6  0x4f422329 in abort () from /lib/tls/libc.so.6
#7  0x4f716284 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.6
#8  0x4f713f15 in __gxx_personality_v0 () from /usr/lib/libstdc++.so.6
#9  0x4f713f4a in std::terminate () from /usr/lib/libstdc++.so.6
#10 0x4f71407e in __cxa_throw () from /usr/lib/libstdc++.so.6
#11 0x4f714481 in operator new () from /usr/lib/libstdc++.so.6
#12 0x4f71453d in operator new[] () from /usr/lib/libstdc++.so.6
#13 0x41aa88f8 in bt::BitSet::BitSet () from /usr/lib/libktorrent.so.0
#14 0x41abd8f1 in bt::ChunkDownload::load () from /usr/lib/libktorrent.so.0
#15 0x41acd04a in bt::Downloader::loadDownloads ()
   from /usr/lib/libktorrent.so.0
#16 0x41aed70d in bt::TorrentControl::continueStart ()
   from /usr/lib/libktorrent.so.0
#17 0x41af610a in bt::TorrentControl::start () from /usr/lib/libktorrent.so.0
#18 0x41ae4a15 in bt::QueueManager::startSafely ()
   from /usr/lib/libktorrent.so.0
#19 0x41ae4cc6 in bt::QueueManager::start () from /usr/lib/libktorrent.so.0
#20 0x41ae5700 in bt::QueueManager::orderQueue ()
   from /usr/lib/libktorrent.so.0
#21 0x0806dd97 in ?? ()
#22 0x0808e0f6 in ?? ()
#23 0x0808e873 in ?? ()
#24 0x413127a0 in KUniqueApplication::processDelayed ()
   from /usr/lib/libkdecore.so.4
#25 0x41313f17 in KUniqueApplication::qt_invoke ()
   from /usr/lib/libkdecore.so.4
#26 0x08060221 in ?? ()
#27 0xb7a84051 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#28 0xb7e17432 in QSignal::signal () from /usr/lib/libqt-mt.so.3
#29 0xb7aa17c8 in QSignal::activate () from /usr/lib/libqt-mt.so.3
#30 0xb7aa92b8 in QSingleShotTimer::event () from /usr/lib/libqt-mt.so.3
#31 0xb7a19f3e in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#32 0xb7a1a13a in QApplication::notify () from /usr/lib/libqt-mt.so.3
#33 0x41300f11 in KApplication::notify () from /usr/lib/libkdecore.so.4
#34 0xb79ab157 in QApplication::sendEvent () from /usr/lib/libqt-mt.so.3
#35 0xb7a0b92b in QEventLoop::activateTimers () from /usr/lib/libqt-mt.so.3
#36 0xb79bef67 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#37 0xb7a32a2f in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#38 0xb7a32952 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#39 0xb7a18a4d in QApplication::exec () from /usr/lib/libqt-mt.so.3
#40 0x08064e5a in ?? ()
#41 0x4f40cea4 in __libc_start_main () from /lib/tls/libc.so.6
#42 0x0805e261 in ?? ()
Comment 1 Joris Guisson 2007-02-16 11:43:30 UTC
Version ?
Comment 2 William Lee 2007-02-16 15:44:38 UTC
V 2.1.  I read all the other similar (ktorrent+SIGABRT) postings and saw that many were resolved via newer versions.  Thanks, by the way, for responding so quickly, it is appreciated!
Comment 3 Joris Guisson 2007-02-17 14:49:57 UTC
SVN commit 634518 by guisson:

Make sure all exceptions are caught when a ChunkDownload is loaded from disk.
This will prevent bug 141758 from happening.

BUG: 141758



 M  +7 -2      chunkdownload.cpp  
 M  +1 -1      chunkdownload.h  
 M  +20 -4     downloader.cpp  


--- trunk/extragear/network/ktorrent/libktorrent/torrent/chunkdownload.cpp #634517:634518
@@ -374,9 +374,12 @@
 		}
 	}
 		
-	void ChunkDownload::load(File & file,ChunkDownloadHeader & hdr)
+	bool ChunkDownload::load(File & file,ChunkDownloadHeader & hdr)
 	{
 		// read pieces
+		if (hdr.num_bits == 0)
+			return false; 
+		
 		pieces = BitSet(hdr.num_bits);
 		Array<Uint8> data(pieces.getNumBytes());
 		file.read(data,pieces.getNumBytes());
@@ -385,7 +388,8 @@
 		if (hdr.buffered)
 		{
 			// if it's a buffered chunk, load the data to
-			file.read(chunk->getData(),chunk->getSize());
+			if (file.read(chunk->getData(),chunk->getSize()) != chunk->getSize())
+				return false;
 		}
 		
 		for (Uint32 i = 0;i < pieces.getNumBits();i++)
@@ -393,6 +397,7 @@
 				piece_queue.remove(i);
 		
 		updateHash();
+		return true;
 	}
 
 	Uint32 ChunkDownload::bytesDownloaded() const
--- trunk/extragear/network/ktorrent/libktorrent/torrent/chunkdownload.h #634517:634518
@@ -135,7 +135,7 @@
 		 * Load from a File
 		 * @param file The File
 		 */
-		void load(File & file,ChunkDownloadHeader & hdr);
+		bool load(File & file,ChunkDownloadHeader & hdr);
 
 		/**
 		 * Cancel all requests.
--- trunk/extragear/network/ktorrent/libktorrent/torrent/downloader.cpp #634517:634518
@@ -540,11 +540,27 @@
 			{
 				ChunkDownload* cd = new ChunkDownload(c);
 				current_chunks.insert(hdr.index,cd);
-				cd->load(fptr,hdr);
-				downloaded += cd->bytesDownloaded();
+				bool ret = false;
+				try
+				{
+					ret = cd->load(fptr,hdr);
+				}
+				catch (...)
+				{
+					ret = false;
+				}
+				
+				if (!ret)
+				{
+					delete cd;
+				}
+				else
+				{
+					downloaded += cd->bytesDownloaded();
 			
-				if (tmon)
-					tmon->downloadStarted(cd);
+					if (tmon)
+						tmon->downloadStarted(cd);
+				}
 			}
 		}
 		
Comment 4 Joris Guisson 2007-02-17 15:46:20 UTC
*** Bug 139607 has been marked as a duplicate of this bug. ***
Comment 5 William Lee 2007-02-17 17:35:38 UTC
+++Make sure all exceptions are caught when a ChunkDownload is loaded from disk.
This will prevent bug 141758 from happening. +++

If that was for me, I don't understand it. I'll try...I didn't get any exceptions or anything other than a crash.  If that was for me, would you be so kind as to dumb it down for a non-programmer?  

Could it be that one of the dependencies is corrupted?  The only other thing that may be relevant is that I put Limewire on it, I downloaded the .rpm file and used alien to convert it to a .deb file then installed it.  

Again, thank you for your valuable time!
Comment 6 Joris Guisson 2007-02-18 12:29:08 UTC
It's fixed, if you really want to know what an exception is, then you should learn C++.
Comment 7 William Lee 2007-02-19 00:46:17 UTC
I don't understand.  If it is fixed, then why is it still crashing?  What do I need to do to get my KTorrent to stop crashing?  I uninstalled it from synaptic, reinstalled it, and still the same error?   Help?

And as far as me learning C++, I would really like to, but my contribution to the linux community is teaching Windows users how to replace their Microsoft OS.  I tell them it is better supported...
Comment 8 Joris Guisson 2007-02-19 08:15:47 UTC
The fix will be included in our next release (2.1.1)