Robot with hands in his hair, panicking. [Made by DALL-E]

Latest OMGF (Pro) update causing Internal Server (500) errors? Here’s how to fix it.

About 2 weeks ago, I’ve released OMGF 5.6.0 and OMGF Pro 3.8.0. These releases seem to have caused errors on some servers. In this post I want to inform you about possible causes and, more importantly, how to prevent these errors so your site can keep running smoothly.

Is it a bug?

Let’s begin with the elephant in the room: is it a bug? No.

Is it something that could’ve used a bit more preparation had I known about it? Yes.

OMGF 5.6.0 and OMGF Pro 3.8.0 include major performance improvements in code execution and database read/write behavior. I’m not going to bore you with the details, but basically, the whole framework both plugins are built upon has been rewritten.

So, what’s causing the 500 error?

Since PHP isn’t a runtime language, running “new” code shouldn’t be a problem in most cases. However, in the last two weeks users have reported experiencing 500 errors when using:

  • Server caching mechanisms, e.g. Memcached or Opcache, and/or
  • WordPress’ Automatic Updates feature.

Let’s dig into each one and fix this, shall we?

Cause #1: Stale Server Cache

First and foremost, server caching mechanisms like Opcache or Memcached seem to generate 500 errors after updating OMGF and/or OMGF Pro. Or, more specifically, stale server cache.

You know that OMGF Pro is an add-on that requires OMGF to be installed. And, what’s unfortunate, is that WordPress’ update API is a bit clunky — which I’ve learned now and trust me, I won’t make the same mistake again. I promise.

I say clunky for two reasons:

  1. It doesn’t run updates in batches, even when you select multiple plugins to update at once. It runs the update process for each plugin separately. Which isn’t so bad, if it wasn’t for the fact that…
  2. It loads the entire WordPress instance (including all plugins) when updating said plugins.

Why does that collide with a server caching mechanism like Opcache or Memcached, you ask? Great question!

These caches cache PHP files in the server’s memory, to ensure much faster execution. Which is awesome, but here’s what happens once you selected OMGF and OMGF Pro to be updated to their latest versions:

  • The cache still consists of the files included in OMGF v5.5.6 (or older) and OMGF Pro v3.7.6 (or older)
  • WordPress calls the Update API to update OMGF to v5.6.0
  • OMGF has finished updating. So, the files have changed.
  • The cache is smart and thinks: Hey! That plugin appears to be updated, I’m refreshing the cache for OMGF to v5.6.0.
    • At this point, OMGF v5.6.0 and OMGF Pro v3.7.6 are cached in the memory of the server. So far, that shouldn’t be a problem. But then…
  • WordPress calls the Update API to update OMGF Pro to 3.8.0 — and loads the entire WordPress instance and all of its plugins from the server cache.
  • While updating OMGF Pro to 3.8.0, OMGF Pro is 3.7.6 is executed, which is trying to call classes and methods from OMGF v5.5.6 — which no longer exists! And…
Digital art of a server exploding.
BOOM! The server explodes. [Source: Dall-E]

Well, not really. But you get the point.

Other CMS’ have their update mechanism running separated from WordPress, e.g. by using Composer. There are even Composer-managed versions of WordPress. But, ofcourse, only a handful of hosting providers run these services. Most rely on WordPress’ own Update API, which makes perfect sense.

The Solution

If you’ve already installed the update, and you’re experiencing errors, there’s only 1 thing you can do: disable the plugins manually by heading into your server through e.g. FTP or SSH and renaming the plugin folders. Then install the update for OMGF Pro manually after updating OMGF.

If you haven’t installed the update yet, you can simply prevent this by flushing your server’s cache before installing the updates.

Cause #2: WordPress’ Automatic Updates feature

Another reason why the most recent update of OMGF and OMGF Pro might cause a 500 error, is due to WordPress’ automatic update feature.

OMGF Pro blocks its own updates, if it sees that an update for OMGF is available. This has worked fine — until recent versions of WordPress.

At the moment, when Automatic Updates are enabled, OMGF Pro’s roadblock is ignored and its updated before OMGF is updated. Which should never happen.

The Solution

