Bug 468673 - Memory leak when pasting files in administrator mode
Summary: Memory leak when pasting files in administrator mode
Status: RESOLVED FIXED
Alias: None
Product: kio-admin
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 23.03.90
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-19 06:03 UTC by Jaime Antonio Gonzalez
Modified: 2023-04-22 16:49 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Antonio Gonzalez 2023-04-19 06:03:44 UTC
I wanted to get the new Partition Manager icon so badly that I downloaded it from gitlab, and went to the specified path:  /usr/share/icons/breeze/apps/48/ which I needed to open in admin mode to be able to paste the icon there. Less than 30 seconds after pasting it, RAM usage skyrocketed and computer froze.


STEPS TO REPRODUCE

1. Right click a file and select "copy" (you can try with a svg icon, like I did)
2. Open a protected path like /usr/share/icons/
3. Right click in an empty space and select open as administrator
4. Paste the icon/file, you will be prompted to put your password
5. As soon as the copy operation finishes, memory usage starts to skyrocked leading to a computer lockup

OBSERVED RESULT

Computer totally frozen because the system runs out of RAM

EXPECTED RESULT

It shouldn't leak memory so much and so fast.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma

KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

When running Dolphin through Konsole it spams this:

RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="quassel.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=2012 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="quassel.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=2012 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
virtual KIO::WorkerResult AdminWorker::get(const QUrl&)
"/org/kde/kio/admin/get/904"
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="quiterss.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=2992 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
virtual KIO::WorkerResult AdminWorker::get(const QUrl&)
"/org/kde/kio/admin/get/905"
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="qupzilla.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=2183 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
virtual KIO::WorkerResult AdminWorker::get(const QUrl&)
"/org/kde/kio/admin/get/906"
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="r.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=8380 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="r.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=8380 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
virtual KIO::WorkerResult AdminWorker::get(const QUrl&)
"/org/kde/kio/admin/get/907"
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="phonon-gstreamer.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=3396 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="phonon-gstreamer.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=3396 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
virtual KIO::WorkerResult AdminWorker::get(const QUrl&)
"/org/kde/kio/admin/get/908"
kf.kio.workers.file: readData() returned -1
void AdminWorker::entry(const KIO::UDSEntry&) [ "UDS_NAME"="rbackend.svg" "UDS_LINK_DEST"="r.svg" "UDS_FILE_TYPE"=32768 "UDS_ACCESS"=420 "UDS_SIZE"=8380 "UDS_USER"="root" "UDS_GROUP"="root" "UDS_MODIFICATION_TIME"=1680252896 "UDS_ACCESS_TIME"=1681334995 "UDS_CREATION_TIME"=1681334996 ]
RESULT 0 "Unknown error code 0\n\nPlease send a full bug report at https://bugs.kde.org."
Comment 1 Bug Janitor Service 2023-04-21 01:05:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1256
Comment 2 Bug Janitor Service 2023-04-21 01:05:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/kio-admin/-/merge_requests/7
Comment 3 Harald Sitter 2023-04-21 14:42:42 UTC
Git commit ba2468e30cb60bd3cb7353396ff3ad938e16ddf0 by Harald Sitter.
Committed on 21/04/2023 at 14:42.
Pushed by sitter into branch 'master'.

add support for killing commands early

this forwards wasKilled to the command objects and prevents us from
(e.g.) reading excessive amounts of data into memory when the data is
not going to be used in the client because they were only interested in
the mimetype.

M  +20   -0    src/helper/busobject.cpp
M  +9    -0    src/helper/busobject.h
M  +5    -0    src/helper/getcommand.cpp
M  +3    -0    src/helper/getcommand.h
M  +5    -0    src/helper/listdircommand.cpp
M  +1    -0    src/helper/listdircommand.h
M  +5    -0    src/helper/putcommand.cpp
M  +1    -0    src/helper/putcommand.h
M  +63   -16   src/worker.cpp

https://invent.kde.org/system/kio-admin/commit/ba2468e30cb60bd3cb7353396ff3ad938e16ddf0
Comment 4 Bug Janitor Service 2023-04-21 14:43:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/kio-admin/-/merge_requests/8
Comment 5 Harald Sitter 2023-04-21 14:44:31 UTC
Git commit 97637fca3ffec9924fdaf97659583688f90643c5 by Harald Sitter.
Committed on 21/04/2023 at 14:43.
Pushed by sitter into branch 'release/23.04'.

add support for killing commands early

this forwards wasKilled to the command objects and prevents us from
(e.g.) reading excessive amounts of data into memory when the data is
not going to be used in the client because they were only interested in
the mimetype.


(cherry picked from commit ba2468e30cb60bd3cb7353396ff3ad938e16ddf0)

M  +20   -0    src/helper/busobject.cpp
M  +9    -0    src/helper/busobject.h
M  +5    -0    src/helper/getcommand.cpp
M  +3    -0    src/helper/getcommand.h
M  +5    -0    src/helper/listdircommand.cpp
M  +1    -0    src/helper/listdircommand.h
M  +5    -0    src/helper/putcommand.cpp
M  +1    -0    src/helper/putcommand.h
M  +63   -16   src/worker.cpp

https://invent.kde.org/system/kio-admin/commit/97637fca3ffec9924fdaf97659583688f90643c5
Comment 6 Bug Janitor Service 2023-04-22 14:37:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/kio-admin/-/merge_requests/9
Comment 7 Harald Sitter 2023-04-22 16:49:34 UTC
Git commit ae4af4ab84588f1d64149ba05d83bcb39fe84f7a by Harald Sitter.
Committed on 22/04/2023 at 14:53.
Pushed by meven into branch 'master'.

delete threaded workers on a thread

this prevents potential deadlocks between the worker thread and the main
thread in case the former relies on the latter to do work. specifically
qdbus seems unhappy if we wait in the main thread. in point of fact we
shouldn't be waiting in the main thread anyway since the result of the
thread is immaterial

(wait is also called inside the workerthread destructor, I'm leaving it
there as a safe guard against deleting still-running threads)

M  +14   -0    src/core/worker.cpp

https://invent.kde.org/frameworks/kio/commit/ae4af4ab84588f1d64149ba05d83bcb39fe84f7a