Bug 35747 - Crash on contactPtr->id() and contactPtr is not 0
Summary: Crash on contactPtr->id() and contactPtr is not 0
Status: RESOLVED NOTOURBUG
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: unspecified
Hardware: ARM other
: medium critical
Assignee: jeremias.bosch
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2011-03-28 09:54 UTC by jeremias.bosch
Modified: 2011-04-07 05:02 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description jeremias.bosch 2011-03-28 09:54:14 UTC
See Log for details:

tp-qt4 0.5.7 DEBUG: Client registered - busName: "org.freedesktop.Telepathy.Client.RingCallPrototype._1._90.xffffffffbea63868" objectPath: "/org/freedesktop/Telepathy/Client/RingCallPrototype/_1/_90/xffffffffbea63868" interfaces: ("org.freedesktop.Telepathy.Client.Handler")                                                                                                                                                                                                                    
tp-qt4 0.5.7 DEBUG: Creating new DBusProxy                                                                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: Creating new AccountManager: "org.freedesktop.Telepathy.AccountManager"                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)                                                                                                                                                                               
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::AccountManager",0) )                                                                                                                                                  
tp-qt4 0.5.7 DEBUG: Calling Properties::GetAll(AccountManager)                                                                                                                                                                                     
tp-qt4 0.5.7 DEBUG: Got reply to Properties.GetAll(AccountManager)                                                                                                                                                                                 
tp-qt4 0.5.7 DEBUG: Creating new DBusProxy                                                                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)                                                                                                                                                                               
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Account",0) ,  QPair("Tp::Account",1) ,  QPair("Tp::Account",2) ,  QPair("Tp::Account",3) )                                                                           
tp-qt4 0.5.7 DEBUG: Inserting to factory cache proxy for QPair("org.freedesktop.Telepathy.AccountManager","/org/freedesktop/Telepathy/Account/ring/tel/account0")                                                                                  
tp-qt4 0.5.7 DEBUG: Discovering if the Channel Dispatcher supports request hints                                                                                                                                                                   
tp-qt4 0.5.7 DEBUG: PendingVariant call failed: "org.freedesktop.Telepathy.Error.NotImplemented": "Unknown property SupportsRequestHints on org.freedesktop.Telepathy.ChannelDispatcher"                                                           
tp-qt4 0.5.7 WARN: (Too old?) Channel Dispatcher failed to tell us whether it supports request hints, assuming it doesn't: "org.freedesktop.Telepathy.Error.NotImplemented" : "Unknown property SupportsRequestHints on org.freedesktop.Telepathy.ChannelDispatcher"                                                                                                                                                                                                                                  
tp-qt4 0.5.7 DEBUG: Calling Properties::GetAll(Account) on  "/org/freedesktop/Telepathy/Account/ring/tel/account0"                                                                                                                                 
tp-qt4 0.5.7 DEBUG: Got reply to Properties.GetAll(Account) for "/org/freedesktop/Telepathy/Account/ring/tel/account0"                                                                                                                             
tp-qt4 0.5.7 DEBUG: Account::updateProperties: changed:                                                                                                                                                                                            
tp-qt4 0.5.7 DEBUG:  Interfaces: ("org.freedesktop.Telepathy.Account", "org.freedesktop.Telepathy.Account.Interface.Avatar", "com.nokia.Account.Interface.ChannelRequests", "com.nokia.Account.Interface.Compat", "com.nokia.Account.Interface.Conditions", "org.freedesktop.Telepathy.Account.Interface.Storage", "com.nokia.Account.Interface.Stats", "org.freedesktop.Telepathy.Account.Interface.MinimumPresence.DRAFT", "org.freedesktop.Telepathy.Account.Interface.Addressing")                
tp-qt4 0.5.7 DEBUG:  Display Name: "ringaccountname"                                                                                                                                                                                               
tp-qt4 0.5.7 DEBUG:  Normalized Name: "<SelfHandle>"                                                                                                                                                                                               
tp-qt4 0.5.7 DEBUG:  Valid: true                                                                                                                                                                                                                   
tp-qt4 0.5.7 DEBUG:  Enabled: true                                                                                                                                                                                                                 
tp-qt4 0.5.7 DEBUG:  Connects Automatically: true                                                                                                                                                                                                  
tp-qt4 0.5.7 DEBUG:  HasBeenOnline changed to true                                                                                                                                                                                                 
tp-qt4 0.5.7 DEBUG:  Automatic Presence: 2 - "available"                                                                                                                                                                                           
tp-qt4 0.5.7 DEBUG:  Requested Presence: 2 - "online"                                                                                                                                                                                              
tp-qt4 0.5.7 DEBUG:  Changing Presence: true                                                                                                                                                                                                       
tp-qt4 0.5.7 DEBUG:  Connection Object Path: "/org/freedesktop/Telepathy/Connection/ring/tel/ring"                                                                                                                                                 
tp-qt4 0.5.7 DEBUG: Building connection "/org/freedesktop/Telepathy/Connection/ring/tel/ring" for account "/org/freedesktop/Telepathy/Account/ring/tel/account0"                                                                                   
tp-qt4 0.5.7 DEBUG: Creating new DBusProxy                                                                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: Connecting to ConnectionError()                                                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: Connecting to StatusChanged()                                                                                                                                                                                                  
tp-qt4 0.5.7 DEBUG: Connecting to SelfHandleChanged()                                                                                                                                                                                              
tp-qt4 0.5.7 DEBUG: Creating new HandleContext for "/org/freedesktop/Telepathy/Connection/ring/tel/ring"                                                                                                                                           
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedStatuses = QSet(0, 4294967295, 2)                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Connection",6) ,  QPair("Tp::Connection",5) ,  QPair("Tp::Connection",4) ,  QPair("Tp::Connection",2) ,  QPair("Tp::Connection",1) ,  QPair("Tp::Connection",0) )     
tp-qt4 0.5.7 DEBUG: Inserting to factory cache proxy for QPair(":1.44","/org/freedesktop/Telepathy/Connection/ring/tel/ring")                                                                                                                      
tp-qt4 0.5.7 DEBUG:  Connection Status: 0                                                                                                                                                                                                          
tp-qt4 0.5.7 DEBUG:  Connection StatusReason: 1                                                                                                                                                                                                    
tp-qt4 0.5.7 DEBUG: Deferring finishing Account::FeatureCore until the connection is built                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: Connection "/org/freedesktop/Telepathy/Connection/ring/tel/ring" built for "/org/freedesktop/Telepathy/Account/ring/tel/account0"                                                                                              
tp-qt4 0.5.7 DEBUG: Account "/org/freedesktop/Telepathy/Account/ring/tel/account0" basic functionality is ready (connections built)                                                                                                                
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Account",0) - success: true                                                                                                                                       
void MInputContext::connectToDBus()                                                                                                                                   
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::AccountManager",0) - success: true
onAccountManagerReady account manager ready
onAccountManagerReady "got 1 accounts from mission control"
tp-qt4 0.5.7 DEBUG: Creating new DBusProxy
tp-qt4 0.5.7 DEBUG: Creating new ConnectionManager: "org.freedesktop.Telepathy.ConnectionManager.ring"
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
tp-qt4 0.5.7 DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::ConnectionManager",0) )
tp-qt4 0.5.7 DEBUG: parsing manager file "/usr/share/telepathy/managers/ring.manager"
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::ConnectionManager",0) - success: true
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Account",2) - success: true
tp-qt4 0.5.7 DEBUG: Calling Properties::GetAll(Connection)
tp-qt4 0.5.7 DEBUG: Got status: 0
tp-qt4 0.5.7 DEBUG: Got interfaces: ("org.freedesktop.Telepathy.Connection.Interface.Requests", "org.freedesktop.Telepathy.Connection.Interface.Contacts", "org.freedesktop.Telepathy.Connection.Interface.Capabilities", "org.freedesktop.Telepathy.Connection.Interface.ServicePoint", "org.freedesktop.Telepathy.Connection.Interface.Cellular", "org.freedesktop.Telepathy.Connection.Interface.Anonymity")
tp-qt4 0.5.7 DEBUG: Retrieving capabilities
tp-qt4 0.5.7 DEBUG: Got capabilities
tp-qt4 0.5.7 DEBUG: Retrieving contact attribute interfaces
tp-qt4 0.5.7 DEBUG: Got contact attribute interfaces
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",0) - success: true
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Account",3) - success: true

onAccountReady account ready





================================================

                                                                                                                                                                                                    
tp-qt4 0.5.7 DEBUG: Got reply to StreamedMedia::ListStreams()                                                                                                                                                                                      
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::StreamedMediaChannel",0) - success: true                                                                                                                          
tp-qt4 0.5.7 WARN: StreamedMedia::Hold::GetHoldState() failed with "org.freedesktop.Telepathy.Error.Disconnected": "Channel is not connected"                                                                                                      
tp-qt4 0.5.7 DEBUG: Ignoring error getting hold state and assuming we're not on hold                                                                                                                                                               
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::StreamedMediaChannel",1) - success: true                                                                                                                          
tp-qt4 0.5.7 WARN: Tp::PendingReady(0x83c7e0) trying to finish with success, but already succeeded                                                                                                                                                 
Channel became successfully ready.                                                                                                                                                                                  
tp-qt4 0.5.7 DEBUG: Introspecting roster                                                                                                                                                                                                           
tp-qt4 0.5.7 DEBUG: Connection.ContactList not found, falling back to contact list channels                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Requesting handle for "subscribe" channel                                                                                                                                                                                      
tp-qt4 0.5.7 DEBUG: Request for 1 handles of type 3                                                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: PendingHandles(request)                                                                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Requesting handle for "publish" channel                                                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Request for 1 handles of type 3                                                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: PendingHandles(request)                                                                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Requesting handle for "stored" channel                                                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: Request for 1 handles of type 3                                                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: PendingHandles(request)                                                                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Requesting handle for "deny" channel                                                                                                                                                                                           
tp-qt4 0.5.7 DEBUG: Request for 1 handles of type 3                                                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: PendingHandles(request)                                                                                                                                                                                                        
tp-qt4 0.5.7 DEBUG: Building self contact                                                                                                                                                                                                          
tp-qt4 0.5.7 DEBUG: 0 contact features supported using Tp::ContactManager(0x8357d8)                                                                                                                                                                
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",1) - success: true                                                                                                                                    
tp-qt4 0.5.7 DEBUG: Unable to retrieve handle for "subscribe" channel, ignoring                                                                                                                                                                    
tp-qt4 0.5.7 DEBUG: Unable to retrieve handle for "publish" channel, ignoring                                                                                                                                                                      
tp-qt4 0.5.7 DEBUG: Unable to retrieve handle for "stored" channel, ignoring                                                                                                                                                                       
tp-qt4 0.5.7 DEBUG: Unable to retrieve handle for "deny" channel, ignoring                                                                                                                                                                         
tp-qt4 0.5.7 DEBUG: Introspecting roster finished                                                                                                                                                                                                  
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",4) - success: true                                                                                                                                    
Channel connection became successfully ready!                                                                                                                                                                                                      
NUMBER OF ACCOUNT 1                                                                                                                                                                                                                                
name of account "<SelfHandle>"                                                                                                                                                                                                                     
adding features.... see http://pastebin.mozilla.org/1193530
                                                                                                                                                     
