catalyst / moodle-tool_lockstats

Moodle cron / task API lock statistics admin tool
https://moodle.org/plugins/tool_lockstats
6 stars 13 forks source link

Running out of memory - proxy_lock_factory.php on line 171 #23

Open RussellEngland opened 6 years ago

RussellEngland commented 6 years ago

Hey Chaps! :)

We are running out of memory on a site with around 250,000 users.

Is there a way to resolve this without increasing the memory?

Execute scheduled task: Check Completion (mod_tincanlaunch\task\check_completion)
... started 10:58:59. Current memory use 26.1MB.
Checking module id 1.

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in 
.../lib/dml/pgsql_native_moodle_database.php on line 797

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in 
.../admin/tool/lockstats/classes/proxy_lock_factory.php on line 171

Line 171 is part of commit 09c49f67

public function release_lock(lock $proxylock) {
    $task = $proxylock->get_key();

    $this->openlocks[$proxylock->get_key()];

    $lock = array_pop($this->openlocks[$proxylock->get_key()]);

Cheers, Russ

brendanheywood commented 6 years ago

Hmm, have you done any debugging to see how many locks there actually are in ->openlocks[] ?

Is the number of students relevant here, like is tincan doing something odd like creating a lock for each user?

In typical use we are seeing at most a double digit number of locks at any one point in time, and generally they are all of cron / task locks. So maybe all these extra locks you are nothing to do with the task api and could be simple ignored completely by the lock proxy.