Add an explanation for Fiber stack protect failed
and Fiber stack allocate failed
exceptions.
MadelineProto + Amphp v3 + PHP 8.1 make use of mmap
to allocate stack space for each fiber (aka green threads), with 2 mmap
'ed areas per fiber.
These errors occur when the maximum number of mmap'ed regions is reached: you should increase the vm.max_map_count
kernel config to 262144
to fix them.
Run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count
To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf
On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.