tp-qt4 0.5.7 DEBUG: Introspecting roster groups
tp-qt4 0.5.7 DEBUG: Connection.ContactGroups not found, falling back to contact list group channels
tp-qt4 0.5.7 DEBUG: Connecting to Requests.NewChannels
tp-qt4 0.5.7 DEBUG: Retrieving channels
tp-qt4 0.5.7 DEBUG: feature QPair("Tp::Connection",2) depends on interfaces ("org.freedesktop.Telepathy.Connection.Interface.SimplePresence") , but interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence" is not present
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",2) - success: false
tp-qt4 0.5.7 DEBUG: Got channels
tp-qt4 0.5.7 DEBUG: Introspecting roster groups finished
tp-qt4 0.5.7 DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",5) - success: true
HANDLE: 4
tp-qt4 0.5.7 DEBUG: Request for 1 handles of type 1
tp-qt4 0.5.7 DEBUG: PendingHandles(request)


tp-qt4 0.5.7 DEBUG: Received reply to RequestHandles
tp-qt4 0.5.7 DEBUG: 0 contact features supported using Tp::ContactManager(0x8357d8)
tp-qt4 0.5.7 DEBUG: Request for attributes for 1 contacts
tp-qt4 0.5.7 DEBUG: 0 contact features supported using Tp::ContactManager(0x8357d8)
tp-qt4 0.5.7 DEBUG: Contact "0123120589107" destroyed //NUMBER CHANGED!
SIZE OF LIST 1
OPEN AUDIO STREAM
Channel usable!
Contact ID:
Segmentation fault (core dumped)
Comment 1 Olli Salli 2011-04-04 01:17:58 UTC
A dangling pointer or other memory corruption. Now, as Tp::ContactPtr is a reference-counted shared pointer, unless you're somewhere digging out the bare pointers from them and/or deleting the pointed-to contacts, both of which would be incorrect usage, the only way one could have a dangling Tp::ContactPtr is also memory corruption of the reference count field in the Contact or the pointer structure itself.

