Bug 172266 - KNode crashes when exporting twice
Summary: KNode crashes when exporting twice
Status: RESOLVED FIXED
Alias: None
Product: knode
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-06 12:25 UTC by Roy Schestowitz
Modified: 2010-04-23 14:28 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Schestowitz 2008-10-06 12:25:56 UTC
Version:           0.10.9 (using KDE 3.5.9)
OS:                Linux
Installed from:    Mandriva RPMs

Hi,

This bug has been there since KDE 3.1 at the earlier (in SuSE, Ubuntu, now Mandriva). Reproduce as follows:

1* Go to the sent folder, which in my case contains several hundreds of posts. 

2* Go to "Folder" -> "Export as MBox folder" and let it do its thing.

3* Now try step (2*) again, with different folder contents in my case, though it might not make a difference.

This process has crashed KNode for years for me, no matter the distribution.
Comment 1 FiNeX 2008-11-19 20:25:40 UTC
Changed severity to "crash". I hope to have selected only the right bugs (>100) :-)
Comment 2 Olivier Trichet 2008-11-20 21:29:21 UTC
Roy,
Do you get a backtrace after the crash that would help narrowing the issue down ?
(I can not reproduce it here)
Comment 3 Roy Schestowitz 2008-11-20 23:05:16 UTC
Do I get this with strace? Run KNode from the CLI?

Many thanks guys! Luv you.
Comment 4 Olivier Trichet 2008-11-21 09:47:03 UTC
Roy, a good explanation of what is a backtrace and how to get one is explains at
http://techbase.kde.org/Development/Tutorials/Debugging/How_to_create_useful_crash_reports


When the "KDE Crash Dialog" appears, take special care and close as much application ; because, once you click on the "backtrace" tab, it will really take a fair amount of memory.

Thank for your quick reply
Comment 5 Roy Schestowitz 2008-11-21 12:08:53 UTC
I installed gdb, reproduced, and then got:


(no debugging symbols found)
Using host libthread_db library "/lib/i686/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)
(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 -1249794352 (LWP 1486)]
[New Thread -1253094512 (LWP 1487)]
(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]
#6  0xb7f242a4 in KNArticleManager::unloadArticle ()
   from /usr/lib/libknodecommon.so.3
#7  0xb7f24498 in KNMemoryManager::checkMemoryUsageArticles ()
   from /usr/lib/libknodecommon.so.3
#8  0xb7f245a8 in KNMemoryManager::updateCacheEntry ()
   from /usr/lib/libknodecommon.so.3
#9  0xb7f247a2 in KNArticleManager::loadArticle ()
   from /usr/lib/libknodecommon.so.3
#10 0xb7f2fba1 in KNFolderManager::exportToMBox ()
   from /usr/lib/libknodecommon.so.3
#11 0xb7f2fcac in KNMainWidget::slotFolMBoxExport ()
   from /usr/lib/libknodecommon.so.3
#12 0xb7f34687 in KNMainWidget::qt_invoke () from /usr/lib/libknodecommon.so.3
#13 0xb63d92ea in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0xb63d9f4a in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0xb6d7a547 in KAction::activated () from /usr/lib/libkdeui.so.4
#16 0xb6db1472 in KAction::slotActivated () from /usr/lib/libkdeui.so.4
#17 0xb6ec26ca in KAction::slotPopupActivated () from /usr/lib/libkdeui.so.4
#18 0xb6ec29c5 in KAction::qt_invoke () from /usr/lib/libkdeui.so.4
#19 0xb63d92ea in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0xb67001ce in QSignal::signal () from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0xb63f6078 in QSignal::activate () from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0xb64e3599 in QPopupMenu::mouseReleaseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#23 0xb6d83e94 in KPopupMenu::mouseReleaseEvent () from /usr/lib/libkdeui.so.4
#24 0xb641392f in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0xb6379438 in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#26 0xb637a4e8 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0xb6b2ee6a in KApplication::notify () from /usr/lib/libkdecore.so.4
#28 0xb6317464 in QETWidget::translateMouseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0xb631598d in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0xb6326629 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0xb638fe37 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0xb638fcd4 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#33 0xb637907c in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#34 0x0804f258 in QWidget::setUpdatesEnabled ()
#35 0xb5836390 in __libc_start_main () from /lib/i686/libc.so.6
#36 0x0804e7a1 in QWidget::setUpdatesEnabled ()

