Jump to content

Solution for browser and other applications crashing due to process/thread limit


Go to solution Solved by Sander de Leeuw,

Recommended Posts

Posted (edited)

Hi,

 

I am running the latest Armbian image with Noble + GNOME for the Rock 5C.

 

I have build it using the `compile.sh` script without altering the kernel, desktop enabled, based on Noble, with GNOME, no applications, no extensions.

Added the kisak PPA repo afterwards and enabled the panthor overlay for hardware acceleration.

Should be close to the `Armbian_24.11.1_Rock-5c_noble_vendor_6.1.75_gnome-kisak_desktop.img` image, I think.

 

With Chromium (few tabs), VSCodium (working on some code) and a couple of terminals open, things were crashing all the time.

 

Here is a reproducable example with Chromium, when navigating to the URL:

https://www.geeksforgeeks.org/ulimit-soft-limits-and-hard-limits-in-linux/

 

sander@rock-5c:~$ chromium 
[3743:3743:1213/231308.263364:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is not part of the idle inhibition specification: https://specifications.freedesktop.org/idle-inhibit-spec/latest/
[3743:3795:1213/231308.438912:ERROR:backend_impl.cc(989)] Critical error found -8
[3743:3795:1213/231308.439341:ERROR:entry_impl.cc(955)] Failed to save user data
[3743:3795:1213/231308.821432:ERROR:backend_impl.cc(989)] Critical error found -8
[3743:3795:1213/231308.821616:ERROR:entry_impl.cc(955)] Failed to save user data
[3743:3743:1213/231308.821621:ERROR:gpu_disk_cache.cc(233)] Failed retry to open blob cache entry: -2
[3845:3861:1213/231317.658891:ERROR:ffmpeg_common.cc(970)] Unsupported pixel format: -1
[4052:4052:1213/231324.240574:ERROR:platform_thread_posix.cc(155)] pthread_create: Resource temporarily unavailable (11)
[4057:4057:1213/231324.266795:ERROR:platform_thread_posix.cc(155)] pthread_create: Resource temporarily unavailable (11)
[3743:3793:1213/231324.269115:ERROR:zygote_communication_linux.cc(164)] Did not receive ping from zygote child
[3743:3793:1213/231324.269180:FATAL:check.cc(361)] Check failed: false. NOTREACHED log messages are omitted in official builds. Sorry!
[3764:3764:1213/231324.269109:ERROR:zygote_linux.cc(639)] Zygote could not fork: process_type renderer numfds 5 child_pid -1
[1213/231324.290657:ERROR:elf_dynamic_array_reader.h(64)] tag not found
Trace/breakpoint trap

 

I was also not able to use Firefox, at all. Every new tab ended up in a "Snap. Your page crashed" view.

 

The root cause seems to be this:
 

ERROR:platform_thread_posix.cc(155)] pthread_create: Resource temporarily unavailable (11)

 

After some web searching, I found that the thread limits are set to a very low value.

(note "max user processes")

 

sander@rock-5c:~$ cat /proc/sys/kernel/threads-max
1685

sander@rock-5c:~$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 842
max locked memory           (kbytes, -l) 1015884
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 842
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

 

I searched through the Armbian build repository for code that sets these limits, but I didn't find any.

Seems that these limits are set or calculated by rockchip linux kernel.

 

After applying a few configuration changes, the system becomes much more stable and I have not had any crashes so far.

 

# /etc/rc.local  (updated)
echo 16384 > /proc/sys/kernel/threads-max

# /etc/security/limits.d/99-nproc.conf   (created)
* soft nproc 4096
* hard nproc 4096

# /etc/systemd/system.conf  (updated)
#DefaultTasksMax=15%
DefaultTasksMax=infinity

 

After a reboot, the changes are now applied. And no more crashes! And Firefox now works as well.

 

sander@rock-5c:~$ cat /proc/sys/kernel/threads-max
16384

sander@rock-5c:~$ ulimit -u
4096

 

 

Hope this is useful to someone else.

 

Edited by Sander de Leeuw
Posted (edited)

I did some more testing.

 

On the Rock 5C:

  • The current "Armbian_24.11.1_Rock-5c_noble_edge_6.11.7_gnome-kisak_desktop.img.xz" image has the same problem. 
  • The vendor "rock-5c_bookworm_kde_b1.output.img.xz" does not have this problem.

On the Orange Pi 5:

  • The current "Armbian_24.11.2_Orangepi5_noble_vendor_6.1.75_gnome-kisak_desktop.img.xz" image has the same problem.
    (Slightly different values, see console log below)
  • Joshua Riek's Ubuntu image does not have this problem.

 

# Orange Pi 5: Armbian_24.11.2_Orangepi5_noble_vendor_6.1.75_gnome-kisak_desktop.img.xz

sander@orangepi5:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.8Gi       844Mi       6.5Gi       242Mi       779Mi       6.9Gi
Swap:          3.9Gi          0B       3.9Gi

sander@orangepi5:~$ cat /proc/sys/kernel/threads-max 
2378

sander@orangepi5:~$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 1189
max locked memory           (kbytes, -l) 1015872
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 1189
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

 

This is how it looks on Joshua Riek's Ubuntu image

 

# Orange Pi 5: Joshua Riek's Ubuntu image

sander@orangepi5:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       1.7Gi       5.6Gi       100Mi       629Mi       6.1Gi
Swap:          1.0Gi          0B       1.0Gi

sander@orangepi5:~$ cat /proc/sys/kernel/threads-max 
61133

sander@orangepi5:~$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 30566
max locked memory           (kbytes, -l) 1014084
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 30566
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

 

So it seems to be specific to Armbian and occur on multiple RK3588 boards.

I will create an issue at Armbian's linux-rockchip project.

 

Edited by Sander de Leeuw

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines