Bug 113439 - crash accepting a webcam in yahoo protocol
Summary: crash accepting a webcam in yahoo protocol
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Yahoo Plugin (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 117274 124334 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-27 15:56 UTC by fredi
Modified: 2006-03-27 11:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
debug log of the cam session on yahoo (37.74 KB, text/plain)
2005-09-29 17:01 UTC, fredi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fredi 2005-09-27 15:56:14 UTC
Version:           from svn, as of yesterday 26/9/2005 (using KDE KDE 3.4.2)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8) 
OS:                Linux

I'll try to rebuild with full debugging and svn up. The crash happened (it seemed) when kopete began recieving the immages from the other peer.
Contact me for any aditional info.
The crash log was this:


Using host libthread_db library "/lib/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 7589)]
[New Thread 32769 (LWP 7590)]
0xb559f26b in waitpid () from /lib/libpthread.so.0
#0  0xb559f26b in waitpid () from /lib/libpthread.so.0
#1  0xb629624c in ?? () from /usr/kde/3.4/lib/libkdecore.so.4
#2  0x00000000 in ?? ()
#3  0xb61accf0 in KCrash::defaultCrashHandler ()
   from /usr/kde/3.4/lib/libkdecore.so.4
#4  0x00000000 in ?? ()
#5  0x00000000 in ?? ()
#6  0xb559c6ca in __pthread_alt_lock () from /lib/libpthread.so.0
Comment 1 Antonio E. 2005-09-27 19:20:22 UTC
Exactly the same thing happened this morning.
Comment 2 fredi 2005-09-29 16:58:04 UTC
Ok, i gave another try to the cam support (only recieving, i dont have a webcam) for yahoo's protocol. This time i recieved immages but after some seconds the immage stopped. The normal IM functionality keept functioning for some other seconds then i got disconnected from yahoo. Then i restarted kopete.
I saw no code changes from my first try till now, so seems the crash is not that easy to reproduce. But this time i started kopete from console so i have the debugging messages of the session described. For obvious reasons i changed the accounts and IM messages in the debug log, substituted them with xxx or such.
Except some messages that were not personal, ex. when i asked the other to start the cam and when the immage stopped.
Hope it helps.
I'll put the log as attachment.
Comment 3 fredi 2005-09-29 17:01:17 UTC
Created attachment 12764 [details]
debug log of the cam session on yahoo

You can see all the activity, before i begin to recieve cam immages, when the
immage stops (read the IM messages i left in the debug) till after i get
disconnected from yahoo.
Comment 4 Andre Duffeck 2005-10-07 14:18:48 UTC
Hi,
Are you sure that your libyahoo2 was recompiled (was changed on Aug 29)?
The symptoms are the same as the random disconnects i got when yahoo introduced their new client version and decided to doom YMSG10 clients.
Comment 5 fredi 2005-10-07 16:48:25 UTC
Yes, the checkout was done some days before the crash. 
Comment 6 Andre Duffeck 2005-11-29 15:24:09 UTC
*** Bug 117274 has been marked as a duplicate of this bug. ***
Comment 7 Andre Duffeck 2005-12-02 16:47:46 UTC
SVN commit 485011 by duffeck:

Fix Webcam disconnects/crashes.
BUG:113439


 M  +51 -24    kyahoo.cpp  
 M  +4 -4      kyahoo.h  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/kyahoo.cpp #485010:485011
@@ -88,27 +88,26 @@
 {
 }
 
-void YahooConnectionManager::addConnection( KStreamSocket* socket )
+void YahooConnectionManager::addConnection( QPair< KStreamSocket*, void *> *connection )
 {
-	kdDebug(14181) << k_funcinfo << "Adding socket with fd " << socket->socketDevice()->socket() << endl;
+	kdDebug(14181) << k_funcinfo << "Adding socket with fd " << connection->first->socketDevice()->socket() << endl;
 	
-	m_connectionList.append( socket );
+	m_connectionList.append( connection );
 }
 