So, could you please run your application in Valgrind (memcheck tool) to spot the source of the memory corruption? Failing that, could you post a minimal testcase reproducing this?

One other reason how the reference counting could fail could be use of threads. All TpQt4 functionality must be used from a single thread only. This includes even delayed slot connections across threads for Tp::PendingOperation finishes etc.
Comment 2 jeremias.bosch 2011-04-07 04:35:25 UTC
I dont get valgrind working.

simple test is, 

Tp::ConnectionPtr connection = streamedMediachannel->connection();
Tp::ContactManagerPtr contactManager = connection->contactManager();
Tp::PendingContacts* pc = contactManager->contactsForIdentifiers( QStringList()<< mContactIdView->text()  );
pc->contacts().first()->id();
Comment 3 Olli Salli 2011-04-07 04:41:27 UTC
(In reply to comment #2)
> I dont get valgrind working.
> 
> simple test is, 
> 
> Tp::ConnectionPtr connection = streamedMediachannel->connection();
> Tp::ContactManagerPtr contactManager = connection->contactManager();
> Tp::PendingContacts* pc = contactManager->contactsForIdentifiers(
> QStringList()<< mContactIdView->text()  );

You waited for the PendingContacts to finish, and checked that it was successful at this point, right?

> pc->contacts().first()->id();

That aside, this is not a standalone case reproducing the issue. If you want us to Valgrind the issue for you, you must post code compilable and runnable stand-alone. Numerous applications incorporating the above or equivalent sequence of calls to the ones mentioned above (but correctly waiting for the PendingContacts to finish successfully) exist, with no reports of ill behavior. Therefore, you must post a *full, runnable test application reproducing the problem*, or get Valgrind working for yourself so you can run your current application in it.
Comment 4 jeremias.bosch 2011-04-07 04:48:58 UTC
My time for this is really short. The code as you see it here is exactly the functional code (there was a check of pc->contacts().first()->notNull()) to ensure its valid.

It should not crash. Dont expect a running testcase from me. Feel free to close this if you think its a good idea to ignore issues because reporters have other work. 

I would appreciate when you try to get stuff more stable and save.
Comment 5 Olli Salli 2011-04-07 05:02:26 UTC
If the code is exactly that, then the issue is that you aren't waiting for the PendingContacts to finish. Just like any other PendingOperation, you must connect the finished(Tp::PendingOperation *) signal to a slot, and extract the result when that slot has been invoked, after you've checked that the operation was finished successfully (it might, in particular finish with a failure e.g. if you pass an invalid ID to it, or due to an internal error in the connection manager D-Bus service).

If you try to extract information from the PendingContacts right after it has been created (at which point no D-Bus calls have been able to be made yet), its contacts() accessor will most likely return an empty list. Calling first() on an empty QList results in uninitialized behavior, namely either crashing or returning completely random data (in this case a random ContactPtr). Hence you getting an invalid ContactPtr.

I strongly suggest adopting the use of Valgrind or other memory error checking tools. In this case, it would have reported that your call to QList<ContactPtr>::first() accessed uninitialized, or not-allocated memory.

As for having no time, surely as a developer you must appreciate the fact that to be able to investigate bugs, one must have adequate information on how to reproduce the issue? A way to reproduce an issue being the essence of what a bug is about, anyway. And as this is a memory corruption bug, adequate information either is a full testcase for producing the memory state which triggers the issue, or a report from a memory access checker tool which has already analyzed potential issues in the memory usage pattern.

Closing the bug. Please reopen if, having followed these steps, the problem still persists.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.