If the Automatic Updates feature has already installed the update for OMGF Pro, the update of OMGF should still be able to install from the Plugins screen. If not, you can go one of two ways:

  1. Disable OMGF Pro manually, by heading into your server using FTP or SSH, then rename its folder, refresh WP’s Plugins overview and install the update for OMGF, or,
  2. Disable OMGF Pro manually, and install the update for OMGF manually.

Can this happen again in the future?

This update has been a great learning experience for me and I’ve been thinking of ways to prevent this in the future.

The next release of OMGF Pro will have, what I came to call: safety wrappers. These wrapper methods explicitly check OMGF’s current status before attempting to access its code.

This will make sure that when e.g. Opcache is serving stale cache, OMGF Pro will just silently stop working until the required version of OMGF is available again.

Besides that, I’m still looking into ways to block Automatic Updates until OMGF is running at its latest version.

To Summarize

First off, allow me to apologize to everyone that has experienced this error. Your server exploding due to something as little as a plugin update sucks. Nothing more, nothing less.

Although it’s not entirely my fault, I definitely learned a great deal about quirks in WordPress’ Updates API and its Automatic Updates feature.

I have implemented failsafes to make sure these errors won’t happen again in the future.

But, before I leave you, I want to address an urgent matter to those of you using any type of caching:

Always flush your cache before installing updates!

Wishing you an excellent day!

❤️ it? Share it!

10 thoughts on “Latest OMGF (Pro) update causing Internal Server (500) errors? Here’s how to fix it.”

  1. Hi,
    With this serious update problem that I am sure affects other plugins that use a core and pro plugin as separate plugins could you perhaps add a MU plugin that uses a WP hook to detect when updates are being installed or checked and does a full clear of the object cache system? Different hosts having different implementations of Redis could cause this to be difficult.
    Failing that there are 2 main plugins for Redis caching – a free plugin and Redis pro for Object Cache Pro which a number of hosts are now using also.
    Could you talk to that plugin dev to include an automatic cache clearance when plugins are being updated?
    Thanks for your work.
    Dale.

    1. Hi Dale,

      Thanks for your suggestion!

      Object (database) caching isn’t the problem here. File (code) caching is.

      Besides, there’s a WP plugin for all PHP caches out there: memcached, opcache, varnish, etc. But I don’t see it as my responsibility to make sure these caches are flushed, when a plugin is updated. These plugins already take care of that.

      The safety wrappers that I’ve implemented will make sure nothing crashes might I ever implement another drastic code change such as this one in the future. So, lessons learned and moving on 🙂

  2. Hi Daan, what shall I do when I have manually update to 5.6.0/3.8.0 bu not facing issues? Thanks

  3. Hi,

    thanks for your Work! On one of five websites i had the 500 Error but easly fixit.
    Again, thanks for your work an keep on coding.

    Michel

    1. 20%! That seems to be the average number of users using Opcache, or a similar PHP cache, like Cloudflare APO or Varnish. Or, at least, that’s the number I’m currently on 🙂

      Thanks for stopping by!

  4. Stefanie Seitz

    Hi, I would have appreciated some information for the paying customers of OMGF Pro by mail. With some difficulty, I have found out where the 500 errors came from. The loss of ranking and traffic has already happened because the blog articles are no longer indexed by Google due to the critical error. It is a lot of work to re-index the blog articles manually. As I said, I would have liked to have known about the problem earlier without having to go on error hunt myself.

    1. Had I known this would happen, I would’ve informed you beforehand. During my tests (and I tested a lot) this didn’t come thru. Then again, my testing environment doesn’t use PHP cache, for obvious reasons.

      1. Just found this thanks for the info.
        Heres some extra info from our experience
        We have had this problem for the last 3 weeks knocking off our Google Ads campaigns as a policy breach = destination unknown.

        Hosting is WP-ENGINE using Advanced Network and CloudFlare.

        After identifying OMGF + Pro one way or the other was causing the errors i have deactivated the plugins and our ads have been resurrected after re-submitting for approval.

        Can you notify us if and when there is a stable version and if a simple delete and fresh install of OMGF + pro is available.

        Keep up the good work
        Bedankt

        1. Please make sure both plugins are at their latest version, current version for OMGF is 5.6.1 and OMGF Pro is 3.8.2.

          If the issue is something else, besides the 500 error, please contact me and provide me with a site URL.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Shopping Cart
  • Your cart is empty.