-KStreamSocket* YahooConnectionManager::connectionForFD( int fd )
+QPair< KStreamSocket*, void *> *YahooConnectionManager::connectionForFD( int fd )
 {
 	//kdDebug(14181) << k_funcinfo << "Looking for socket with fd " << fd << endl;
-	QValueList<KStreamSocket*>::const_iterator it, ycEnd = m_connectionList.constEnd();
+	QValueList< QPair< KStreamSocket*, void *> *>::const_iterator it, ycEnd = m_connectionList.constEnd();
 	KSocketDevice *dev;
 	
 	for ( it = m_connectionList.begin(); it != ycEnd; ++it )
 	{
-		dev = ( *it )->socketDevice();
+		dev = ( *it )->first->socketDevice();
 		if ( dev->socket() == fd )
 		{
 			//kdDebug(14181) << k_funcinfo << "Found socket" << endl;
-			KStreamSocket* socket = ( *it );
-			return socket;
+			return *it;
 		}
 	}
 	
@@ -117,11 +116,11 @@
 
 void YahooConnectionManager::remove( KStreamSocket* socket )
 {
-	QValueList<KStreamSocket*>::iterator it, ycEnd = m_connectionList.end();
+	QValueList< QPair< KStreamSocket*, void *> *>::iterator it, ycEnd = m_connectionList.end();
 	
 	for ( it = m_connectionList.begin(); it != ycEnd; it++ )
 	{
-		if ( ( *it ) == socket )
+		if ( ( *it )->first == socket )
 		{
 			socket->reset();
 			m_connectionList.remove( it );
@@ -133,11 +132,11 @@
 
 void YahooConnectionManager::reset()
 {
-	QValueList<KStreamSocket*>::iterator it, ycEnd = m_connectionList.end();
+	QValueList< QPair< KStreamSocket*, void *> *>::iterator it, ycEnd = m_connectionList.end();
 	
 	for ( it = m_connectionList.begin(); it != ycEnd; it++ )
 	{
-		KStreamSocket *socket = ( *it );
+		KStreamSocket *socket = ( *it )->first;
 		socket->reset();
 		it = m_connectionList.remove( it );
 		delete socket;
@@ -1072,7 +1071,11 @@
 
 void YahooSession::slotTransmitFile( int fd, YahooUploadData *uploadData )
 {
-	KStreamSocket* socket = m_connManager.connectionForFD( fd );
+	QPair< KStreamSocket*, void *> *connection =  m_connManager.connectionForFD( fd );
+	if( !connection )
+		return;
+		
+	KStreamSocket* socket = connection->first;
 	if( !socket )
 		return;
 	
@@ -1160,9 +1163,15 @@
 		KMessageBox::error(Kopete::UI::Global::mainWidget(), i18n( "An error occurred when trying to download the file." ), i18n("Error") );
 		return;
 	}
+	QPair< KStreamSocket*, void *> *connection =  m_connManager.connectionForFD( fd );
+	if( !connection )
+	{
+		kdDebug(14181) << k_funcinfo << "No connection found for fd." << endl;
+		return;
+	}
 	
-	KStreamSocket* socket = m_connManager.connectionForFD( fd );
-	if ( !socket )
+	KStreamSocket* socket = connection->first;
+	if( !socket )
 	{
 		kdDebug(14181) << k_funcinfo << "No existing socket for connection found. We're screwed" << endl;
 		return;
@@ -1423,21 +1432,23 @@
 {
 	//kdDebug(14181) << k_funcinfo << " " << m_connId << " Socket: " << fd << endl;
 
-	m_data = data;
 	if ( fd == -1 )
 	{
 		kdDebug(14181) << k_funcinfo << "why is fd -1?" << endl;
 		return -1;
 	}
 	
-	KStreamSocket* socket = m_connManager.connectionForFD( fd );
-	if ( !socket )
+	QPair< KStreamSocket*, void *> *connection = m_connManager.connectionForFD( fd );
+	if ( !connection )
 	{
 		kdDebug(14181) << k_funcinfo << "No existing socket for connection found. We're screwed"
 			<< endl;
 		return -1;
 	}
 	
+	KStreamSocket *socket = connection->first;
+	connection->second = data;
+	
 	/* This works ONLY IF (YAHOO_INPUT_READ==1 && YAHOO_INPUT_WRITE==2) */
 	int tag = 0;
 	if ( cond == YAHOO_INPUT_READ )
@@ -1468,13 +1479,14 @@
 	if ( tag == 0 )
 		return;
 
-	KStreamSocket* socket = m_connManager.connectionForFD( (tag-1)/2 );
-	if ( !socket )
+	QPair< KStreamSocket*, void *> *connection = m_connManager.connectionForFD( (tag-1)/2 );
+	if ( !connection )
 	{
 		kdDebug(14181) << k_funcinfo << "No existing socket for connection found. We're screwed"
 			<< endl;
 		return;
 	}
+	KStreamSocket *socket = connection->first;
 	/* This works ONLY IF (YAHOO_INPUT_READ==1 && YAHOO_INPUT_WRITE==2) */
 	if( tag % 2 == YAHOO_INPUT_READ ) {
 		//kdDebug(14181) << k_funcinfo << " read off" << endl;
@@ -1522,7 +1534,8 @@
 {
 	KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) );
 	kdDebug(14181) << k_funcinfo << " Connected! fd "<< socket->socketDevice()->socket() << endl;
-	m_connManager.addConnection( socket );
+	QPair< KStreamSocket*, void * > *connection = new QPair< KStreamSocket*, void * >( socket, 0L );
+	m_connManager.addConnection( connection );
 	
 	disconnect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotAsyncConnectSucceeded() ) );
 	disconnect( socket, SIGNAL( gotError(int) ), this, SLOT( slotAsyncConnectFailed(int) ) );
@@ -1623,7 +1636,14 @@
 	int fd = socket->socketDevice()->socket();
 	//kdDebug(14181) << k_funcinfo << "Socket FD: " << fd << endl;
 	
-	ret = yahoo_read_ready( m_connId , fd, m_data );
+	QPair< KStreamSocket*, void *> *connection = m_connManager.connectionForFD( fd );
+	if ( !connection )
+	{
+		kdDebug(14181) << k_funcinfo << "No connection found for socket!" << endl;
+		return;
+	}
+	
+	ret = yahoo_read_ready( m_connId , fd, connection->second );
 
 	if ( ret == -1 )
 		kdDebug(14181) << k_funcinfo << "Read Error (" << errno << ": " << strerror(errno) << endl;
@@ -1646,9 +1666,16 @@
 	
 	int fd = socket->socketDevice()->socket();
 	//kdDebug(14181) << k_funcinfo << "Socket FD: " << fd << endl;
+	
+	QPair< KStreamSocket*, void *> *connection = m_connManager.connectionForFD( fd );
+	if ( !connection )
+	{
+		kdDebug(14181) << k_funcinfo << "No connection found for socket!" << endl;
+		return;
+	}
+	
+	ret = yahoo_write_ready( m_connId , fd, connection->second );
 
-	ret = yahoo_write_ready( m_connId , fd, m_data );
-
 	if ( ret == -1 )
 		kdDebug(14181) << k_funcinfo << "Read Error (" << errno << ": " << strerror(errno) << endl;
 	else if ( ret == 0 )
--- branches/KDE/3.5/kdenetwork/kopete/protocols/yahoo/kyahoo.h #485010:485011
@@ -25,6 +25,7 @@
 #include <qmap.h>
 #include <qpixmap.h>
 #include <qbuffer.h>
+#include <qpair.h>
 
 #include "libyahoo2/yahoo2.h"
 #include "libyahoo2/yahoo2_callbacks.h"
@@ -70,12 +71,12 @@
 	 * from the connection manager and a new connection of that type is expected
 	 * to be created.
 	 */
-	void addConnection( KStreamSocket* socket );
+	void addConnection( QPair< KStreamSocket*, void * > *connection );
 	
 	/**
 	 * Get the connection by its file descriptor
 	 */
-	KStreamSocket* connectionForFD( int fd );
+	QPair< KStreamSocket*, void *> *connectionForFD( int fd );
 	
 	/**
 	 * Remove a connection from the manager
@@ -89,7 +90,7 @@
 	void reset();
 	
 private:
-	QValueList<KStreamSocket*> m_connectionList;
+	QValueList< QPair< KStreamSocket*, void *> *> m_connectionList;
 };
 	
 	
@@ -339,7 +340,6 @@
 	struct connect_callback_data *m_ccd;
 	
 	YahooConnectionManager m_connManager;
-	void *m_data;
 	
 	Kopete::Contact* m_contact;
 	Kopete::Transfer* m_kopeteTransfer;
Comment 8 olimpiu 2006-03-18 15:38:01 UTC
(no debugging symbols found)
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(no debugging symbols found)
`shared object read from target memory' has disappeared; keeping its symbols.
(no debugging symbols found).........................
.....................................................
(no debugging symbols found)
[KCrash handler]
#7  0x00000000 in ?? ()
#8  0xa5ec3cdc in yahoo_read_ready () from /usr/lib/kde3/kopete_yahoo.so
#9  0xa5ea2347 in YahooSession::slotReadReady ()
   from /usr/lib/kde3/kopete_yahoo.so
#10 0xa5ea3e3d in YahooSession::qt_invoke ()
   from /usr/lib/kde3/kopete_yahoo.so
#11 0xa6a93317 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#12 0xa6a93113 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#13 0xa715b6f8 in KNetwork::KClientSocketBase::readyRead ()
   from /usr/lib/libkdecore.so.4
#14 0xa715af5f in KNetwork::KClientSocketBase::slotReadActivity ()
   from /usr/lib/libkdecore.so.4
#15 0xa715b790 in KNetwork::KClientSocketBase::qt_invoke ()
   from /usr/lib/libkdecore.so.4
#16 0xa715ccc2 in KNetwork::KStreamSocket::qt_invoke ()
   from /usr/lib/libkdecore.so.4
#17 0xa6a93317 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#18 0xa6a9340e in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0xa6d84fb8 in QSocketNotifier::activated ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0xa6aad881 in QSocketNotifier::event ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0xa6a39b9f in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0xa6a39137 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#23 0xa701b19b in KApplication::notify () from /usr/lib/libkdecore.so.4
#24 0xa6a2994e in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0xa69e4877 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#26 0xa6a4a2ea in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0xa6a4a1d4 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0xa6a39db0 in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x0806d7bb in ?? ()
#30 0xafbc0610 in ?? ()
#31 0xafbc05f0 in ?? ()
#32 0xafbc0758 in ?? ()
#33 0x0806d764 in ?? ()
#34 0xa6e821e0 in vtable for QGArray () from /usr/lib/qt3/lib/libqt-mt.so.3
#35 0x0829f150 in ?? ()
#36 0xafbc0628 in ?? ()
#37 0xa634b37e in operator new () from /usr/lib/libstdc++.so.5
#38 0xa6172c57 in __libc_start_main () from /lib/i686/libc.so.6
#39 0x0806d221 in ?? ()
Comment 9 Andre Duffeck 2006-03-18 15:59:05 UTC
What's your kopete version? That was fixed in KDE 3.5.1
Comment 10 Andre Duffeck 2006-03-27 11:09:21 UTC
*** Bug 124334 has been marked as a duplicate of this bug. ***