Bug 443387 - Kate crash inside git blame plugin
Summary: Kate crash inside git blame plugin
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 21.08.1
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2021-10-06 10:51 UTC by Bruno Pitrus
Modified: 2021-11-21 18:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 21.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Pitrus 2021-10-06 10:51:58 UTC
Application: kate (21.08.1)

Qt Version: 5.15.2
Frameworks Version: 5.86.0
Operating System: Linux 5.13.0-16-generic x86_64
Windowing System: X11
Drkonqi Version: 5.22.5
Distribution: Ubuntu Impish Indri (development branch)

-- Information about the crash:
- What I was doing when the application crashed:

Opened a text file inside a git repository with no branches and detached HEAD.

The crash can be reproduced every time.

-- Backtrace:
Application: Kate (kate), signal: Aborted

[KCrash Handler]
#4  __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:45
#5  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:62
#6  0x00007ff15da78466 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#7  0x00007ff15da5e7b7 in __GI_abort () at abort.c:79
#8  0x00007ff15dcfba31 in __gnu_cxx::__verbose_terminate_handler () at ../../../../src/libstdc++-v3/libsupc++/vterminate.cc:95
#9  0x00007ff15dd074ec in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:48
#10 0x00007ff15dd07557 in std::terminate () at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:58
#11 0x00007ff15dd077f9 in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7ff15de63e78 <typeinfo for std::bad_alloc>, dest=0x7ff15dd05a90 <std::bad_alloc::~bad_alloc()>) at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:95
#12 0x00007ff15df02f85 in qBadAlloc () at global/qglobal.cpp:3338
#13 0x00007ff15df08503 in QString::QString (this=<optimized out>, this@entry=0x7ffd471ff240, size=<optimized out>, size@entry=1837633704) at text/qstring.cpp:2169
#14 0x00007ff15e1891f1 in QUtf8::convertToUnicode (chars=chars@entry=0x7ff01fb3c028 "commit 52db7df51f0bee0e1012cb377ce1dd9f9303351f\nAuthor: Bruno Pitrus <bruno@beit.tech>\nDate:   Wed Oct 6 12:32:15 2021 +0200\n\ndiff --git a/CMakeLists.txt b/CMakeLists.txt\nnew file mode 100644\nindex 00"..., len=1837633704) at codecs/qutfcodec.cpp:483
#15 0x00007ff15dfc6fc7 in QString::fromUtf8_helper (str=str@entry=0x7ff01fb3c028 "commit 52db7df51f0bee0e1012cb377ce1dd9f9303351f\nAuthor: Bruno Pitrus <bruno@beit.tech>\nDate:   Wed Oct 6 12:32:15 2021 +0200\n\ndiff --git a/CMakeLists.txt b/CMakeLists.txt\nnew file mode 100644\nindex 00"..., size=<optimized out>) at text/qstring.cpp:5590
#16 0x00007ff152af062f in QString::fromUtf8 (size=<optimized out>, str=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:706
#17 QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:715
#18 KateGitBlamePluginView::showFinished (this=0x5620f9962dc0, exitCode=0, exitStatus=QProcess::NormalExit) at ./addons/git-blame/kategitblameplugin.cpp:306
#19 0x00007ff15e163a53 in QtPrivate::QSlotObjectBase::call (a=0x7ffd471ff3c0, r=0x5620f9962dc0, this=0x5620f9635660) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#20 doActivate<false> (sender=0x5620f9962e28, signal_index=11, argv=0x7ffd471ff3c0) at kernel/qobject.cpp:3886
#21 0x00007ff15e15cd67 in QMetaObject::activate (sender=sender@entry=0x5620f9962e28, m=m@entry=0x7ff15e3c6da0 <QProcess::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffd471ff3c0) at kernel/qobject.cpp:3946
#22 0x00007ff15e09534c in QProcess::finished (this=this@entry=0x5620f9962e28, _t1=<optimized out>, _t2=<optimized out>) at .moc/moc_qprocess.cpp:339
#23 0x00007ff15e09ae63 in QProcessPrivate::_q_processDied (this=0x5620f9538870) at io/qprocess.cpp:1184
#24 0x00007ff15e09af9e in QProcess::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7ffd471ff540) at io/qprocess.h:320
#25 0x00007ff15e163a88 in doActivate<false> (sender=0x5620f98b9650, signal_index=3, argv=0x7ffd471ff540) at kernel/qobject.cpp:3898
#26 0x00007ff15e15cd67 in QMetaObject::activate (sender=sender@entry=0x5620f98b9650, m=m@entry=0x7ff15e3c9180 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffd471ff540) at kernel/qobject.cpp:3946
#27 0x00007ff15e166f63 in QSocketNotifier::activated (this=this@entry=0x5620f98b9650, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#28 0x00007ff15e167793 in QSocketNotifier::event (this=0x5620f98b9650, e=0x7ffd471ff660) at kernel/qsocketnotifier.cpp:302
#29 0x00007ff15ec586b3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007ff15e12c16a in QCoreApplication::notifyInternal2 (receiver=0x5620f98b9650, event=0x7ffd471ff660) at kernel/qcoreapplication.cpp:1063
#31 0x00007ff15e186155 in socketNotifierSourceDispatch (source=0x5620f90e4830) at kernel/qeventdispatcher_glib.cpp:107
#32 0x00007ff15c0fc8bb in g_main_dispatch (context=0x7ff154005000) at ../../../glib/gmain.c:3337
#33 g_main_context_dispatch (context=0x7ff154005000) at ../../../glib/gmain.c:4055
#34 0x00007ff15c14ff08 in g_main_context_iterate.constprop.0 (context=context@entry=0x7ff154005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4131
#35 0x00007ff15c0fa003 in g_main_context_iteration (context=0x7ff154005000, may_block=1) at ../../../glib/gmain.c:4196
#36 0x00007ff15e185548 in QEventDispatcherGlib::processEvents (this=0x5620f90e0030, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#37 0x00007ff15e12aa9b in QEventLoop::exec (this=this@entry=0x7ffd471ff870, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#38 0x00007ff15e133024 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#39 0x00005620f79cb4ee in main (argc=<optimized out>, argv=<optimized out>) at ./kate/main.cpp:699
[Inferior 1 (process 87136) detached]

Possible duplicates by query: bug 441545, bug 440777, bug 440257, bug 429344, bug 427384.

Reported using DrKonqi
Comment 1 Kåre Särs 2021-10-10 04:06:26 UTC
Thanks for the report.

You have one huge commit there....

I have tried to avoid the risk of running out of memory by limiting the amount of bytes that is forwarded to be displayed in the message dialog, but your commit seems to be so huge that you run out of memory even just trying to read the data into a buffer.

Possible solutions (mainly question to Kate developers): 
1) Make the processing of the git output a bit more complicated by assigning read channel and reading only a limited amount of data.
2) Add the file name to "git show <hash>" to only output the diff for the current file.
3) Both of the above...
Comment 2 Bug Janitor Service 2021-10-10 05:03:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/499
Comment 3 Waqar Ahmed 2021-11-21 18:53:00 UTC
Fixed in 21.12