Bug 507216 - Konsole fails if I open 300 windows with "QProcess: Cannot create pipe (Too many open files)"; please, raise RLIMIT_NOFILE
Summary: Konsole fails if I open 300 windows with "QProcess: Cannot create pipe (Too m...
Status: CLOSED INTENTIONAL
Alias: None
Product: konsole
Classification: Applications
Component: single-process (other bugs)
Version First Reported In: 25.04.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-19 05:42 UTC by Askar Safin
Modified: 2025-07-22 01:21 UTC (History)
1 user (show)

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


Attachments
attachment-1688296-0.html (5.31 KB, text/html)
2025-07-19 06:52 UTC, tcanabrava
Details
my actual screenshot (185.29 KB, image/png)
2025-07-19 23:59 UTC, Askar Safin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Askar Safin 2025-07-19 05:42:57 UTC
SUMMARY
Konsole fails if I open 300 windows with "QProcess: Cannot create pipe (Too many open files)"

STEPS TO REPRODUCE
Try to open 300 Konsole windows

OBSERVED RESULT
All windows close on its own

EXPECTED RESULT
Windows should not close on its own

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Trixie 13, x86_64
uname -a: Linux comp 6.12.35+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.35-1 (2025-07-03) x86_64 GNU/Linux
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2
Konsole version: 25.04.2
Wayland

ADDITIONAL INFORMATION
"journalctl" shows this:

Jul 19 07:41:26 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup master_fd < 0
Jul 19 07:41:26 comp konsole[2187]: QLayout: Cannot add a null widget to QHBoxLayout/
Jul 19 07:41:26 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
Jul 19 07:41:26 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup master_fd < 0
Jul 19 07:41:26 comp konsole[2187]: QProcess: Cannot create pipe (Too many open files)
Jul 19 07:41:26 comp konsole[2187]: QProcess: Cannot create pipe (Too many open files)
Jul 19 07:41:26 comp konsole[2187]: QLayout: Cannot add a null widget to QHBoxLayout/
Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup master_fd < 0
Jul 19 07:41:27 comp konsole[2187]: QProcess: Cannot create pipe (Too many open files)
Jul 19 07:41:27 comp konsole[2187]: QProcess: Cannot create pipe (Too many open files)
Jul 19 07:41:27 comp konsole[2187]: QLayout: Cannot add a null widget to QHBoxLayout/
Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup master_fd < 0
Jul 19 07:41:27 comp konsole[2187]: QLayout: Cannot add a null widget to QHBoxLayout/
Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup master_fd < 0
Jul 19 07:41:27 comp konsole[2187]: The Wayland connection experienced a fatal error: Too many open files
Jul 19 07:41:27 comp konsole[4941]: QLayout: Cannot add a null widget to QHBoxLayout/
Jul 19 07:41:27 comp systemd[1371]: app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Main process exited, code=exited, status=255/EXCEPTION
Jul 19 07:41:27 comp systemd[1371]: app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Failed with result 'exit-code'.
Jul 19 07:41:27 comp systemd[1371]: app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Consumed 314ms CPU time, 130.2M memory peak.
Jul 19 07:41:27 comp systemd[1371]: app-org.kde.konsole-2187.scope: Consumed 42.811s CPU time, 11.8G memory peak.

So, it seems Konsole opens too many files.

I added DefaultLimitNOFILE=524288:524288 to /etc/systemd/user.conf and /etc/systemd/system.conf .
And the bug disappeared.
So I suggest to follow advice in this Poettering blog https://0pointer.net/blog/file-descriptor-limits.html and to raise RLIMIT_NOFILE at startup.
Possibly this change should be propagated to all KDE apps or even to all Qt apps
Comment 1 tcanabrava 2025-07-19 06:52:31 UTC
Created attachment 183333 [details]
attachment-1688296-0.html

but why woyld anyone keep 300 konsole windows open?
i honestly dont think this is a bug.


