Bug 213566

Summary: Amarok crashes when unmounting a media player when playing from that media player
Product: [Applications] amarok Reporter: Robin Appelman <robin>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED DUPLICATE    
Severity: crash CC: aikawarazuni
Priority: NOR    
Version: 2.2.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Robin Appelman 2009-11-07 17:05:48 UTC
Version:           2.2.0 (using KDE 4.3.3)
OS:                Linux
Installed from:    Ubuntu Packages

When you are playing from a media player and unmount the media player using amarok, amarok crashes.

Even though it's weird to remove the device currently playing from it isn't unlikely that people will do it.

I think that either amarok has to give a warning that the device is in use or it should stop playback.
Comment 1 Myriam Schweingruber 2009-11-07 19:19:09 UTC
We can't detect where the problem lies without a valid backtrace, sorry.

Since you are using Kubuntu, you will need amarok-dbg and phonon-dbg at least, ideally you should also have kdelibs5-dbg, libqt4-dbg and  libglib2.0-0-dbg. That should cover most of the crashes. 

Please start amarok from a konsole with 'amarok -d --nofork' and reproduce this crash, then please post the resulting backtrace from Dr. Konqi inline here so we can have a look at.
Comment 2 Robin Appelman 2009-11-07 20:13:44 UTC
Dr. Konqi doesn't start when amarok crashes but this is the last part of the output from the command line:

amarok: BEGIN: void MediaDeviceCache::slotRemoveSolidDevice(const QString&)                                                                                                                                                      
amarok:   [MediaDeviceCache] udi is:  "/org/freedesktop/Hal/devices/usb_device_41e_4157_1AFA0001A7DC81A20002D9A5F93841A2_if0"                                                                                                    
amarok:   BEGIN: void MediaDeviceMonitor::slotDeviceRemoved(const QString&)                                                                                                                                                      
amarok:     BEGIN: virtual void ConnectionAssistant::tellDisconnected(const QString&)                                                                                                                                            
amarok:       BEGIN: void MediaDeviceCollectionFactoryBase::slotDeviceDisconnected(const QString&)                                                                                                                               
amarok:         BEGIN: void MediaDeviceCollection::deleteCollection()                                                                                                                                                            
amarok:         END__: void MediaDeviceCollection::deleteCollection() - Took 8.1e-05s                                                                                                                                            
amarok:       END__: void MediaDeviceCollectionFactoryBase::slotDeviceDisconnected(const QString&) - Took 0.00022s                                                                                                               
amarok:     END__: virtual void ConnectionAssistant::tellDisconnected(const QString&) - Took 0.00035s                                                                                                                            
amarok:   END__: void MediaDeviceMonitor::slotDeviceRemoved(const QString&) - Took 0.00048s                                                                                                                                      
amarok: END__: void MediaDeviceCache::slotRemoveSolidDevice(const QString&) - Took 0.00079s                                                                                                                                      
amarok: BEGIN: void MountPointManager::deviceRemoved(const QString&)                                                                                                                                                             
amarok: END__: void MountPointManager::deviceRemoved(const QString&) - Took 6.5e-05s                                                                                                                                             
amarok: BEGIN: void Meta::MediaDeviceHandler::slotDeletingHandler()                                                                                                                                                              
amarok:   BEGIN: void PlaylistManager::removeProvider(PlaylistProvider*)                                                                                                                                                         
amarok:      Providers of this category:  3                                                                                                                                                                                      
amarok:      Removing provider from map                                                                                                                                                                                          
amarok:      Removed provider from map: true                                                                                                                                                                                     
amarok:      Providers removed:  1                                                                                                                                                                                               
amarok:     BEGIN: void PlaylistManager::slotUpdated()                                                                                                                                                                           
amarok:       BEGIN: void PlaylistBrowserNS::UserModel::slotUpdate()                                                                                                                                                             
amarok:         BEGIN: void PlaylistBrowserNS::UserModel::loadPlaylists()                                                                                                                                                        
amarok:           BEGIN: Meta::PlaylistList PlaylistManager::playlistsOfCategory(int)                                                                                                                                            
amarok:             BEGIN: Meta::SqlPlaylistList Meta::SqlPlaylistGroup::childSqlPlaylists() const                                                                                                                               
amarok:             END__: Meta::SqlPlaylistList Meta::SqlPlaylistGroup::childSqlPlaylists() const - Took 6.8e-05s                                                                                                               
amarok:             BEGIN: Meta::SqlPlaylistGroupList Meta::SqlPlaylistGroup::childSqlGroups() const                                                                                                                             
amarok:             END__: Meta::SqlPlaylistGroupList Meta::SqlPlaylistGroup::childSqlGroups() const - Took 6.5e-05s                                                                                                             
amarok:           END__: Meta::PlaylistList PlaylistManager::playlistsOfCategory(int) - Took 0.00032s                                                                                                                            
amarok:         END__: void PlaylistBrowserNS::UserModel::loadPlaylists() - Took 0.00044s                                                                                                                                        
"building tree with 7 leafs."                                                                                                                                                                                                    
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QString :  QVariant(QString, "")                                                                                                                                                                                                 
QIcon :  QVariant(QIcon, )                                                                                                                                                                                                       
QString :  QVariant(QString, "")
QString :  QVariant(QString, "")
m_groupHash:
(0, 1, 2, 3, 4, 5, 6)
amarok:       END__: void PlaylistBrowserNS::UserModel::slotUpdate() - Took 0.0012s
amarok:       BEGIN: Meta::PlaylistList PlaylistManager::playlistsOfCategory(int)
amarok:       END__: Meta::PlaylistList PlaylistManager::playlistsOfCategory(int) - Took 6.6e-05s
amarok:     END__: void PlaylistManager::slotUpdated() - Took 0.0015s
amarok:   END__: void PlaylistManager::removeProvider(PlaylistProvider*) - Took 0.0017s
amarok: END__: void Meta::MediaDeviceHandler::slotDeletingHandler() - Took 0.0019s
amarok: BEGIN: void CollectionTreeView::slotExpand(const QModelIndex&)
amarok:    modelindex =  QModelIndex(0,0,0x2d91b20,SingleCollectionTreeItemModel(0x2d90ee0) )
amarok:    m_filterModel ?  true
amarok: END__: void CollectionTreeView::slotExpand(const QModelIndex&) - Took 0.0002s
amarok: BEGIN: void SqlQueryMaker::handleAlbums(const QStringList&)
amarok: END__: void SqlQueryMaker::handleAlbums(const QStringList&) - Took 0.00026s
amarok: BEGIN: virtual MtpCollection::~MtpCollection()
amarok: END__: virtual MtpCollection::~MtpCollection() - Took 0.00015s
amarok: BEGIN: virtual MediaDeviceCollection::~MediaDeviceCollection()
amarok: END__: virtual MediaDeviceCollection::~MediaDeviceCollection() - Took 7.4e-05s
amarok: BEGIN: virtual Meta::MtpHandler::~MtpHandler()
amarok:   [MtpHandler] Folders destroyed
ERROR: Could not close session!
inep: usb_get_endpoint_status(): No such device
outep: usb_get_endpoint_status(): No such device
usb_clear_halt() on IN endpoint: No such device
usb_clear_halt() on OUT endpoint: No such device
usb_clear_halt() on INTERRUPT endpoint: No such device
amarok:   [MtpHandler] Device released
amarok: END__: virtual Meta::MtpHandler::~MtpHandler() - Took 0.0021s
amarok: BEGIN: virtual Meta::MediaDeviceHandler::~MediaDeviceHandler()
amarok:   BEGIN: virtual MediaDeviceUserPlaylistProvider::~MediaDeviceUserPlaylistProvider()
amarok:   END__: virtual MediaDeviceUserPlaylistProvider::~MediaDeviceUserPlaylistProvider() - Took 6.7e-05s
amarok: END__: virtual Meta::MediaDeviceHandler::~MediaDeviceHandler() - Took 0.00023s
amarok: BEGIN: void CollectionTreeView::slotExpand(const QModelIndex&)
amarok:    modelindex =  QModelIndex(0,0,0x2be39f0,SingleCollectionTreeItemModel(0x2d90ee0) )
amarok:    m_filterModel ?  true
amarok: END__: void CollectionTreeView::slotExpand(const QModelIndex&) - Took 0.00023s
amarok: BEGIN: void MediaDeviceCache::slotRemoveSolidDevice(const QString&)
amarok:   [MediaDeviceCache] udi is:  "/org/freedesktop/Hal/devices/usb_device_41e_4157_1AFA0001A7DC81A20002D9A5F93841A2"
amarok:   [MediaDeviceCache] Odd, got a deviceRemoved at udi  "/org/freedesktop/Hal/devices/usb_device_41e_4157_1AFA0001A7DC81A20002D9A5F93841A2"  but it did not seem to exist in the first place...
amarok:   BEGIN: void MediaDeviceMonitor::slotDeviceRemoved(const QString&)
amarok:   END__: void MediaDeviceMonitor::slotDeviceRemoved(const QString&) - Took 7.6e-05s
amarok: END__: void MediaDeviceCache::slotRemoveSolidDevice(const QString&) - Took 0.016s
amarok: BEGIN: void MountPointManager::deviceRemoved(const QString&)
amarok: END__: void MountPointManager::deviceRemoved(const QString&) - Took 6.6e-05s
amarok: BEGIN: void AmarokDownloadHelper::resultString(KJob*)
amarok:   BEGIN: void LyricsSubject::sendLyricsMessage(QString, QString)
amarok:     BEGIN: virtual void LyricsEngine::lyricsMessage(QString&, QString&)
amarok:     END__: virtual void LyricsEngine::lyricsMessage(QString&, QString&) - Took 6.2e-05s
amarok:   END__: void LyricsSubject::sendLyricsMessage(QString, QString) - Took 0.00018s
amarok:    SCRIPT "Lyricwiki" :  "No lyrics found for artist=Artillery, song=Sandbox_Philosophy"
amarok: END__: void AmarokDownloadHelper::resultString(KJob*) - Took 0.018s
amarok:  collapsing applet to... 120
amarok: BEGIN: void Playlist::PrettyListView::trackActivated(const QModelIndex&)
amarok:   BEGIN: void Playlist::Actions::play(quint64, bool)
amarok:     [Playlist::Actions] Manually advancing to the next track, calculating previous statistics for track here.  Finished % is:  0.0457746
amarok:     BEGIN: void EngineController::play(const Meta::TrackPtr&, uint)
KCrash: Application 'amarok' crashing...
sock_file=/home/robin/.kde/socket-Amaya/kdeinit4__0
Assertion 'pa_close(fds[0]) == 0' failed at pulsecore/core-util.c:2165, function pa_close_pipe(). Aborting.
Unable to start Dr. Konqi


