Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79307

Assign feedback PDF conversion task should handle misconfigured ghostscript better

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79307-403
    • Hide

      Setup

      1. Login as admin
      2. Create a user user
      3. Create a course
      4. Enrol test user as student in course
      5. Add an Assignment activity to the course:
        • Submission types: File submissions (this is the default)
        • Feedback types: Annotate PDF

      Testing

      1. Navigate to Server > System paths in site administration
      2. Change Path to ghostscript to an invalid path (note this is to simulate the case of ghostscript not being installed at all)
      3. Logout
      4. Log in as test user
      5. Navigate to course assignment activity
      6. Press Add submission and upload Example.pdf
      7. Wait for cron to run, or execute the adhoc task manually
      8. Navigate to Servers > Tasks > Task logs in site administration
      9. Look for the Convert submission task failure
      10. Press Actions > View
      11. Confirm you see the following message:

        Adhoc task failed: assignfeedback_editpdf\task\convert_submission,The configured path to ghostscript is not correctly set: The ghostscript path points to a non-existent file (doesnotexist)
        

      12. Navigate to Server > System paths in site administration
      13. Change Path to ghostscript to a valid path (note assumes ghostscript is installed)
      14. Wait for cron to run, or execute the adhoc task manually
      15. Navigate to Servers > Tasks > Task logs in site administration
      16. Look for the Convert submission task success
      17. Press Actions > View
      18. Confirm you see the following message:

        The document has been successfully converted
        

      Show
      Setup Login as admin Create a user user Create a course Enrol test user as student in course Add an Assignment activity to the course: Submission types: File submissions (this is the default) Feedback types: Annotate PDF Testing Navigate to Server > System paths in site administration Change Path to ghostscript to an invalid path ( note this is to simulate the case of ghostscript not being installed at all) Logout Log in as test user Navigate to course assignment activity Press Add submission and upload Example.pdf Wait for cron to run, or execute the adhoc task manually Navigate to Servers > Tasks > Task logs in site administration Look for the Convert submission task failure Press Actions > View Confirm you see the following message: Adhoc task failed: assignfeedback_editpdf\task\convert_submission,The configured path to ghostscript is not correctly set: The ghostscript path points to a non-existent file (doesnotexist) Navigate to Server > System paths in site administration Change Path to ghostscript to a valid path ( note assumes ghostscript is installed) Wait for cron to run, or execute the adhoc task manually Navigate to Servers > Tasks > Task logs in site administration Look for the Convert submission task success Press Actions > View Confirm you see the following message: The document has been successfully converted

      The default configuration for a site has the EditPDF assignment submission plugin enabled, and selected for all new assignment activities

      Unless ghostscript is correctly installed and configured, the task to perform the conversion of file submissions enters a fail loop wherein the error produced is as follows:

      Execute adhoc task: assignfeedback_editpdf\task\convert_submission
      Adhoc task id: 4
      Adhoc task custom data: {"submissionid":"1","submissionattempt":"0"}
      ... started 15:02:48. Current memory use 32.8 MB.
      Converting submission for user id 3
      ... used 71 dbqueries
      ... used 0.6078770160675 seconds
      Adhoc task failed: assignfeedback_editpdf\task\convert_submission,Error generating image with ghostscript, debugging info: <pre>Command:
      '/usr/bin/gs' -q -sDEVICE=png16m -dSAFER -dBATCH -dNOPAUSE -r'100' -dFirstPage='1' -dLastPage='1' -dDOINTERPOLATE -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sOutputFile='/tmp/requestdir/znnZ/64fb298819efc/64fb2988ddce8/image_page0.png' '/tmp/requestdir/znnZ/64fb298819efc/64fb2988ddce8/error.pdf'
       
      Result:
       
       
      Output:
      </pre>
      Backtrace:
      * line 806 of /mod/assign/feedback/editpdf/classes/pdf.php: call to assignfeedback_editpdf\pdf->get_image()
      * line 565 of /mod/assign/feedback/editpdf/classes/pdf.php: call to assignfeedback_editpdf\pdf::get_error_image()
      * line 441 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\pdf->get_images()
      * line 603 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::generate_page_images_for_attempt()
      * line 104 of /mod/assign/feedback/editpdf/classes/task/convert_submission.php: call to assignfeedback_editpdf\document_services::get_page_images_for_attempt()
      * line 508 of /lib/classes/cron.php: call to assignfeedback_editpdf\task\convert_submission->execute()
      * line 302 of /lib/classes/cron.php: call to core\cron::run_inner_adhoc_task()
      * line 128 of /lib/classes/cron.php: call to core\cron::run_adhoc_tasks()
      * line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()
      

      We should not even reach that point in the execution if we know the conversion can never succeed (because ghostscript is absent/misconfigured) - improve the error, and make it more useful for the user/admin to interpret

        1. Example.pdf
          58 kB
        2. MDL-79307_402_1.png
          MDL-79307_402_1.png
          186 kB
        3. MDL-79307_402_2.png
          MDL-79307_402_2.png
          155 kB
        4. MDL-79307_403_1.png
          MDL-79307_403_1.png
          257 kB
        5. MDL-79307_403_2.png
          MDL-79307_403_2.png
          184 kB
        6. MDL-79307_main_1.png
          MDL-79307_main_1.png
          232 kB
        7. MDL-79307_main_2.png
          MDL-79307_main_2.png
          207 kB

            pholden Paul Holden
            pholden Paul Holden
            Mathew May Mathew May
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 25 minutes
                2h 25m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.