Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got weird error output -- course not able to show using template. #12

Open
CSUF-CHUCK opened this issue Feb 26, 2019 · 8 comments
Open

Comments

@CSUF-CHUCK
Copy link

moodle version : 3.6.2+ (Build 20190208)
php version :
PHP 7.1.26 (cli) (built: Jan 11 2019 10:28:41) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.26, Copyright (c) 1999-2018, by Zend Technologies

With debug on, trying to create a course and the following error output was trapped.
moodledatadir/lock location is empty out.

I am able to verify the regex is correct. is there something I done wrong ? Thank you for your time looking.

Exception encountered in event observer '\local_course_template\observers::course_created': Coding error detected, it must be fixed by a programmer: A lock was created but not released at: /var/www/html/moodle/local/course_template/classes/observers.php on line 34 Code should look like: $factory = \core\lock\lock_config::get_lock_factory('type'); $lock = $factory->get_lock(Resource id #30); $lock->release(); // Locks must ALWAYS be released like this.

line 36 of /local/course_template/classes/observers.php: call to core\lock\lock->__destruct()
line ? of unknownfile: call to local_course_template\observers::course_created()
line 155 of /lib/classes/event/manager.php: call to call_user_func()
line 75 of /lib/classes/event/manager.php: call to core\event\manager::process_buffers()
line 834 of /lib/classes/event/base.php: call to core\event\manager::dispatch()
line 2466 of /course/lib.php: call to core\event\base->trigger()
line 162 of /course/edit.php: call to create_course()
@mackensen
Copy link
Contributor

Usually a message like this means there was an unrelated failure, which then caused the lock to not be released. It's a symptom, not the cause. There's not much in the way of debugging statements inside classes/helper.php, but that's probably where the actual issue lies.

@CSUF-CHUCK
Copy link
Author

the version I installed was .. .Local_course_template v2018051300
This is the same version which worked in moodle 3.4.
any pointer you can direct me to check ?

@mackensen
Copy link
Contributor

That's the most recent version; it's been tested against Moodle 3.6 and should be fine.

@andyzito
Copy link

andyzito commented Jan 3, 2020

Hi CSUF-CHUCK, are you still experiencing this error?

@CSUF-CHUCK
Copy link
Author

CSUF-CHUCK commented Jan 3, 2020 via email

@andyzito
Copy link

andyzito commented Jan 6, 2020

Ok. I'll throw out some questions to try and troubleshoot more:

  1. Are you using database locks or file locks? I believe DB locking is turned on with the following line in config.php: $CFG->lock_factory = '\\core\\lock\\db_record_lock_factory';

  2. When you manually clear the locks, and then try to create a course from a template, does it fail, and what is the message? Can you observe the lock file/entry still in existence after this?

  3. Are there any other warnings or error messages? As Charles rightly pointed out, the actual message you've posted is a symptom. The lock is failing to release because something else is going wrong in the creation of the template course and causing the whole process to die before the lock is released. If you have access to your code base you could insert some manual debugging statements in classes/helper.php inside the template_course function -- this is what the observer is ultimately calling, and where something has gone wrong that prevents the lock from being released.

@mackensen
Copy link
Contributor

@CSUF-CHUCK we've just released a new version that may have addressed the issue you're experiencing.

@phette23
Copy link

phette23 commented Dec 1, 2020

Just FYI, we saw similar errors (messages about lock not being released tied into messages about fopen having too many open files) when we tested creating a large number (≈800) of courses with templates. When we did it live, I greatly increased the OS limit on open files (ulimit -Hn 50000; ulimit -Sn 50000; on Linux) before initiating the course creation and the problem didn't recur. We were also using caching on the production instance and not on our test server.

Example error:

Warning: fopen(...moodledata/temp/backup//28bb9178fbc2709cb14dc34c1b73df68.log): failed to open stream: Too many open files in ...moodle/backup/util/loggers/file_logger.class.php on line 45
++ Exception encountered in event observer '\local_course_template\observers::course_created': Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
...moodle/local/course_template/classes/observers.php on line 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants