Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#47789 new defect (bug)

NGINX: Request for media-view.js leads to "zero size buf in writer"

Reported by: dsturm's profile d.sturm Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Script Loader Keywords:
Focuses: Cc:

Description

I do currently have an issue loading the media-view.js file in backend, which leads to multiple js errors on pages or media grid. Checking the logs show an "zero size buf in writer" error for these requests.

The error occurs even on deactivated plugins and default theme. So I tried to debug this down.

I am running multiple WordPress sites locally over NGINX (laravel) in development mode, where SCRIPT_DEBUG is true; so it tries to load the unminidfied version of the file. Replacing it´s content with the minified version solves the bug.

I do currently not know, what causes the empty buffer.

Change History (5)

#1 in reply to: ↑ description @d.sturm
5 years ago

To temporary fix this bug, you could add this filter to force the minified version.

<?php
add_filter(
    'script_loader_src',
    function ($src, $handle) {
        if (false !== stripos($handle, 'media-views')) {
            $src = str_replace('media-views.js', 'media-views.min.js', $src);
        }
        return $src;
    },
    10,
    2
);

#2 @mukesh27
5 years ago

Hi @dsturm,

Welcome to WordPress Trac! Thanks for the ticket.

Both full and min version of JS located at: /wp-includes/js/

Can you please clear your NGINX server cache and check it again?

Last edited 5 years ago by mukesh27 (previous) (diff)

#3 @mukesh27
5 years ago

  • Component changed from Media to Script Loader
  • Version 5.2.2 deleted

#4 @d.sturm
5 years ago

Hi @mukesh27,

yes, both are located there. And both return a 200 status code. But as long as I don't force the minified version I get multiple js errors. Cache was purged multiple times. This error occurs also on other servers, so I don't think it's a local misconfig.

https://imgur.com/kOwR8gZ
https://imgur.com/PTcYrkT

Cheers

#5 @mensch
5 years ago

Searching for this bug in Valet's issue trackers returns this report and it in turn references a bug present in nginx 1.17.2, which is the version installed by Valet. There's a patch for nginx available, but I don't think it has been merged yet.

As the error occurs with other large scripts, not only media-view.js, a temporary solution might be to turn gzip off for the moment in /usr/local/etc/nginx/nginx.conf, as per the Valet issue report.

Last edited 5 years ago by mensch (previous) (diff)
Note: See TracTickets for help on using tickets.