Bug 479073 - Kate crash trying to open 1.1GB file
Summary: Kate crash trying to open 1.1GB file
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 23.08.4
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2023-12-27 12:11 UTC by Jernej
Modified: 2024-02-16 14:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jernej 2023-12-27 12:11:00 UTC
Application: kate (23.08.4)

Qt Version: 5.15.11
Frameworks Version: 5.113.0
Operating System: Linux 6.2.0-39-generic x86_64
Windowing System: Wayland
Distribution: KDE neon 5.27
DrKonqi: 5.27.10 [KCrashBackend]

-- Information about the crash:
Kate crash trying to open 1.1GB file. The computer has 64GB of RAM, so probably a simple out of memory is not the cause.

the file was a dbf , maybe parser was involved...

The crash can be reproduced every time.

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

[KCrash Handler]
#4  __pthread_kill_implementation (no_tid=0, signo=6, threadid=139752678656448) at ./nptl/pthread_kill.c:44
#5  __pthread_kill_internal (signo=6, threadid=139752678656448) at ./nptl/pthread_kill.c:78
#6  __GI___pthread_kill (threadid=139752678656448, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#7  0x00007f1ab9242476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#8  0x00007f1ab92287f3 in __GI_abort () at ./stdlib/abort.c:79
#9  0x00007f1ab96a2b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007f1ab96ae20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#11 0x00007f1ab96ae277 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007f1ab96ae4d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007f1ab9a90f85 in qBadAlloc () at global/qglobal.cpp:3372
#14 0x00007f1ab9a969bf in QString::reallocData (this=0x7fffccb49bd8, alloc=1074003456, grow=<optimized out>) at text/qstring.cpp:2380
#15 0x00007f1ab9b52346 in QString::append (this=this@entry=0x7fffccb49bd8, str=...) at text/qstring.cpp:2688
#16 0x00007f1ab8eb9442 in Kate::TextLoader::readLine (this=this@entry=0x7fffccb49ba0, offset=@0x7fffccb49b80: 0, length=@0x7fffccb49b88: 0) at ./src/buffer/katetextloader.h:282
#17 0x00007f1ab8eb7f6a in Kate::TextBuffer::load (this=this@entry=0x556cea1300d0, filename=..., encodingErrors=@0x556cea1301b8: false, tooLongLinesWrapped=@0x556cea1301b9: false, longestLineLoaded=@0x556cea1301bc: 191, enforceTextCodec=enforceTextCodec@entry=false) at ./src/buffer/katetextbuffer.cpp:604
#18 0x00007f1ab8f3e836 in KateBuffer::openFile (this=this@entry=0x556cea1300d0, m_file=..., enforceTextCodec=enforceTextCodec@entry=false) at ./src/document/katebuffer.cpp:159
#19 0x00007f1ab8f30e04 in KTextEditor::DocumentPrivate::openFile (this=0x556ceaa61e40) at ./src/document/katedocument.cpp:2402
#20 0x00007f1aba783c65 in KParts::ReadOnlyPartPrivate::openLocalFile (this=this@entry=0x556cea099c50) at ./src/readonlypart.cpp:184
#21 0x00007f1aba789b27 in KParts::ReadOnlyPart::openUrl (this=this@entry=0x556ceaa61e40, url=...) at ./src/readonlypart.cpp:145
#22 0x00007f1ab8f20096 in KTextEditor::DocumentPrivate::openUrl (this=0x556ceaa61e40, url=...) at ./src/document/katedocument.cpp:2828
#23 0x00007f1abb337ce8 in KateDocManager::openUrl (this=0x7fffccb4b300, url=..., encoding=..., docInfo=...) at ./apps/lib/katedocmanager.cpp:182
#24 0x00007f1abb36f2a6 in KateDocManager::openUrls (docInfo=..., encoding=..., urls=..., this=0x7fffccb4b300) at ./apps/lib/katedocmanager.cpp:159
#25 KateViewManager::openUrls (this=0x556cea362530, urls=..., encoding=..., docInfo=...) at ./apps/lib/kateviewmanager.cpp:431
#26 0x00007f1abb366f97 in KateViewManager::openUrl (this=0x556cea362530, url=..., encoding=..., activate=<optimized out>, ignoreForRecentFiles=<optimized out>, docInfo=...) at ./apps/lib/kateviewmanager.cpp:402
#27 0x00007f1abb36a0a2 in KateViewManager::openUrl (this=0x556cea362530, url=...) at ./apps/lib/kateviewmanager.cpp:481
#28 0x00007f1abb3468b8 in KateMainWindow::slotDropEvent (this=0x556cea21b7f0, event=<optimized out>) at ./apps/lib/katemainwindow.cpp:941
#29 0x00007f1ababaf95e in QWidget::event (this=0x556cea21b7f0, event=0x7fffccb4a5a0) at kernel/qwidget.cpp:9045
#30 0x00007f1ab8d3c47d in KXmlGuiWindow::event (this=0x556cea21b7f0, ev=0x7fffccb4a5a0) at ./src/kxmlguiwindow.cpp:220
#31 0x00007f1abab6c763 in QApplicationPrivate::notify_helper (this=this@entry=0x556ce9e648f0, receiver=receiver@entry=0x556cea21b7f0, e=e@entry=0x7fffccb4a5a0) at kernel/qapplication.cpp:3640
#32 0x00007f1abab75c4d in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7fffccb4a5a0) at kernel/qapplication.cpp:3386
#33 0x00007f1ab9cbc93a in QCoreApplication::notifyInternal2 (receiver=0x556cea082610, event=0x7fffccb4a5a0) at kernel/qcoreapplication.cpp:1064
#34 0x00007f1ababcb962 in QWidgetWindow::handleDropEvent (this=this@entry=0x556cea0fc340, event=event@entry=0x7fffccb4a780) at kernel/qwidgetwindow.cpp:986
#35 0x00007f1ababcc770 in QWidgetWindow::event (this=0x556cea0fc340, event=0x7fffccb4a780) at kernel/qwidgetwindow.cpp:342
#36 0x00007f1abab6c763 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x556cea0fc340, e=0x7fffccb4a780) at kernel/qapplication.cpp:3640
#37 0x00007f1ab9cbc93a in QCoreApplication::notifyInternal2 (receiver=0x556cea0fc340, event=0x7fffccb4a780) at kernel/qcoreapplication.cpp:1064
#38 0x00007f1aba145003 in QGuiApplicationPrivate::processDrop (w=w@entry=0x556cea0fc340, dropData=dropData@entry=0x556cea3bf7f0, p=..., supportedActions=..., supportedActions@entry=..., buttons=..., buttons@entry=..., modifiers=..., modifiers@entry=...) at kernel/qguiapplication.cpp:3326
#39 0x00007f1aba11662c in QWindowSystemInterface::handleDrop (window=0x556cea0fc340, dropData=dropData@entry=0x556cea3bf7f0, p=..., supportedActions=supportedActions@entry=..., buttons=..., modifiers=modifiers@entry=...) at kernel/qwindowsysteminterface.cpp:938
#40 0x00007f1ab4f45ab6 in QtWaylandClient::QWaylandDataDevice::data_device_drop (this=0x556ce9e86f70) at ./src/client/qwaylanddatadevice.cpp:192
#41 0x00007f1ab4d7be2e in ffi_call_unix64 () at ../src/x86/unix64.S:105
#42 0x00007f1ab4d78493 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:672
#43 0x00007f1ab6ca0b20 in wl_closure_invoke (closure=closure@entry=0x7f1aa80049d0, target=<optimized out>, target@entry=0x556ce9e88580, opcode=opcode@entry=4, data=<optimized out>, flags=<optimized out>) at ../src/connection.c:1025
#44 0x00007f1ab6ca12c3 in dispatch_event (display=display@entry=0x556ce9e6d190, queue=<optimized out>, queue=<optimized out>) at ../src/wayland-client.c:1595
#45 0x00007f1ab6ca14bc in dispatch_queue (queue=0x556ce9e6d260, display=0x556ce9e6d190) at ../src/wayland-client.c:1741
#46 wl_display_dispatch_queue_pending (display=0x556ce9e6d190, queue=0x556ce9e6d260) at ../src/wayland-client.c:1983
#47 0x00007f1ab4f2385a in QtWaylandClient::QWaylandDisplay::flushRequests (this=<optimized out>) at ./src/client/qwaylanddisplay.cpp:255
#48 0x00007f1ab9ce9e8e in QObject::event (this=0x556ce9e689c0, e=0x7f1aa4005ef0) at kernel/qobject.cpp:1347
#49 0x00007f1abab6c763 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x556ce9e689c0, e=0x7f1aa4005ef0) at kernel/qapplication.cpp:3640
#50 0x00007f1ab9cbc93a in QCoreApplication::notifyInternal2 (receiver=0x556ce9e689c0, event=0x7f1aa4005ef0) at kernel/qcoreapplication.cpp:1064
#51 0x00007f1ab9cbfa37 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x556ce9e3f4b0) at kernel/qcoreapplication.cpp:1821
#52 0x00007f1ab9d167d7 in postEventSourceDispatch (s=0x556ce9e86270) at kernel/qeventdispatcher_glib.cpp:277
#53 0x00007f1ab7b20d3b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#54 0x00007f1ab7b76258 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#55 0x00007f1ab7b1e3e3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#56 0x00007f1ab9d15e28 in QEventDispatcherGlib::processEvents (this=0x556ce9e8b740, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#57 0x00007f1ab9cbb25b in QEventLoop::exec (this=this@entry=0x7fffccb4b000, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#58 0x00007f1ab9cc3804 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#59 0x00007f1aba136d50 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#60 0x00007f1abab6c6d9 in QApplication::exec () at kernel/qapplication.cpp:2832
#61 0x0000556ce9be3394 in main (argc=<optimized out>, argv=<optimized out>) at ./apps/kate/main.cpp:609
[Inferior 1 (process 17812) detached]