I'd be delighted to give more details.
Comment 6 Roy Schestowitz 2008-11-21 12:12:49 UTC
To reproduce, try:

*Put many messages in folder "X" (any name)1
*Move half the messages to folder "Y"
*Export folder "Y" as mbox
*Move all the messages in folder "Y" to folder "Z"
*Move the rest of the messages in folder "X" to "Y"
*Export folder "Y" as mbox again
*This should crash KNode (debugging output as above)

I've realised that it's not simple to reproduce (I tried simpler things which didn't crash it), 

Thank you guys!
Comment 7 Olivier Trichet 2008-11-22 11:48:03 UTC
Roy, thanks a lot for your input.

Unfortunately, I could not reproduce this crash.
So :
1/ could you tell me how many messages do you put in the X folder ?
2/ could you install the "kdepim-debug" package and try to reproduce the crash ? (this package from mandriva should contains additional debugging informations)

Comment 8 Roy Schestowitz 2008-11-22 14:17:59 UTC
Hi Olivier,

Try this with about 2000 messages. Even back in 'SUSE days' it was the same.
Comment 9 Olivier Trichet 2008-11-24 19:57:37 UTC
With  2000 messages, I can now reproduce the crash in kde 3.5
In kde 4, moving message from one folder to another is not yet re-enabled (so I couldn't try), but I bet it is still there.


Valgrind (memcheck) result :
==00:00:02:42.738 16686== Invalid read of size 4
==00:00:02:42.738 16686==    at 0x4120729: KNArticleManager::unloadArticle(KNArticle*, bool) (knarticlemanager.cpp:464)
==00:00:02:42.738 16686==    by 0x411674F: KNMemoryManager::checkMemoryUsageArticles() (knmemorymanager.cpp:197)
==00:00:02:42.738 16686==    by 0x4117AE7: KNMemoryManager::updateCacheEntry(KNArticle*) (knmemorymanager.cpp:104)
==00:00:02:42.738 16686==    by 0x4120961: KNArticleManager::loadArticle(KNArticle*) (knarticlemanager.cpp:454)
==00:00:02:42.738 16686==    by 0x410DD53: KNFolderManager::exportToMBox(KNFolder*) (knfoldermanager.cpp:406)
==00:00:02:42.738 16686==    by 0x4173AAB: KNMainWidget::slotFolMBoxExport() (knmainwidget.cpp:1661)
==00:00:02:42.738 16686==    by 0x41808C5: KNMainWidget::qt_invoke(int, QUObject*) (knmainwidget.moc:330)
==00:00:02:42.738 16686==    by 0x4DD4F6C: QObject::activate_signal(QConnectionList*, QUObject*) (qobject.cpp:2359)
==00:00:02:42.738 16686==    by 0x4DD5AEC: QObject::activate_signal(int) (qobject.cpp:2328)
==00:00:02:42.738 16686==    by 0x492B148: KAction::activated() (kaction.moc:176)
==00:00:02:42.738 16686==    by 0x497577F: KAction::slotActivated() (kaction.cpp:1102)
==00:00:02:42.738 16686==    by 0x4A22A04: KAction::slotPopupActivated() (kaction.cpp:1137)
==00:00:02:42.738 16686==  Address 0x9bb60a8 is 0 bytes inside a block of size 152 free'd
==00:00:02:42.738 16686==    at 0x402272A: operator delete(void*) (vg_replace_malloc.c:342)
==00:00:02:42.739 16686==    by 0x4127663: KNLocalArticle::~KNLocalArticle() (knarticle.cpp:293)
==00:00:02:42.739 16686==    by 0x40F9D96: KNArticleVector::clear() (knarticlecollection.cpp:100)
==00:00:02:42.739 16686==    by 0x40F9E44: KNArticleCollection::clear() (knarticlecollection.cpp:351)
==00:00:02:42.739 16686==    by 0x41147D8: KNFolder::unloadHdrs(bool) (knfolder.cpp:322)
==00:00:02:42.739 16686==    by 0x410D84A: KNFolderManager::unloadHeaders(KNFolder*, bool) (knfoldermanager.cpp:120)
==00:00:02:42.739 16686==    by 0x41169E9: KNMemoryManager::checkMemoryUsageCollections() (knmemorymanager.cpp:173)
==00:00:02:42.739 16686==    by 0x4116EBE: KNMemoryManager::updateCacheEntry(KNArticleCollection*) (knmemorymanager.cpp:58)
==00:00:02:42.739 16686==    by 0x4125D81: KNArticleManager::moveIntoFolder(QValueList<KNLocalArticle*>&, KNFolder*) (knarticlemanager.cpp:557)
==00:00:02:42.739 16686==    by 0x4176EC7: KNMainWidget::slotCollectionViewDrop(QDropEvent*, KNCollectionViewItem*) (knmainwidget.cpp:1207)
==00:00:02:42.739 16686==    by 0x4180C62: KNMainWidget::qt_invoke(int, QUObject*) (knmainwidget.moc:291)
==00:00:02:42.739 16686==    by 0x4DD4F6C: QObject::activate_signal(QConnectionList*, QUObject*) (qobject.cpp:2359)
==00:00:02:42.897 16686== 
Comment 10 Roy Schestowitz 2008-11-24 21:08:13 UTC
Thank you so much!
Comment 11 Olivier Trichet 2010-04-23 14:28:07 UTC
SVN commit 1117909 by otrichet:

Use boost::shared_ptr instead of plain pointer to handler KNArticle that are use all over the place.

Side effect: use a QList in KNArticleVector instead of a old fashion array

This fix crash cause by double free and freed-pointer access:
BUG: 172266
BUG: 225813
BUG: 141573
This should also fixed crash that happens while accessing article (that
were certainly already freed):
BUG: 134904
BUG: 216919
BUG: 230536
BUG: 132990

 M  +18 -23    articlewidget.cpp  
 M  +10 -12    articlewidget.h  
 M  +6 -6      headerview.cpp  
 M  +9 -5      knarticle.cpp  
 M  +18 -7     knarticle.h  
 M  +43 -168   knarticlecollection.cpp  
 M  +25 -23    knarticlecollection.h  
 M  +31 -39    knarticlefactory.cpp  
 M  +9 -11     knarticlefactory.h  
 M  +8 -8      knarticlefilter.cpp  
 M  +2 -2      knarticlefilter.h  
 M  +43 -42    knarticlemanager.cpp  
 M  +8 -5      knarticlemanager.h  
 M  +10 -11    knarticlewindow.cpp  
 M  +5 -6      knarticlewindow.h  
 M  +2 -2      kncleanup.cpp  
 M  +6 -6      kncomposer.cpp  
 M  +4 -3      kncomposer.h  
 M  +12 -34    knfolder.cpp  
 M  +14 -7     knfolder.h  
 M  +12 -13    knfoldermanager.cpp  
 M  +26 -42    kngroup.cpp  
 M  +21 -10    kngroup.h  
 M  +11 -14    kngroupbrowser.cpp  
 M  +3 -9      kngroupbrowser.h  
 M  +25 -29    kngroupmanager.cpp  
 M  +6 -1      kngroupmanager.h  
 M  +6 -4      kngroupselectdialog.cpp  
 M  +19 -16    knhdrviewitem.cpp  
 M  +6 -6      knhdrviewitem.h  
 M  +3 -3      knjobdata.cpp  
 M  +11 -4     knjobdata.h  
 M  +15 -13    knmainwidget.cpp  
 M  +5 -8      knmainwidget.h  
 M  +7 -6      knmemorymanager.cpp  
 M  +7 -7      knmemorymanager.h  
 M  +8 -9      knscoring.cpp  
 M  +4 -4      knscoring.h  
 M  +3 -5      knstatusfilter.cpp  
 M  +7 -6      knstatusfilter.h  
 M  +2 -2      mailsendjob.cpp  
 M  +1 -1      mailsendjob.h  
 M  +16 -17    nntpjobs.cpp  
 M  +5 -5      nntpjobs.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1117909