Moodle crashes after several students try to access or submit a questionnaire

Moodle crashes after several students try to access or submit a questionnaire

by DIEGO QUEVEDO -
Number of replies: 4

good day

In my moodle installation http://doshape.com/ciberdario if more that 10 or 20 users try to access or submit to questionnaire, the server crashes and return to error 500

enter image description here

This thread https://moodle.org/mod/forum/discuss.php?d=13326 has the same problem but don't have any answers.

The same with this post https://www.howtoforge.com/community/threads/server-error-500-moodle-3-0.71675/ . 

The same with this too https://x10hosting.com/community/threads/500-error-under-moodle.130542/ . and the same with others.... any solution to this.

Cpanel's log error or error_log file don't give any feedback about this error... only say

Cannot find session record h25kg7hhk122f7d26rp45l40l6 for user 97, creating new session or similar.

I change the php limits in my cpanel using the INI MultiPHP


please give me solutions o alternatives; actually I want more than 100 access to the same time


thanks


best regards


Average of ratings: -
In reply to DIEGO QUEVEDO

Re: Moodle crashes after several students try to access or submit a questionnaire

by Ken Task -
Picture of Particularly helpful Moodlers

Error 500's could be the result of many things.  The links you've provided in your research may have had 500 errors but in briefly reading through them ... the first is very old (which is why that thread is locked).   The second and third links provided had different problems although showing error 500's ... and different solutions.

In your case, this is key:

"Cannot find session record h25kg7hhk122f7d26rp45l40l6 for user 97, creating new session or similar.

which indicates that you are using database for sessions, as opposed the recommended 'files.

Login to moodle and in the site admin search box type: session.

Find the setting for sessions to use database and change to files - ie, turn off using database for sessions.

That might kick you out of your session as the next click on anything would check for a session file and there isn't one there yet for your access.

Check your moodledata directory ... there should now be a 'sessions' directory and contained therein a file ... which is a session file for a user.

Also, check how often your server is running the cron job/task ... recommendation now is every minute.  One of the task in the cron job is a check on sessions and to clean up stale session files found in moodledata/sessions (once you switch from DB to files).  If you don't change sessions to files and leave it for DB, that could be the problem ... task can't update the records fast enough or at all if DB server is struggling.

As far as desire to have X number of users in system taking quiz/questionnaire at same time, that  relates to several factors in setup of server.   The major one being the number of connections allowed to the DB for the Moodle ... which is a mysql setting.   Not set in Moodle, but via whatever you have for MySQL in cPanel ... IF that is even there for you may not have a package with the hosting provider that allows you to tweak such settings ... if you are on a shared system.

So a little more info about server is in order ..

How are you hosted?  shared/VPS/other

How much memory does your server have OR been allocated?

Etc.

'spirit of sharing', Ken





In reply to Ken Task

Re: Moodle crashes after several students try to access or submit a questionnaire

by DIEGO QUEVEDO -

mr Kent


thanks for super answer


actually my sessions are not using the DB.




using your answer I got some new data:


about cron, I only have one that is running every 3 hours with 58 minutes.... but I think this is nothing about my moodle .  please, do you have some ref in order to create the correct cron to my moodle distribution?



for mysql I have the typical, but how change the number of connections allowed to the DB for the Moodle???  Actually I read about that, and only say that is a automatic calc

using:

MaxClients = Total available memory * 80% / Max memory usage of apache process



actually my server information is this


How are you hosted?  shared   

How much memory does your server have OR been allocated?

my host is justhost.com in pro plan 

Website Space 50 GB

Bandwidth Unmetered

Performance Standard


Server Information

Server Information

ItemDetail
Hosting PackagePro
Server Namee30
cPanel Version68.0 (build 36)
Apache Version2.4.33
PHP Version5.6.35
MySQL Version5.6.32-78.1
Architecturex86_64
Operating Systemlinux
Dedicated IP Address108.167.137.216
Path to Sendmail/usr/sbin/sendmail
Path to Perl/usr/bin/perl
Perl Version5.10.1
Kernel Version3.10.0-693.11.6.1.ELK.el6.x86_64

Service Information

ServiceDetailsStatus
queueprocdupgreen-status.gif
cpsrvdupgreen-status.gif
spamdupgreen-status.gif
ftpdupgreen-status.gif
cpanellogdupgreen-status.gif
imapupgreen-status.gif
namedupgreen-status.gif
Server Load0.03 (32 cpus)green-status.gif
Memory Used16.56 %green-status.gif
Swap6.98 %green-status.gif
Disk / (/)25 %green-status.gif
Disk /tmp (/tmp)1 %green-status.gif
Disk /usr (/usr)49 %green-status.gif
Disk /var (/var)19 %green-status.gif
Disk /home1 (/home1)52 %green-status.gif
Disk /home2 (/home2)49 %green-status.gif
Disk /backup1 (/backup1)73 %green-status.gif
Disk /backup2 (/backup2)60 %green-status.gif


thanks for all help



In reply to DIEGO QUEVEDO

Re: Moodle crashes after several students try to access or submit a questionnaire

by Ken Task -
Picture of Particularly helpful Moodlers

Thanks for the detailed info ... too much really ... but ...

First, cron job:

https://docs.moodle.org/34/en/Cron

Now I can't tell you specifically how to do above with your system but it would be similar to the cron job shown for checking updates ... what ever that does.   Yours, however, would be using php and pointed to moodlecode/admin/cli/cron.php

Since it's on shared (bad news) you might have to get helpdesk involved.

Shared systems are having a harder time running Moodles these days ... and don't see that getting any better as moodle only does more with each release.    Sooner or later ... maybe sooner for you ... think if you desire to stay with that hosting company (sometimes better the devil you know than the devil you don't) you'll have to move to a VPS ... means more $ and if unmanaged, you take over managing ... not ready for that you might also check into 'managed' where hosting provider does the backend stuff.

Case in point ...

"MaxClients = Total available memory * 80% / Max memory usage of apache process"

is dependent upon how much of the shared memory you have access to to begin with.  If your shared system only has access to 5Gig for maxclients * 80% of total ***available*** memory that sounds like if all the other sites on that same box aren't busy you get a spurt of more memory .. but it's taken away when those other sites get busy.

Do start with cron job first and get that running as often as shared hosting will allow.

Will go from there/here, then.   But be checking into other plans they offer, services, how much etc. now.

'spirit of sharing', Ken
In reply to DIEGO QUEVEDO

Re: Moodle crashes after several students try to access or submit a questionnaire

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Worth comparing to "Why is my small Moodle setup maxing out my server's 1 GB memory limit?" https://moodle.org/mod/forum/discuss.php?d=368354.

Generally it is a good idea to explore the Hardware and performance forum and its documentation. Note that the documentation appear only when you start a new discussion in that forum.