Reported using DrKonqi
Comment 1 Christoph Cullmann 2023-12-28 20:40:44 UTC
That looks like in out of memory, but yes, that should not happen with 64 GB of RAM.
Comment 2 Waqar Ahmed 2023-12-29 15:21:03 UTC
how many lines does the file have?
Comment 3 Christoph Cullmann 2024-01-05 18:50:22 UTC
Could you retry with a master build? We started to optimize this.
Comment 4 Jernej 2024-01-09 06:56:39 UTC
(In reply to Waqar Ahmed from comment #2)
> how many lines does the file have?

wc -l LPO_PARC.dbf
4

longer then expected.
according to Wikipedia https://en.wikipedia.org/wiki/.dbf
its expected, the records  are fixed size, not separated by new line.
the content is otherwise plain text.
Comment 5 Jernej 2024-01-09 06:59:21 UTC
(In reply to Christoph Cullmann from comment #3)
> Could you retry with a master build? We started to optimize this.

have any kde neon builds a usefull version ? (testing, development)
https://neon.kde.org/download

is there a way to get a prebuild kate?
Comment 6 Christoph Cullmann 2024-01-20 19:58:27 UTC
Hmm, I think the issue is 1.1GB in 4 lines, that will work with none of our versions. That seems out of scope to support.
Comment 7 Bug Janitor Service 2024-02-03 17:46:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/663
Comment 8 Christoph Cullmann 2024-02-16 14:01:14 UTC
Git commit 651fe6dce0b19ea35945cea4da194dda65841562 by Christoph Cullmann.
Committed on 15/02/2024 at 20:27.
Pushed by cullmann into branch 'master'.

split lines early

avoids that we OOM before we handle that

M  +7    -41   src/buffer/katetextbuffer.cpp
M  +36   -2    src/buffer/katetextloader.h

https://invent.kde.org/frameworks/ktexteditor/-/commit/651fe6dce0b19ea35945cea4da194dda65841562