elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
124 stars 34 forks source link

While loop for accessing export file list runs wild on error #25

Closed mrpatg closed 4 years ago

mrpatg commented 5 years ago

Just noticed this tonight. New site on cyberpanel, using litespeed and http auth (php 7.3). Tried to run a build of a site and it hung for a few minutes, then the server crashed and ran out of disk space. 25gb in like 6 minutes.

After some investigating, I discovered that my settings for user auth hadn't saved, and it was failing this while loop in SitePublisher.php line 125:

        while (!feof($handle)) {
            $line = fgets($handle);
            $linecount++;
        }

Specific error was:

2019-03-10 01:57:32.100465 [NOTICE] [208.180.136.169:21557] [STDERR] PHP Warning:  feof() expects parameter 1 to be resource, boolean given in /home/build.website.com/public_html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SitePublisher.php on line 125
2019-03-10 01:57:32.100470 [NOTICE] [208.180.136.169:21557] [STDERR] PHP Warning:  fgets() expects parameter 1 to be resource, boolean given in /home/build.website.com/public_html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SitePublisher.php on line 126

Looks like it was failing, but kept on running, until it ran out of room!

Anyways, once I updated the http auth settings it ran without issue. So this is just a heads up in case anyone else runs into the same issue.

leonstafford commented 5 years ago

Thanks, @mrpatg.

Indeed, needs some sanity checking at the crawling initialization stage to fail faster when things aren't as expected. Some overhaul of the crawling coming soon and will keep this issue open to be addressed.

leonstafford commented 5 years ago

related https://github.com/leonstafford/wp2static/issues/309

leonstafford commented 4 years ago

super old issue, but type checks will catch the failure to open a resource now.

Have updated the above mentioned related ticket with a proposed solution to halt processing with n subsequent/initial failed requests to stop things going crazy