Problem/Motivation

For Drupal web services returning an empty page body with HTTP headers, a PHP warning is triggered on every request: Warning: gzinflate(): data error in drupal_serve_page_from_cache() (line 1637 of includes/bootstrap.inc).

Proposed resolution

The body is only gzipped in drupal_page_set_cache() if it is not empty, so do not attempt to gunzip the cache body when the body is empty.

Remaining tasks

The patch needs review(s).

User interface changes

No UI change.

API changes

No API change; this is only a bug fix.

Data model changes

No data model changes.

Comments

mfb’s picture

Issue summary: View changes
StatusFileSize
new566 bytes

Ignore this patch - I don't think there is any reason to use strlen() because the corresponding code in drupal_page_set_cache() just checks if the body evaluates to TRUE.

mfb’s picture

This bug is triggered by lines in common.inc which don't compress the body or set the cache if it evaluates to empty:

    if ($cache->data['body']) {
      if ($page_compressed) {
        $cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP);
      }
      cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire);
    }
mfb’s picture

Title: Warning: gzinflate(): data error in drupal_serve_page_from_cache() (line 1363 of includes/bootstrap.inc) » Warning: gzinflate(): data error in drupal_serve_page_from_cache() (line 1617 of /includes/bootstrap.inc).
Issue summary: View changes
lazysoundsystem’s picture

StatusFileSize
new685 bytes

I also ran into this - thanks for the patch.

This variation tidies it up a bit by defining $page_compression in one place, at the top of the function.

james.williams’s picture

This fixed the issue for me, thanks!

sokru’s picture

Had the same issue and patch in #4 fixed the issue. RTBC in my opinion.

mfb’s picture

StatusFileSize
new1.51 KB

Here's a failing test without the patch.

Status: Needs review » Needs work

The last submitted patch, 7: 2112325-gzinflate-data-error-7-test-only.patch, failed testing. View results

mfb’s picture

Status: Needs work » Needs review
StatusFileSize
new2.17 KB

And here's lazysoundsystem's patch from #4 plus the test from #7

bobburns’s picture

How long before this gets committed to core ?? I have put on this patch four times - every times a new version of Drupal 7 is released

mfb’s picture

@bobburns if it's working for you, can you set it to "reviewed & tested by the community"?

sokru’s picture

Status: Needs review » Reviewed & tested by the community
ponies’s picture

Works for me!

@bobburns Check out Drush patch files. https://chromatichq.com/blog/how-manage-your-drupal-patches-drush-patch-...

bobburns’s picture

" ponies: ponies commented 12 days ago
Works for me!

@bobburns Check out Drush patch files. https://chromatichq.com/blog/how-manage-your-drupal-patches-drush-patch-..."

That's great - but I cannot count how many parts of me is scared of that.

In CORE modules - code gets changed sometimes and the patch will not find where it needs to go

In CONTRIB modules - I simply " ; " out the " project " in the info file so it won't check and update.

The problem is GETTING someone to commit a working patch to CORE - and often the owner of the modules's solution changes code that the patch cannot work in and then I will NEVER find the piece of spaghetti that took down the whole site.

I will stick with copying the file to a file_save - changing the original file and if it does not work - I have copies to immediately go back to and I can know immediately if the site goes down and that I am the one who did it - and what I did.

bobburns’s picture

Can someone get this committed to core . . . I patched 7.67 and it still works fine after the patch . . . I have a directory of persistently neglected patches I have to apply each time core is updated

anrikun’s picture

+1

wylbur’s picture

Wow, another very old resolved issue that is still not added back to Drupal 7.

How do we get this patch applied to the next version of Drupal 7?

anrikun’s picture

Who knows, @Wylbur.
It's been a mystery to me too.
drush patch file is my friend now.

The last submitted patch, 7: 2112325-gzinflate-data-error-7-test-only.patch, failed testing. View results

mfb’s picture

Issue summary: View changes

Update line number for the warning

mcdruid’s picture

Issue tags: +Pending Drupal 7 commit

LGTM, thanks!

fabianx’s picture

RTBC + 1, let's get this in.

fabianx’s picture

Assigned: Unassigned » mcdruid

  • mcdruid committed 6c6045d on 7.x
    Issue #2112325 by mfb, lazysoundsystem: Warning: gzinflate(): data error...
mcdruid’s picture

Assigned: mcdruid » Unassigned
Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.