-
Bug
-
Resolution: Fixed
-
Blocker
-
4.0.1, 4.1
-
MOODLE_400_STABLE, MOODLE_401_STABLE
-
MOODLE_401_STABLE
-
MDL-74910-master -
-
Easy
-
There is a regression caused by changes for MDL-73727.
The regression causes the file conversions to fail when processing the assignment submissions. This is especially noticeable when users upload documents containing multiple pages (documents with 10+ pages are almost guaranteed to break the conversion).
The cause is one of the sub-queries inside `files/classes/conversion.php`, which returns a random row from the larger set of rows:
... (SELECT id
FROM {files}
WHERE contenthash = :ccontenthash
LIMIT 1
) ...
Without ORDER BY the sequence of rows returned by SELECT can be arbitrary. LIMIT 1 will result in picking one of them (normally 1st in the set), but because the order of rows is not enforced the first row can be random. It totally depends on the specific database instance and might not manifest itself under certain conditions creating the appearance of the normal work if the database returns the last inserted row matching conditions inside WHERE clause.
Steps to reproduce the problem:
- Make sure a document converting plugin is installed and enabled. The easiest way to do so is downloading and installing the dummy file converter, which is attached to this ticket (dummy.zip).
- Create a test course and a test assignment with enabled "File Submissions" in Submission types. In the Feedback types the following should be set:
[x] Feedback comments
[x] Annotate PDF
[x] Feedback files - Enroll a student for the course.
- Login as the enrolled student and submit any document (.docx for instance, but bear in mind that dummy converter will use its own dummy output file for any input file).
- Run the conversion by calling
php admin/cli/scheduled_task.php --execute="\assignfeedback_editpdf\task\convert_submissions" |
from the CLI with this plugin enabled it's possible to see what a converter would be doing.
- Go to grading for the assignment created in step 2 with the user who has the appropriate access rights.
- Click "Grade" button. The preview page will display "Generating the PDF" that does not refresh or display errors.
When the page in step 7 is open it keeps adding a new record in the table `mdl_file_conversion` every 2 seconds or so because of the conversion status polling. Each time the a new record is created because the program does not see the new record created on the previous iteration.
Each new record is for the same conversion of the same file. If the page is kept open long enough it will insert thousands of rows for the same file conversion.
- blocks
-
MDL-68943 Converted PDF file does not update when submission file is overwritten
-
- Closed
-
-
MDL-75448 Annotate PDF fails to convert rotated images when using polling converter
-
- Closed
-
- is a regression caused by
-
MDL-73727 Improve get_conversions_for_file query performance on large sites
-
- Closed
-
- is blocked by
-
MDL-75247 convert_submission adhoc task throws exceptions when conversion needs polling
-
- Closed
-