-
Bug
-
Resolution: Fixed
-
Critical
-
2.3.1, 2.4
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
MOODLE_23_STABLE
-
I was getting really odd unit test failures on Windows.
The error was
PHP Warning: unlink(C:\Temp\phpunitdata_head/temp/backup/ca7db3c6c065317c0993e03a7cada794.log) [<a href='function.unlink'>function.unlink</a>]: Permission denied in C:\Users\tjh238\workspace\moodle_head\lib\moodlelib.php on line 10331
|
and once it started, every test after that was failing (about 1000 of them).
As you can see, absolutely no clue which test was failing (note MDL-34893) so I had to put in my own debugging.
That let me track it down to core_course_external_testcase::test_duplicate_course. This uses backup and restore code to duplicate a course.
The reason C:\Temp\phpunitdata_head/temp/backup/ca7db3c6c065317c0993e03a7cada794.log could not be unlinked is because something has that file open, and Windows (unlike Linux) does not let you delete open files.
What has that file open? Well, backup/util/loggers/file_logger.class.php open the file in the constructor, and only closes it in the destructor.
The backup code has huge nubmers of circular references between classes, so the file_logger is not garbage-collected until the end of the script. Thus the file stays open.
You can 'fix' this issue by adding to call to gc_collect_cycles(); at the end of test_duplicate_course. However, I suspect that web services should not be using file_logger. Perhaps error_log_logger would be better. Who knows.
- has a non-specific relationship to
-
MDL-35712 Ensure all backup & restore operations in core always call to controller->destroy()
- Closed
-
MDL-34908 External functions: timestamp should be set to a new PARAM_TIMESTAMP?
- Closed
-
MDL-35714 collect garbage after each unit test
- Closed
- is blocked by
-
MDL-34941 core_course_external_testcase::test_create_courses => start date timestamp is out of range
- Closed