Bug 319747 - Dolphin crashes when copying 10001 files
Summary: Dolphin crashes when copying 10001 files
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.10.2
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-12 20:33 UTC by Ruslan Kabatsayev
Modified: 2013-05-14 19:34 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.4


Attachments
Backtrace (8.09 KB, text/x-log)
2013-05-12 20:49 UTC, Ruslan Kabatsayev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ruslan Kabatsayev 2013-05-12 20:33:18 UTC
After I Ctrl+drag 10001files selected via Ctrl+A onto a directory icon, Dolphin hangs, and notification applet says "Undefined", "undefined", 0B/s. After about a minute Dolphin crashes, leaving notification in its "undefined" state.

Reproducible: Always

Steps to Reproduce:
1. Issue the following commands in console:
mkdir ~/tmp; cd ~/tmp
dd if=/dev/urandom of=file bs=1k count=5
for i in `seq 1 10000`; do cp file file$i; done
mkdir copy
sync
2. Now open ~/tmp in Dolphin
3. Press Ctrl+A, then unselect "copy" directory
4. Ctrl+Drag the files selected onto "copy" icon
5. Observe the hang
6. Open copy notification, see "undefined" state
7. Wait about a minute, get Dophin's crash
Actual Results:  
Dolphin hangs and then crashes without copying a single file

Expected Results:  
Dolphin should copy the files as one expects it to do
Comment 1 Frank Reininghaus 2013-05-12 20:38:51 UTC
Thanks for the report! Does the bug go away if you disable the "File to activity linking plugin" in the "Services" section of the settings dialog?
Comment 2 Ruslan Kabatsayev 2013-05-12 20:49:01 UTC
Created attachment 79860 [details]
Backtrace

No, it doesn't change anything. Here's also a backtrace.
Comment 3 Frank Reininghaus 2013-05-12 20:56:14 UTC
Thanks. Looks like an infinite recursion in KIO code.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff360e21b in QUrlPrivate::toEncoded (this=0x37ad990, options=...) at io/qurl.cpp:3964
3964    io/qurl.cpp: No such file or directory.
(gdb) bt
#0  0x00007ffff360e21b in QUrlPrivate::toEncoded (this=0x37ad990, options=...) at io/qurl.cpp:3964
#1  0x00007ffff360e52d in QUrl::toEncoded (this=<optimized out>, options=...) at io/qurl.cpp:5772
#2  0x00007ffff3ad7b20 in KUrl::url (this=0x7fffff7ff2b0, trailing=<optimized out>) at ../../kdecore/io/kurl.cpp:1059
#3  0x00007ffff55174c3 in KDirListerCache::dirItemForUrl (this=0x8a2bd0, dir=...) at ../../kio/kio/kdirlister.cpp:786
#4  0x00007ffff5517626 in KDirListerCache::findByUrl (this=0x8a2bd0, lister=0x0, _u=...) at ../../kio/kio/kdirlister.cpp:823
#5  0x00007ffff55178ee in KDirListerCache::itemForUrl (this=<optimized out>, url=...) at ../../kio/kio/kdirlister.cpp:776
#6  0x00007ffff5517957 in KDirLister::cachedItemForUrl (url=...) at ../../kio/kio/kdirlister.cpp:2769
#7  0x00007ffff54cbfe2 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:734
#8  0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#9  0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#10 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#11 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#12 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#13 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#14 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#15 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478

<snip>

