mdjnelson/moodle-mod_customcert

The download of all issued certificates fails with the error "disconnected network"

Closed this issue · 3 comments

Hello

with the current plugin version 4.1.4 on Moodle 4.1.10 we notice that the download of large (not small) zip files fails.
For example, a zip file with 5 certificates is 5 MB in size. The download starts in the browser, but after 4 MB the download is interrupted by the browser with the error message "disconnected network".

While debugging the incidence or observing the download workflow, we found that the zip file (zip path, including folder) is removed from the file system before the download is completed.

We found out that the zip file is stored in the directory $CFG->localrequestdir. The path is created by calling make_request_directory() in certificate.php.

At the same time, the callback remove_dir is registered in the Moodle Shutdown Manager (lib/setuplib.php#1673), which results in the zip file being removed as soon as the PHP thread is terminated.

So it seems that localrequestdir is not a good choice in the case of downloads (especially if done by browsers in chunks).

Would you mind reconsidering the temporary folder where the zip file is created?

Can you please change the line on https://github.com/mdjnelson/moodle-mod_customcert/blob/MOODLE_402_STABLE/classes/certificate.php#L306 to $zipdir = make_temp_directory('download_all_certificates' . microtime()); and tell me if that fixes it? Thanks.

@mdjnelson No it did not fix the problem.

We just deployed an apache update, containing a fix for a mod_deflate issue which solved the problem magically. :)

Consequently my assumption was wrong regarding localrequestdir . Thank you very much for your effort though.

Thanks. Closing.