[wp-trac] [WordPress Trac] #49329: memory_limit in site health is not really correct, value is taken from wp_raise_memory_limit

WordPress Trac noreply at wordpress.org
Fri May 22 08:16:43 UTC 2020


#49329: memory_limit in site health is not really correct, value is taken from
wp_raise_memory_limit
-------------------------------------------------+-------------------------
 Reporter:  espiat                               |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.5
Component:  Site Health                          |     Version:  5.3.2
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing 2nd-opinion needs-     |     Focuses:
  patch                                          |  administration
-------------------------------------------------+-------------------------

Comment (by zodiac1978):

 Replying to [comment:28 mikeschroder]:
 > My gut instinct on this is that it's up to the server admin / syseng to
 make sure that the PHP limit is not set higher than the amount of physical
 RAM.
 >
 > @zodiac1978 Is this an issue that you've seen trending? I'd be
 interested to find out more about the user concerns to see what the best
 way to solve for it would be.

 At the moment WordPress is showing 256M in Health Check because
 `wp_raise_memory_limit` has tried to set 256M. This is not failing on all
 hosters I know (even if just 128M is available on this shared hosting
 environment).

 I disagree with @Clorith on this one:
 > As the memory limit for wp-admin may be important to some plugins (that
 do heavy processing in the admin area, and not the front end), it would
 make sense to show both of the values if they were to differ.

 If we split those values in a frontend value and an admin value, the admin
 value will *always* show 256M, because it is not failing to be set.

 Unfortunately this thought from @SergeyBiryukov is not true:
 > That seems weird though, I don't think ini_set( 'memory_limit', '256M' )
 is supposed to succeed if the value is not really changeable.

 If I look in Site Health and see a "memory_limit" info, then I expect this
 to be the true available limit. In my case it shows 100M and 256M (admin)
 which is both incorrect.

 And as I said above it will show 256M for admin in every case. So what
 information do you gain if you are checking this value in Health Check?
 You just see what WP is *trying* to get.

 I think the solution is to get the value with `ini_get('memory_limit')` as
 early as possible to get not affected from any plugins or WP which are
 trying to set something else and show only this value.

 The only other reliable way to get the real value I know of is to try to
 get the memory and see when it fails. This is of course a risky way, so we
 decided against it:
 https://github.com/WordPress/health-check/issues/50

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49329#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list