#16616 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16617 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16618 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16619 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16620 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16621 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16622 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16623 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16624 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16625 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16626 0x00007ffff54cb9c1 in KIO::CopyJobPrivate::sourceStated (this=0x3008cf0, entry=..., sourceUrl=...) at ../../kio/kio/copyjob.cpp:478
#16627 0x00007ffff54cc060 in KIO::CopyJobPrivate::statCurrentSrc (this=0x3008cf0) at ../../kio/kio/copyjob.cpp:787
#16628 0x00007ffff54ce8b4 in KIO::CopyJobPrivate::slotResultStating (this=0x3008cf0, job=0x1b91760) at ../../kio/kio/copyjob.cpp:381
#16629 0x00007ffff366b781 in QMetaObject::activate (sender=0x1b91760, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffffffc990) at kernel/qobject.cpp:3547
#16630 0x00007ffff3ae2772 in KJob::result (this=<optimized out>, _t1=0x1b91760) at ./kjob.moc:208
#16631 0x00007ffff3ae27b0 in KJob::emitResult (this=0x1b91760) at ../../kdecore/jobs/kjob.cpp:318
#16632 0x00007ffff54f5994 in KIO::SimpleJob::slotFinished (this=0x1b91760) at ../../kio/kio/job.cpp:494
#16633 0x00007ffff54f98dd in KIO::StatJob::slotFinished (this=0x1b91760) at ../../kio/kio/job.cpp:896
#16634 0x00007ffff366b781 in QMetaObject::activate (sender=0xd7b1a0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547
#16635 0x00007ffff55a3bb1 in KIO::SlaveInterface::dispatch (this=<optimized out>, _cmd=104, rawdata=...) at ../../kio/kio/slaveinterface.cpp:172
#16636 0x00007ffff55a08e5 in KIO::SlaveInterface::dispatch (this=<optimized out>) at ../../kio/kio/slaveinterface.cpp:88
#16637 0x00007ffff5593c8e in KIO::Slave::gotInput (this=0xd7b1a0) at ../../kio/kio/slave.cpp:344
#16638 0x00007ffff366b781 in QMetaObject::activate (sender=0xd92cf0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547
#16639 0x00007ffff54c6627 in dequeue (this=<optimized out>) at ../../kio/kio/connection.cpp:82
#16640 KIO::ConnectionPrivate::dequeue (this=0xddf270) at ../../kio/kio/connection.cpp:71
#16641 0x00007ffff3670946 in QObject::event (this=0xd92cf0, e=<optimized out>) at kernel/qobject.cpp:1195
#16642 0x00007ffff40547b4 in notify_helper (e=0x17640e0, receiver=0xd92cf0, this=0x635df0) at kernel/qapplication.cpp:4556
#16643 QApplicationPrivate::notify_helper (this=0x635df0, receiver=0xd92cf0, e=0x17640e0) at kernel/qapplication.cpp:4528
#16644 0x00007ffff4059583 in QApplication::notify (this=0x7fffffffdaa0, receiver=0xd92cf0, e=0x17640e0) at kernel/qapplication.cpp:4417
#16645 0x00007ffff4d90006 in KApplication::notify (this=0x7fffffffdaa0, receiver=0xd92cf0, event=0x17640e0) at ../../kdeui/kernel/kapplication.cpp:311
#16646 0x00007ffff365732c in QCoreApplication::notifyInternal (this=0x7fffffffdaa0, receiver=0xd92cf0, event=0x17640e0) at kernel/qcoreapplication.cpp:915
#16647 0x00007ffff365b10a in sendEvent (event=0x17640e0, receiver=0xd92cf0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#16648 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x607cf0) at kernel/qcoreapplication.cpp:1539
#16649 0x00007ffff3686493 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#16650 postEventSourceDispatch (s=<optimized out>) at kernel/qeventdispatcher_glib.cpp:279
#16651 0x00007fffef1a2d53 in g_main_dispatch (context=0x638800) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:2539
#16652 g_main_context_dispatch (context=0x638800) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3075
#16653 0x00007fffef1a30a0 in g_main_context_iterate (dispatch=1, block=<optimized out>, context=0x638800, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3146
#16654 g_main_context_iterate (context=0x638800, block=<optimized out>, dispatch=1, self=<optimized out>) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3083
#16655 0x00007fffef1a3164 in g_main_context_iteration (context=0x638800, may_block=1) at /build/buildd/glib2.0-2.32.3/./glib/gmain.c:3207
#16656 0x00007ffff36868bf in QEventDispatcherGlib::processEvents (this=0x6095d0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#16657 0x00007ffff40fccde in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#16658 0x00007ffff3655e62 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#16659 0x00007ffff36560b7 in QEventLoop::exec (this=0x7fffffffda30, flags=...) at kernel/qeventloop.cpp:204
#16660 0x00007ffff365b407 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#16661 0x00007ffff7b863b7 in kdemain (argc=1, argv=0x7fffffffdff8) at ../../../dolphin/src/main.cpp:90
#16662 0x00007ffff779776d in __libc_start_main (main=0x400640 <main(int, char**)>, argc=1, ubp_av=0x7fffffffdff8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdfe8) at libc-start.c:226
#16663 0x0000000000400671 in _start ()
Comment 4 Ruslan Kabatsayev 2013-05-12 21:04:25 UTC
FWIW, it doesn't reproduce in KDE 4.8.
Comment 5 David Faure 2013-05-13 08:23:48 UTC
Ah! Actually it's not *infinite*. It's just massive.

10001 files, with two method calls per files, that's 20002 calls in the stack. It broke at 16663 (stack full, very probably).

So the solution is to not make a recursive call in order to "move on to the next file", in the fast path.
I'll use a delayed invokeMethod instead. A bit slower, but won't fill up the stack.
Comment 6 David Faure 2013-05-13 08:52:52 UTC
Git commit 1b9726e23984fc58e7aa92c8773d371fdbd9cff1 by David Faure.
Committed on 13/05/2013 at 10:52.
Pushed by dfaure into branch 'KDE/4.10'.

CopyJob: replaced huge recursion with delayed invocation.

Otherwise there's a risk of filling up the stack, when copying a very
large number of files (and they are all available in the KDirLister cache).
FIXED-IN: 4.10.4

M  +2    -1    kio/kio/copyjob.cpp
M  +2    -1    kio/kio/copyjob.h

http://commits.kde.org/kdelibs/1b9726e23984fc58e7aa92c8773d371fdbd9cff1
Comment 7 Hrvoje Senjan 2013-05-14 11:03:19 UTC
David, this seems to broke copying here:
QMetaMethod::invoke: Unable to handle unregistered datatype 'KIO::UDSEntry'
And i can't copy any file with dolphin/konqueror
Comment 8 Hrvoje Senjan 2013-05-14 11:51:07 UTC
(In reply to comment #7)
> David, this seems to broke copying here:
> QMetaMethod::invoke: Unable to handle unregistered datatype 'KIO::UDSEntry'
> And i can't copy any file with dolphin/konqueror

Sorry, obviously i meant pasting ;-)
Comment 9 Hrvoje Senjan 2013-05-14 19:34:04 UTC
Montel fixed it already. No complaints from my side now ;-)