Also, I noticed when trying to recreate the bug that it only happens when chosing a new song after disconnecting the media player, I didn't notice that last time since the song was almost finished when I disconnected it and it started a new song almost instant after I removed my media player.
Comment 3 Myriam Schweingruber 2009-11-07 23:39:35 UTC
To get a backtrace, you could try to get one with gdb:

the command would be 'gdb --args amarok --debug --nofork'
and then type 'run' once gdb starts
Comment 4 Robin Appelman 2009-11-08 02:03:03 UTC
It got me a backtrace but I don't think it is very usefull:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7225cad in Meta::MediaDeviceTrack::prepareToPlay (this=<value optimized out>) at /build/buildd/amarok-2.2.0/src/collection/mediadevicecollection/MediaDeviceMeta.cpp:351
351     /build/buildd/amarok-2.2.0/src/collection/mediadevicecollection/MediaDeviceMeta.cpp: No such file or directory.
        in /build/buildd/amarok-2.2.0/src/collection/mediadevicecollection/MediaDeviceMeta.cpp
Comment 5 Myriam Schweingruber 2009-11-08 02:12:58 UTC
hm, not realy, it doesn't show where it crashes. And that's all you get with gdb? Strange...
Comment 6 Myriam Schweingruber 2009-11-11 19:23:01 UTC
I actually found a previous bug with the same indications, marking as duplicate.

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