AH01071: Got error 'PHP message: Cannot obtain session lock for sid

:warning: IMPORTANT, please fill the questions

We assume you are using Bitnami to deploy your application.

  • Which version of the application are you using?:
    Moodle 3.8

  • Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, ...) or VM (VMDK, VBOX):
    AWS Lightsail

  • Have you installed any plugin or modified any configuration file?:
    no

  • Describe here your question/suggestion/issue (expected and actual results):
    Getting session lock issue and website got stucked while number of users attemptiong moodle quiz.

  • Steps to reproduce the issue (if relevant):

  • Copy the apache log (if relevant):

    [Mon Nov 09 11:15:48.860742 2020] [proxy_fcgi:error] [pid 12760:tid 140566805300992] [client 47.247.91.12:51092] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:49.190126 2020] [proxy_fcgi:error] [pid 16402:tid 140566729766656] [client 47.247.91.12:51094] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:49.771294 2020] [proxy_fcgi:error] [pid 16402:tid 140566612268800] [client 47.247.91.12:51096] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:49.854474 2020] [proxy_fcgi:error] [pid 16709:tid 140566368880384] [client 47.247.91.12:51098] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:50.041855 2020] [proxy_fcgi:error] [pid 16402:tid 140566410843904] [client 47.247.91.12:51100] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:50.448723 2020] [proxy_fcgi:error] [pid 16402:tid 140566402451200] [client 47.247.91.12:51102] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:50.920690 2020] [proxy_fcgi:error] [pid 16709:tid 140566402451200] [client 47.247.91.12:51104] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:51.275831 2020] [proxy_fcgi:error] [pid 16709:tid 140566855657216] [client 47.247.91.12:51106] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:52.105793 2020] [proxy_fcgi:error] [pid 16709:tid 140566780122880] [client 47.247.91.12:51108] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:52.561373 2020] [proxy_fcgi:error] [pid 12528:tid 140566889228032] [client 47.247.91.12:51110] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:52.931719 2020] [proxy_fcgi:error] [pid 12760:tid 140566419236608] [client 47.247.91.12:51112] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:53.331558 2020] [proxy_fcgi:error] [pid 12528:tid 140566671017728] [client 47.247.91.12:51114] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:53.739501 2020] [proxy_fcgi:error] [pid 12528:tid 140566410843904] [client 47.247.91.12:51116] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:54.511758 2020] [proxy_fcgi:error] [pid 16402:tid 140566503163648] [client 47.247.91.12:51118] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:54.586322 2020] [proxy_fcgi:error] [pid 12528:tid 140566528341760] [client 47.247.91.12:51120] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:54.613978 2020] [proxy_fcgi:error] [pid 16709:tid 140566528341760] [client 47.247.91.12:51124] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:55.013061 2020] [proxy_fcgi:error] [pid 1636:tid 140566897620736] [client 47.247.91.12:51122] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:55.385173 2020] [proxy_fcgi:error] [pid 12760:tid 140566452807424] [client 47.247.91.12:51126] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:55.799968 2020] [proxy_fcgi:error] [pid 1638:tid 140566553519872] [client 47.247.91.12:51128] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:56.616260 2020] [proxy_fcgi:error] [pid 16709:tid 140566880835328] [client 47.247.91.12:51130] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:56.698467 2020] [proxy_fcgi:error] [pid 1641:tid 140566687803136] [client 47.247.91.12:51132] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:57.056089 2020] [proxy_fcgi:error] [pid 12760:tid 140566872442624] [client 47.247.91.12:51134] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:57.451550 2020] [proxy_fcgi:error] [pid 12528:tid 140566486378240] [client 47.247.91.12:51136] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/
    [Mon Nov 09 11:15:57.858412 2020] [proxy_fcgi:error] [pid 1641:tid 140566805300992] [client 47.247.91.12:51138] AH01071: Got error 'PHP message: Cannot obtain session lock for sid: flafgkvv230cc798k56ok3qk6v', referer: https://competitioncommunity.com/my/

Hi @deepikash6,

That seems to be an app's issue. However, we will review your configuration and logs to see if there is something wrong in the configuration. We have a Support Tool that will gather relevant information for us to analyze. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

Please note that you need to paste the code ID that is shown at the end.

hi jota i have sent you the support tool response link. Have you seen that ?

Hi @deepikash6,

Checking the number of requests your server receives, it seems there are a lot of IPs that are performing many requests. Can you check that?

-----------------------------------
Check performance issues: Count number of requests for the 10 most active IP addresses in the last 100.000 requests
-----------------------------------
Running: tail -n 100000 access_log | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 10 | awk '{print $1}'
In: /opt/bitnami/apache2/logs/

Output:

10945
2191
2013
1842
1772
1598
1519
1436
1258
1237

https://docs.bitnami.com/aws/apps/moodle/troubleshooting/deny-connections-bots-apache/

Due to the number of requests you are receiving, the PHP-FPM process is reaching the limits (/opt/bitnami/php/var/log/php-fpm.log)

[10-Nov-2020 11:01:56] WARNING: [pool moodle] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 5 idle, and 118 total children

If all the requests are valid, can you increase those values in the /opt/bitnami/php/etc/bitnami/common.conf file and restart the process?

sudo /opt/bitnami/ctlscript.sh restart php-fpm

Happy to help!


Was my answer helpful? Click on :heart:

Hi @jota, Thank you much for the solution. It worked.

Still having some issues. Sometimes site stucked and in the error_log it says, "cannot find record for user, creating new session. "

Hi @deepikash6,

Can you ask in the Moodle's forums to get more information about this error?

Thanks

Hi @jota,

Ok I will ask in moodle forum for last error.

The performance is improved but still i am getting that warning to increase start, min and max server. Is there any proper formula to increase this numbers ?

You have some online guides like this one that explains good practices to follow when configuring those parameters

https://tideways.com/profiler/blog/an-introduction-to-php-fpm-tuning

Thank you @jota for your valuable help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.