Comments (7)
The actual error message is not probably relevant here. I believe there is some other error/exception raised that kills PHP, and this message "A lock was created but not released" is just a consequence.
from moodle-tool_lockstats.
I am getting somewhere. As I suspected, there was another exception thrown which was silently swallowed and not reported - or better it was overruled by the lock exception . After I applied the following change:
diff --git a/lib/classes/lock/lock.php b/lib/classes/lock/lock.php
index 7b117c3..6ee1380 100644
--- a/lib/classes/lock/lock.php
+++ b/lib/classes/lock/lock.php
@@ -114,6 +114,7 @@ class lock {
if (!$this->released && defined('PHPUNIT_TEST')) {
$key = $this->key;
$this->release();
+ return;
throw new \coding_exception("A lock was created but not released at:\n" .
$this->caller . "\n\n" .
" Code should look like:\n\n" .
and attempted to run a task, I finally got
Default exception handler: Exception - Call to undefined function tool_lockstats\posix_getpid() Debug:
Error code: generalexceptionmessage
* line 234 of /admin/tool/lockstats/classes/proxy_lock_factory.php: Error thrown
* line 148 of /admin/tool/lockstats/classes/proxy_lock_factory.php: call to tool_lockstats\proxy_lock_factory->log_lock()
* line 127 of /admin/tool/task/cli/schedule_task.php: call to tool_lockstats\proxy_lock_factory->get_lock()
which I was able to confirm - the site's PHP was built without the POSIX functions.
However, I think it reveals a problem in the Moodle core code as it hides the real cause why an exception was thrown.
from moodle-tool_lockstats.
Indeed. It checks defined('PHPUNIT_TEST')
which is always true. Going to fix this upstream.
from moodle-tool_lockstats.
https://tracker.moodle.org/browse/MDL-59546
from moodle-tool_lockstats.
thanks @mudrd8mz - although it still seems like there is probably something missing re posix_getpid()
Is the posix extension something we can assume moodle requires (it isn't in core admin/environment.xml) or should I declare that in my environment.xml ?
from moodle-tool_lockstats.
As per http://php.net/manual/en/posix.installation.php POSIX functions are enabled by default in PHP. But yeah, they can be still disabled so it may be wise to put them into environment.xml. Although there is still https://tracker.moodle.org/browse/MDL-52319
Maybe in this particular case, you can simply check if function exists before calling it. And if it is not available, just store an empty value (and then display as a dash or question mark) instead of PID? As I understood it, it is an information for the admin only, not essential for the plugin functionality.
from moodle-tool_lockstats.
Cool, I'll reopen this and remove that hard dependancy
from moodle-tool_lockstats.
Related Issues (20)
- Add ability to drill down to specific instances in Adhoc tasks summary and delete tasks HOT 2
- New report on the heaviest tasks in cumulative seconds
- Split all the reports into tab with 1 report per page
- Deprecated: array_key_exists
- Add Check API integration for stale locks
- Switch to reusable workflows
- Potential bug: Comparisons of text column conditions are not allowed when deleting a lock record HOT 4
- Most finished core tasks still showing in current locks table even they are finished
- SQL Error on adhoc_tasks.php 141 HOT 2
- Record counts of whether locks were opened from web or cli or WS
- Make a cli version which shows current locks, sorta like 'ps aux'
- Minor: Passing by reference non-variable HOT 2
- Enhancement: add ability to release all locks from the index.php page
- Currently long running tasks are not included in the average
- The Name field under Slowest tasks this week can sometimes be empty
- The 'Slowest tasks this week' download as csv is missing almost everything
- /admin/tool/lockstats/locks_detail.php missing lang key [[table_latency]] HOT 1
- Profile /admin/tool/lockstats/ and find perf bottle neck
- Failed adhoc tasks are not shown as failed HOT 1
- When cleaning up stale locks it can throw an exception
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-tool_lockstats.