NC 23 upgrade crashes php-fpm > server reached pm.max_children setting (10), consider raising it

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

https://www.73views.com/cloud/s/LLxfden3gQwoi3Y
Password: zSsBXmMkpW

Upgrade NC to version 23.0.0 (Beta channel)

The issue you are facing:

PHP-PFM crashed with segfault. a restart of php resolves the issue

Is this the first time you’ve seen this error? No

Steps to replicate it:

  1. I had php configured with the standard values: for pm.max_children = 5
    /etc/php/7.4/fpm/pool.d/www.conf
  2. log in to NC, and click on the Picture tab, then NC goes off and renders the thumbnail. After about 20 images, the php process crashed
  • this has worked fine before for about 9 months!
  1. Workaround: pm.max_children = 80 (and others values increased)

The output of your Nextcloud log in Admin > Logging:

nothing.. 

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

default configuration

The output of your Apache/nginx/system log in /var/log/____:

nothing
1 Like

Do you get more information regarding the segfault? How many images are in a folder, are there thousands of thumbnails created?

On less powerful machines, the generation can be a problem. There is a nice post about the preview generation for raspberry pi: Understanding and improving Nextcloud Previews – Own your bits

Many thanks for your reply.
I run a AMD Ryzen 5 2400G with 32GB of RAM, so not really a RasPI like machine.

There could have been a “large” maybe hundreds of images (sycing my mobile) in a single folder.

The main problem seams to be that for each thumbnail, a new php thread is created, and this kind of kills php! (which in my opinion should not).
maybe Nextcloud should have a max-concurrent-thumbnail creator value.

the strange thing is that this has worked fine for the last year, and just since the upgrade to NC23.0.0.0 the problem started.

I see if I can get a segfault
roman

I got the same problem when upgrading to 23.0.0 docker image. It keeps crashing with segfault. I have a folder with a lot of images too.

Solution:

on my 32GB server I changed these values in the file:
/etc/php/7.4/fpm/pool.d/www.conf
to:

pm.max_children = 128

; The number of child processes created on startup.
; Note: Used only when pm is set to ‘dynamic’
; Default Value: (min_spare_servers + max_spare_servers) / 2
; 15
pm.start_servers = 32

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to ‘dynamic’
; Note: Mandatory when pm is set to ‘dynamic’
; 15
pm.min_spare_servers = 32

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to ‘dynamic’
; Note: Mandatory when pm is set to ‘dynamic’
; 8
pm.max_spare_servers = 96

This will create a lot more tasks on the server, but it’s now stable. Also these numbers are kind of reflecting the size of memory which the application can use. Never the less, I’m a single person using Nextcloud! so I’m not sure if this is the right way, for a large installation. And this only happend after the upgrade to v23!

roman

You have 32GB of RAM. Use it! :wink:

The pm.max_children value is probably still a bit low, given the amount of RAM you have in your server.

Found this article, which might be helpful:

Personally I use the calculation from C. Riegers guide. Nextcloud 23 Installationsanleitung mit Apache2 - Carsten Rieger IT-Services which lead to the following values on my server with 8GB of RAM:

pm.max_children = 281
pm.start_servers = 140
pm.min_spare_servers = 93
pm.max_spare_servers = 187
2 Likes

It’s not working for me, I’m using nextcloud:23.0.0 docker images, which I believe is build on apache. And I changed the config at /usr/local/etc/php/conf.d/nextcloud.ini (there is no folder under /etc/php/7.4/fpm/pool.d/www.conf) and it is still showing segmentation fault.

app_1    | Initializing nextcloud 23.0.0.10 ...
app_1    | Upgrading nextcloud from 22.2.3.0 ...
app_1    | Segmentation fault (core dumped)
app_1    | Segmentation fault (core dumped)
nextcloud_app_1 exited with code 139
app_1    | Initializing nextcloud 23.0.0.10 ...
app_1    | Upgrading nextcloud from 22.2.3.0 ...
app_1    | Segmentation fault (core dumped)
app_1    | Segmentation fault (core dumped)
app_1    | Initializing nextcloud 23.0.0.10 ...
app_1    | Upgrading nextcloud from 22.2.3.0 ...
app_1    | Segmentation fault (core dumped)
app_1    | Segmentation fault (core dumped)
app_1    | Initializing nextcloud 23.0.0.10 ...
app_1    | Upgrading nextcloud from 22.2.3.0 ...
app_1    | Segmentation fault (core dumped)
app_1    | Segmentation fault (core dumped)
nextcloud_app_1 exited with code 139

On a bare metal Ubuntu installation the config files for PHP-FPM are in a separate directory, and the values have to be added to the www.conf file, not to the php.ini. Unfortunately I can’t tell you what the corresponding paths and files in the Docker container are, because I don’t use it…

Hi Guys,

I run a Ubuntu 20.04 LTS:

The path of the www.conf file is here:
sudo nano /etc/php/7.4/fpm/pool.d/www.conf

then you need to restart the service.

roman

for those using docker fpm here’s what you can add

command: >-
      sh -c '
        {
          echo pm=dynamic;
          echo pm.max_children=120;
          echo pm.start_servers=12;
          echo pm.min_spare_servers=6;
          echo pm.max_spare_servers=18;
        } >> /usr/local/etc/php-fpm.d/www.conf;
        exec /entrypoint.sh php-fpm
      '

see example: Updates fix reached children limit by lastlink · Pull Request #19 · lastlink/nextcloud-docker-ml-example · GitHub