• Resolved BERJAYAnosilver4u

    (@nosilver4u)


    Hi,

    I was working on something yesterday on a site with QM installed, and kept getting 502 errors from my site. After a lot of investigation with my web host, it was determined that it was a memory error, and I believe we’ve narrowed it down to QM and Types (Toolset). My suspicion is that because Types is throwing a bunch of PHP deprecations, QM is using up too much memory in storing the debugging info and exhausts the available memory.

    Otherwise, the site has a 512MB memory limit, and normally uses around 50-60MB (per QM’s stats). But when attempting to submit settings changes, activate plugins, purge caches, any sort of “action” request, then I get the memory issues.

    I believe there are a couple other plugins that have PHP deprecations also (running on PHP 8.4), so perhaps it is a cumulative effect, but I’m not certain.

    Any ideas on how to narrow this down further, or make it so QM doesn’t suck up all the memory?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author BERJAYAJohn Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yeah a large number of PHP errors can eat up memory due to the size of the stack trace that’s collected alongside each one. Query Monitor version 4 reduces that memory usage considerably, but it’s still potentially unbounded.

    The nuclear option is to disable error handling in QM completely:

    define( 'QM_DISABLE_ERROR_HANDLER', true );

    Not ideal, but it’ll allow you to use all the other panels in QM.

    Short of changing the way QM transiently stores the data that it collects, there’s not really anything I can do about this. Any attempt to put a limit on the number of queries or errors that QM collects immediately makes it less useful when you inevitably need to see that information.

    QM also allows you to hide errors from certain plugins or themes, but this doesn’t stop the data being collected, it just prevents the admin toolbar from showing a coloured notification. Perhaps I need to introduce a new option for completely bypassing the collection of errors from certain plugins and themes.

    Thread Starter BERJAYAnosilver4u

    (@nosilver4u)

    Hmm, while that isn’t ideal, it might help narrow things down. Besides error reporting, it’s entirely possible the issues are related to db queries or something else that is happening on those requests.

    I’ll try it out and see if the issue is indeed from the error handler, or somewhere else. Thanks!

    Thread Starter BERJAYAnosilver4u

    (@nosilver4u)

    Well, I remembered an issue I had way back on my staging site that I strongly suspect could be related. It had to do with Query Monitor sending data via response headers–because naturally you can’t pollute an admin-ajax.php response or various POST requests in the wp-admin.

    Anyway, I had the error replicated, then put in that constant, and it went away. I removed the constant, and now I can’t get the issue to come back…

    Well, anyway, here’s what I remember from when it happened on my staging site. I was having a similar issue, I think it was also causing 502 errors. There was some fix related to increasing the fastcgi_buffers and fastcgi_buffer_size settings. My staging site is on a different server setup, but now I can’t seem to replicate it there either.

    Either way, I don’t think those settings can be changed on WPE, so I wonder if there’s any way to detect such a situation and limit the amount of data returned in the admin-ajax.php headers?

    Not a huge issue, if I can just remember it for next time the issue crops up, but if you have any ideas, that’d be great.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.