On Sat, 19 Jul 2025 at 07:43 Askar Safin <bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=507216
>
>             Bug ID: 507216
>            Summary: Konsole fails if I open 300 windows with "QProcess:
>                     Cannot create pipe (Too many open files)"; please,
>                     raise RLIMIT_NOFILE
>     Classification: Applications
>            Product: konsole
>       Version First 25.04.2
>        Reported In:
>           Platform: Debian testing
>                 OS: Linux
>             Status: REPORTED
>           Severity: normal
>           Priority: NOR
>          Component: single-process
>           Assignee: konsole-devel@kde.org
>           Reporter: safinaskar@mail.ru
>   Target Milestone: ---
>
> SUMMARY
> Konsole fails if I open 300 windows with "QProcess: Cannot create pipe (Too
> many open files)"
>
> STEPS TO REPRODUCE
> Try to open 300 Konsole windows
>
> OBSERVED RESULT
> All windows close on its own
>
> EXPECTED RESULT
> Windows should not close on its own
>
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: Debian Trixie 13, x86_64
> uname -a: Linux comp 6.12.35+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian
> 6.12.35-1 (2025-07-03) x86_64 GNU/Linux
> KDE Plasma Version: 6.3.5
> KDE Frameworks Version: 6.13.0
> Qt Version: 6.8.2
> Konsole version: 25.04.2
> Wayland
>
> ADDITIONAL INFORMATION
> "journalctl" shows this:
>
> Jul 19 07:41:26 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup
> master_fd < 0
> Jul 19 07:41:26 comp konsole[2187]: QLayout: Cannot add a null widget to
> QHBoxLayout/
> Jul 19 07:41:26 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
> Jul 19 07:41:26 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup
> master_fd < 0
> Jul 19 07:41:26 comp konsole[2187]: QProcess: Cannot create pipe (Too many
> open
> files)
> Jul 19 07:41:26 comp konsole[2187]: QProcess: Cannot create pipe (Too many
> open
> files)
> Jul 19 07:41:26 comp konsole[2187]: QLayout: Cannot add a null widget to
> QHBoxLayout/
> Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
> Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup
> master_fd < 0
> Jul 19 07:41:27 comp konsole[2187]: QProcess: Cannot create pipe (Too many
> open
> files)
> Jul 19 07:41:27 comp konsole[2187]: QProcess: Cannot create pipe (Too many
> open
> files)
> Jul 19 07:41:27 comp konsole[2187]: QLayout: Cannot add a null widget to
> QHBoxLayout/
> Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
> Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup
> master_fd < 0
> Jul 19 07:41:27 comp konsole[2187]: QLayout: Cannot add a null widget to
> QHBoxLayout/
> Jul 19 07:41:27 comp konsole[2187]: kf.pty: Can't open a pseudo teletype
> Jul 19 07:41:27 comp konsole[2187]: org.kde.konsole: foregroundProcessGroup
> master_fd < 0
> Jul 19 07:41:27 comp konsole[2187]: The Wayland connection experienced a
> fatal
> error: Too many open files
> Jul 19 07:41:27 comp konsole[4941]: QLayout: Cannot add a null widget to
> QHBoxLayout/
> Jul 19 07:41:27 comp systemd[1371]:
> app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Main process
> exited, code=exited, status=255/EXCEPTION
> Jul 19 07:41:27 comp systemd[1371]:
> app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Failed with
> result 'exit-code'.
> Jul 19 07:41:27 comp systemd[1371]:
> app-org.kde.konsole@282b2f16ea744533bf654a1f827f5aad.service: Consumed
> 314ms
> CPU time, 130.2M memory peak.
> Jul 19 07:41:27 comp systemd[1371]: app-org.kde.konsole-2187.scope:
> Consumed
> 42.811s CPU time, 11.8G memory peak.
>
> So, it seems Konsole opens too many files.
>
> I added DefaultLimitNOFILE=524288:524288 to /etc/systemd/user.conf and
> /etc/systemd/system.conf .
> And the bug disappeared.
> So I suggest to follow advice in this Poettering blog
> https://0pointer.net/blog/file-descriptor-limits.html and to raise
> RLIMIT_NOFILE at startup.
> Possibly this change should be propagated to all KDE apps or even to all Qt
> apps
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 2 Askar Safin 2025-07-19 23:59:09 UTC
Created attachment 183363 [details]
my actual screenshot
Comment 3 Askar Safin 2025-07-20 00:03:04 UTC
(In reply to tcanabrava from comment #1)
> but why woyld anyone keep 300 konsole windows open?
> i honestly dont think this is a bug.

I just attached my actual screenshot. As you can see, I have a lot of windows opened. (See taskbar.)
Yes, there are not so many konsole windows among them.
But it is still possible I will need 300 konsole windows at some point.

Again: this bug is very easy to fix, just apply advice from that article ( https://0pointer.net/blog/file-descriptor-limits.html ), which is good practice anyway, i. e. raise fd soft limit to hard limit.

Possibly this should be done in all kde apps or even in all qt apps
Comment 4 Harald Sitter 2025-07-21 05:17:42 UTC
We don't set nofile. The distro does. Take it up with them.
Comment 5 Askar Safin 2025-07-22 01:13:07 UTC
(In reply to Harald Sitter from comment #4)
> We don't set nofile. The distro does. Take it up with them.

Application should set nofile to signal that it doesn't use "select".

Read this article: https://0pointer.net/blog/file-descriptor-limits.html

Distro cannot set this for all apps, because it doesn't know what apps use "select"
Comment 6 Harald Sitter 2025-07-22 01:21:13 UTC
Ok. Opening 300 konsoles is not supported.