Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP2 Network error when loading images in backend #5827

Open
jarlah opened this issue Mar 21, 2020 · 21 comments
Open

HTTP2 Network error when loading images in backend #5827

jarlah opened this issue Mar 21, 2020 · 21 comments
Assignees

Comments

@jarlah
Copy link

@jarlah jarlah commented Mar 21, 2020

Description

Network error ERR_HTTP2_PROTOCOL_ERROR 500 when loading asset images in backend. Has no effect on frontend, but image editor does not work because of this.

Steps to reproduce

  1. Create a medium web hosting account at https://domainname.shop/webhotel?currency=GBP&lang=en (or whatever, not important. But mini is impossible and frustrating for a developer)
  2. Install craft (I've renamed my web folder to www so it matches the web hosting directory and moved the craft folder on level above it .. and of course edited www/index.php to point to the correct location of craft cms folder)
  3. Create an assets resource in backend
  4. Upload an image
  5. Expect to see thumbnails and preview

Additional info

  • Craft version: 3.4.10.1
  • PHP version: 7.3.15
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions: Minify 1.2.9, Redactor 2.6.1, Typed link field 1.0.20
  • Server software: Apache/2.4.25
  • Image driver & version: Imagick 3.4.4 (ImageMagick 6.9.7-4)
@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 21, 2020

Screenshot 2020-03-21 at 20 47 38

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 21, 2020

the url that fails

https://hubenthal.no/index.php?p=admin/actions/assets/thumb&uid=c3e3aa7a-425d-406a-8b04-914b09b8e4f2&width=64&height=64&v=1584561477

Oh and yeah, that's my domain and web site, but I guess knowing that won't help ;)

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 21, 2020

Screenshot 2020-03-21 at 21 12 18

Clicking the preview button will however successfully load a preview of the image with a faded background.

@brandonkelly

This comment has been minimized.

Copy link
Member

@brandonkelly brandonkelly commented Mar 23, 2020

Try clearing out your storage/logs/ folder, then reproduce the error, and check the folder. Did any log files get created? If phperrors.log gets created, then post the entire contents. If web.log gets created, search through it for [error] and post the error that follows it, including its stack trace.

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

2020-03-25 07:41:34 [-][1][bd6756e4849bb80517ad04f426a110c3][error][yii\base\ErrorException:2] yii\base\ErrorException: set_time_limit(): Tried to raise runtime beyond limit (0/180). in /home/5/h/hubenthal/craft/vendor/yiisoft/yii2/web/Response.php:434
Stack trace:
#0 /home/5/h/hubenthal/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError(2, 'set_time_limit(...', '/home/5/h/huben...', 434)
#1 [internal function]: craft\web\ErrorHandler->handleError(2, 'set_time_limit(...', '/home/5/h/huben...', 434, Array)
#2 /home/5/h/hubenthal/craft/vendor/yiisoft/yii2/web/Response.php(434): set_time_limit(0)
#3 /home/5/h/hubenthal/craft/vendor/yiisoft/yii2/web/Response.php(340): yii\web\Response->sendContent()
#4 /home/5/h/hubenthal/craft/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Response->send()
#5 /home/5/h/hubenthal/www/index.php(21): yii\base\Application->run()
#6 {main}
@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

max execution time is set to 120, and all is green on System Report.

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

I went into the file craft/vendor/yiisoft/yii2/web/Response.php and changed the set_time_limit from 0 (possibly unbounded) to 99.

/**
     * Sends the response content to the client.
     */
    protected function sendContent()
    {
        if ($this->stream === null) {
            echo $this->content;

            return;
        }

        if (function_exists('set_time_limit')) {
            set_time_limit(99); // Reset time limit for big files
        } else {
            Yii::warning('set_time_limit() is not available', __METHOD__);
        }

        $chunkSize = 8 * 1024 * 1024; // 8MB per chunk

        if (is_array($this->stream)) {
            list($handle, $begin, $end) = $this->stream;
            fseek($handle, $begin);
            while (!feof($handle) && ($pos = ftell($handle)) <= $end) {
                if ($pos + $chunkSize > $end) {
                    $chunkSize = $end - $pos + 1;
                }
                echo fread($handle, $chunkSize);
                flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
            }
            fclose($handle);
        } else {
            while (!feof($this->stream)) {
                echo fread($this->stream, $chunkSize);
                flush();
            }
            fclose($this->stream);
        }
    }
@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

but I can't live with this. If my web hotel doesn't allow unbounded time limt, then craft will never work for image assets and image editor.

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

@brandonkelly ☝️

@zizther

This comment has been minimized.

Copy link

@zizther zizther commented Mar 25, 2020

I am having a similar issue where I am unable to view assets in the CP, but fine on the frontend.
The assets are stored on the AWS S3 in my case.

I don't know if it is related or not, but I am not able to update asset indexes either

@angrybrad

This comment has been minimized.

Copy link
Member

@angrybrad angrybrad commented Mar 25, 2020

@jarlah Can you put a phpinfo.php file in your public HTML folder with this as the contents:

<?php phpinfo();

Then load yoursite.com/phpinfo.php in the browser and see if set_time_limit is in the disabled_fuctions output?

@angrybrad angrybrad self-assigned this Mar 25, 2020
@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

I looked in dashboard in /admin/utilities/php-info

disable_functions
pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority

nope :/

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 25, 2020

Screenshot 2020-03-25 at 20 49 18

Not here either

@angrybrad

This comment has been minimized.

Copy link
Member

@angrybrad angrybrad commented Mar 25, 2020

Huh... weird. If you search for 180 on that page (apparently the max you're allowed to run), does it show up anywhere?

While you're there, can you search for "suhosin" and "mod_security", too?

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 26, 2020

no hits for suhosin or mod_security, however I think mod_security is more an apache/htaccess thing.

Screenshot 2020-03-26 at 11 22 51

@zizther

This comment has been minimized.

Copy link

@zizther zizther commented Mar 26, 2020

Same for me set_time_limit is not disabled, nor do i have suhosin or mod_security

@angrybrad

This comment has been minimized.

Copy link
Member

@angrybrad angrybrad commented Mar 26, 2020

@zizther do you have that same "phplimiter" in your phpinfo output? Have never seen that before and Google isn't turning up much. @jarlah Any chance we could get some Craft control panel and SSH access to that box? If so, could you send over to support@craftcms.com?

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 26, 2020

@angrybrad sure :) Its just my blog right now, and I have it source controlled and backed up at all times, so yeah. I can give you access. (and revert it later ;) ) .. just give me some time and i'll whip it up.

@angrybrad

This comment has been minimized.

Copy link
Member

@angrybrad angrybrad commented Mar 26, 2020

@zizther's issue ended up being unrelated to this one

@jarlah

This comment has been minimized.

Copy link
Author

@jarlah jarlah commented Mar 27, 2020

@angrybrad

We've received your support request! (ID: 5108)

@angrybrad

This comment has been minimized.

Copy link
Member

@angrybrad angrybrad commented Apr 3, 2020

For reference: yiisoft/yii2#17948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.