Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31268 closed defect (bug) (invalid)

WP_Query die without notice on large result

Reported by: alimuzzamanalim's profile alimuzzamanalim Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Query Keywords: close
Focuses: performance Cc:


My theme is trying to get all of the post in custom post type by WP_Query.
There are about 1400 post. But wp die without showing any error or notice. I have found nothing in error log. I spent a lots of time where is the problem. After applying a lots of trick I have found the theme is trying to get all post. Maybe wp can't handle the query. My post table is 17.7 MiB (33,332 rows) and postmeta table is 157.3 MiB (220,930 rows).

Change History (5)

#1 @dd32
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Long story short: Enable WP_DEBUG and you'll probably find PHP is running out of memory with a Fatal error.

WordPress can't really do anything to protect against that case, and themes/plugins should re-consider the need to query everything, or instead retrieve it in chunks for processing.

See also #19866 for discussion over retrieving only certain fields (which we're not going to support).

You can get help for plugin/theme questions through the support forums where others can help you with the problem (Since Trac is for a WordPress core bug only)

#2 @alimuzzamanalim
9 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I was enabled the WP_DEBUG but not getting any error. This is why I was posted here. It's die without error.

#3 @SergeyBiryukov
9 years ago

  • Keywords close added
  • Milestone set to Awaiting Review

This still seems to be an edge case and a problem with a particular environment.

~180 MB is a lot of data to query at once.

#4 @alimuzzamanalim
9 years ago

The shutdown event is occuring because I found <!-- Performance optimized by W3 Total Cache. at the bottom when use that plugin.

#5 @wonderboymusic
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

W3 Total Cache uses a DB drop-in, I would visit their support forums to report the issue. Thanks for the report.

Note: See TracTickets for help on using tickets.