Cron task making server irresponsive

Cron task making server irresponsive

од Charles-Antoine Clement -
Број на одговори: 0

Hi !

I am in the process to migrate from Moodle version 2.9.3 to 3.3.2


My server with version 2.9.3 is on a RedHat 6, with PHP 5 and Apache. The database and the moodledata folder are on another RedHat 6 server with Posgresql 9.3.  Its been running great for about 2 years.

I want to upgrade to the 3.3.2 version, it will be on a RedHat 7, with PHP 7 and Nginx. The database is still on RedHat 6 with Postgres 9.3 but I moved back the moodledata folder on the new server.

So far I copied the database and migrated to 3.3 and that wen well.


My only problemis when I do a ldap sync with the moodle cronjob, users cannot login. After
some time they get an error 504, but only when they try to log as a user or if they were logged already.

If I start another browser I can browse the site just fine without being logged in. When I try to login with a user, I get “Waiting for moodledev.localdev.ca” and eventually Nginx sends me a 504.


Here is the kind of error I get with Nginx :

2017/10/11 10:57:16 [error] 1607#0: *48 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.29.1.50, server: moodledev.localdev.ca, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock", host: "moodledev. localdev.ca", referrer: https://moodledev.localdev.ca/admin/phpinfo.php

I have about 90 000 users and the sync is about 15 minutes. If I try to sync manually with this command : php /var/www/moodledev/admin/cli/cron.php, I can see the sync working as indented, about 1-2 minutes later I cannot login or I cannot browse If I was loged. When I interrupt the sync everything goes back to normal immediately.

I also tried on Ubuntu with PHP 5.6 and Apache and I got the same behavior. The remote database is fine, I see a cpu usage of 15% during the sync, and my other Moodle instances are working just fine during the sync.

I even cloned my server to try if this was a issue with Nginx but I get the same exact behavior with PHP 7 and Apache. In production with 2.9.3 it works just fine.

When the sync is in progress I get a moderate usage with top :


Top 1

After 5 min

Top 2

I tried to edit the php.ini values for memory and also the php-fpm max execution time and readtimeout but I don’t think the problem is with php-fpm or nginx, because the site works fine if I am not logged in

I found this post which have the similar issue :

https://moodle.org/mod/forum/discuss.php?d=348247

I tried to adjust the keepalive value and no luck.

Anyone have an idea ?

Просек на рејтинзи: -