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

Unovonv re-conversion in grading interface no longer working



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.11, 3.7.5
    • Fix Version/s: None
    • Component/s: Assignment, Feedback
    • Labels:
    • Affected Branches:


      Possibly related and/or duplicative of MDL-62626, MDL-63425, and MDL-64801: It appears that the functionality introduced in MDL-56122 is no longer functioning on current supported versions of Moodle. In my test I have Unoocnv listener and soffice setup correctly/enabled and Unoconv does work to convert my test document on the first attempt when the listener is running on M35. However if I shut the listener off and visit the grading page to generate a blank PDF, then start the listener and revisit the page it should detect the blank PDF value and attempt to regenerate it from the submitted .docx assignment according to the changes that were made in that issue. However it is not doing this on Moodle 3.5.11+ (Build: 20200312) or 3.7.5 (Build: 20200309), at least partially because the hash value of 'combined.pdf' which is retrieved does not match the one defined in the constant BLANK_PDF_HASH within /mod/assign/feedback/editpdf/classes/document_services.php per blank-document-contenthash-mismatch.png. I've traced through this some and it appears that the list_compatible_submission_files_for_attempt() function called from within get_combined_document_for_attempt() does not return the blank PDF with given hash value - the only place the related BLANK_PDF_BASE64 value is used to output a blank PDF is at ./mod/assign/feedback/editpdf/classes/combined_document.php:364 within the store_empty_document() function, which doesn't seem to be called when the document conversion request is done through the grading preview pane.


      Steps to reproduce on Ubuntu 16.04.6 LTS are:

      1. Install Unoconv and dependencies - note this installs unoconv 0.7 on my system:

        apt-get install -y ghostscript unoconv libreoffice-java-common default-jre libreoffice-java-common 

      2. Place following contents in new systemd file at /etc/systemd/system/unoconv.service for running unoconv as a service per https://moodle.org/mod/forum/discuss.php?d=359239 (may need to confirm UNO_PATH matches correct location of libreoffice on your system):

        Description=Unoconv listener for document conversions
        After=network.target remote-fs.target nss-lookup.target
        ExecStart=/usr/bin/unoconv --listener

      3. Start Unoconv listener

        systemctl restart unoconv.service

      4. Confirm listener running:

        pstree -lap | grep -i '\([s]office\|[u]noconv\)'

          |-python3,1300 /usr/bin/unoconv --listener
          |   |-soffice.bin,1539 --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore --accept=socket,host=,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
          |   |   |-(soffice.bin,1541)

      5. Enable unoconv document conversion in site-wide settings under Site Administration -> Plugins -> Document converters -> Manage document converters
      6. Login as the site admin and create a test course with two enrolled test students
      7. Create a test assignment with the following settings:
        1. Under Submission types check both Online text and File submissions
        2. Under Feedback types check Annotate PDF
      8. Login as the first test user and submit a valid .docx file to complete the assignment, such as the "testassignment1.docx" one attached
      9. Login as the second test student and submit some online text to complete the assignment
      11. Stop the Unoconv listener:

        systemctl stop unoconv.service

      12. Login as the site admin and click on the test assignment, then click View all submissions, then click the Grade button on the first (File upload) assignment - the Grading page should load with the preview pane and fail to create a PDF of the document, generating a blank PDF instead.
      13. Click the next arrow to move to the second submission
      14. Restart the Unoconv listener on the server:

        systemctl restart unoconv.service

      15. Go back into the grading preview pane and navigate between the assignments, which will not regenerate the PDFs (i.e. only the blank PDF will continue to display for both assignments)


      A few other notes:

      • When I try to download the test PDF from the Unoconv settings page, it results in the following error - this is strange to me because I'm certain that I successfully downloaded and viewed it at some point during testing, but all I'm getting at present is the following error:

        Coding error detected, it must be fixed by a programmer: id is required to delete
        More information about this error
        Debug info:
        Error code: codingerror
        Stack trace:
            line 600 of /lib/classes/persistent.php: coding_exception thrown
            line 197 of /files/converter/unoconv/classes/converter.php: call to core\persistent->delete()
            line 51 of /files/converter/unoconv/testunoconv.php: call to fileconverter_unoconv\converter->serve_test_document()

      • On 3.7.5 (Build: 20200309) the uploaded .docx submission is now failing to convert on the first try in the grading preview pane even when the listener is running, although this was working previously and I'm testing on the exact same saved snapshot I was using yesterday. Another thing to note is that an online text submission does convert successfully on the first try.
      • I'm seeing some conflicting information based on the fact that this functionality definitely seems to have existed in Moodle previously, but there are newer feature requests asking for functionality to manually re-convert to PDF in the preview pane. So just to clarify my expectations, is automated re-conversion in the preview pane something that we should expect to work at present? Or was this feature removed at some point?




            lreynolds Logan Reynolds
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            1 Vote for this issue
            3 Start watching this issue