-
Bug
-
Resolution: Fixed
-
Blocker
-
4.1
-
MOODLE_401_STABLE
-
MOODLE_401_STABLE
-
MDL-75247-master -
Prerequisites
- Revert
MDL-73727
Unfortunately MDL-73727 introduces a regression that prevents testing this issue properly, so it must be reverted first. See MDL-74910 for more detail.
Replication steps
- Install and enable the attached fileconverter plugin
- Create a course with an assignment (default settings are fine) and a student
- As the student, submit something for the assignment
- Run: php admin/cli/adhoc_task.php -e you will see something like (NB: note the messages from the dummy converter that tell you what is happening)
Execute adhoc task: assignfeedback_editpdf\task\convert_submission
Adhoc task id: 8
Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"}
... started 16:35:18. Current memory use 14.2 MB.
Converting submission for user id 12
Hello from start_document_conversion
... used 33 dbqueries
... used 0.10417008399963 seconds
Adhoc task failed: assignfeedback_editpdf\task\convert_submission,Coding error detected, it must be fixed by a programmer: Document conversion completed with status 0
Backtrace:
* line 359 of /lib/cronlib.php: call to assignfeedback_editpdf\task\convert_submission->execute()
* line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
* line 131 of /admin/cli/adhoc_task.php: call to cron_run_adhoc_tasks()
- Wait 60 seconds (due to fail delay) and run it again: php admin/cli/adhoc_task.php -e and you will see:
Execute adhoc task: assignfeedback_editpdf\task\convert_submission
Adhoc task id: 8
Adhoc task custom data: {"submissionid":"3","submissionattempt":"0"}
... started 16:38:35. Current memory use 14.2 MB.
Converting submission for user id 12
Hello from poll_onversion_status. The conversion is complete!
The document has been successfully converted
... used 108 dbqueries
... used 1.3207869529724 seconds
Adhoc task complete: assignfeedback_editpdf\task\convert_submission
Ran 1 adhoc tasks found at Tue, 19 Jul 2022 16:38:35 +0800
In the first call to adhoc_task.php the conversion was started as an asynchronous conversion; an exception is thrown, and the task is marked as failed by Moodle. This is not a failure case and should not cause the task to fail. On the second call, the dummy converter reports itself as completed so everything finishes. In the real world, an async conversion may require multiple polls, and the faildelay will needlessly delay completion of the conversion. Additionally, the exceptions will pollute logs.
Instead, of throwing an exception when we get a non-complete status, we should check if the conversion is in progress, and if it is, requeue the adhoc task to poll again.
This has the added benefit of allowing us to pass along how many conversion attempts have been made in the newly queued adhoc task. Allowing us to reimpliment $CFG->conversionattemptlimit which was removed without replacement in MDL-71468
- blocks
-
MDL-74910 Assignment submission pdf file conversions fail due to incorrect sql lookup.
- Closed
-
MDL-75448 Annotate PDF fails to convert rotated images when using polling converter
- Closed
-
MDL-75457 Re-implement $CFG->conversionattemptlimit
- Open
- has a non-specific relationship to
-
MDL-73727 Improve get_conversions_for_file query performance on large sites
- Closed
- has been marked as being related by
-
MDL-68943 Converted PDF file does not update when submission file is overwritten
- Closed
- is a regression caused by
-
MDL-71468 Convert the "Prepare submissions for annotation" scheduled task into adhoc tasks
- Closed