Some context: My (ext4) partition is 207GiB in size. It had underwent some resize and move operations previously. After that the partition remained corrupted. I tried using alternate superblocks without any success. As a final effort I tried the "mkfs.ext4 -S". The subsequent 'fsck' is a seemingly never ending stream of "inode x invalid, clear? (y)" prompts. So I tried the "Check" option in the partition manager. But it runs for an hour until it slowly consumes all RAM (3.9GiB) and swap (3.8GiB) and then simply exits. No crash dialog is produced however. Reproducible: Always Steps to Reproduce: 1. Setup a large partition with several corrupted inodes. 2. Check the partition using partition manager. Actual Results: Process consumes all memory and exits afterwards. Expected Results: Handle the memory spike gracefully.
I think what happens is that output from e2fsck is stored in a variable in KPM. e2fsck keeps producing more and more output and uses more and more memory. We can already do command timeout but that will probably not work because some normal file system checks sometimes take a long time to happen, I saw one lasting about 50 minutes. One way to fix this might be to add a limit to stored output and exit with error when that limit is reached.
Git commit 687e3fc7d44c55e2529084518cb4780065dab2cb by Andrius Štikonas. Committed on 15/09/2017 at 13:59. Pushed by stikonas into branch 'master'. Do not store more than 10M characters in ExternalCommand output. M +6 -0 src/util/externalcommand.cpp https://commits.kde.org/kpmcore/687e3fc7d44c55e2529084518cb4780065dab2cb