<p>Okay so the site hasn't gone down in 2 days, so fingers crossed that we actually fixed this. </p>

<p>Following Brad's initial comment, we noticed that the <code>schemaVersion</code> key was missing from that plugin's class file. We went ahead and added one:</p>

<pre><code>/* this was there */
public function getVersion()
{
  return '1.0.0';
}

/* We went ahead and added this */
public function getSchemaVersion()
{
  return '1.0.0';
}
</code></pre>

<p>And now since the schema version === the current version, it no longer throws errors.</p>

CC BY-SA 4.0
2018-08-08T21:13:09.257Z
2019-04-18T15:10:28.053Z
2019-04-18T15:10:28.053Z
Rob Erskine
<p>Our application seems to be crashing periodically, on a seemingly unknown cadence. Sometimes it goes down once every few days, and sometimes (like today, when I'm at the end of my rope) it goes down 30 times a day or so. </p>

<p>When hitting the site on the frontend, the user gets a message saying that the site is unavailable; the maintenance mode error message. When we visit the admin panel, we are prompted to update two of our plugins, <a href="https://github.com/lukeholder/craft-geo" rel="nofollow noreferrer">Geo</a> and <a href="https://github.com/A-P/Embedder" rel="nofollow noreferrer">Embedder</a>. After performing the updates the site comes back online.</p>

<p>In the craft logs before the site goes down, we're hit with a bunch of 404 errors:</p>

<pre><code>Level       error
Category    exception.Craft\HttpException.404
Message     Craft\HttpException in /var/www/vhosts/production/craft/app/controllers/TemplatesController.php:72
</code></pre>

<p><em>these range from requests trying to hit /wp-admin and other random pages</em></p>

<p>Then it looks like the site goes down, because then we get hit with 503s:</p>

<pre><code>Level       error
Category    exception.Craft\HttpException.503
Message     Craft\HttpException in /var/www/vhosts/production/craft/app/etc/web/WebApp.php:971
</code></pre>

<p>When we hit /admin, the logs show the following:</p>

<pre><code>******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Preparing to update embedder.
2018/06/02 20:52:43 [info] [application] [Forced] Finished preparing to update embedder.

******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Starting to update the database.
2018/06/02 20:52:43 [info] [application] [Forced] The plugin "Embedder" wants to update the database.
2018/06/02 20:52:43 [info] [application] [Forced] Running migrations...
2018/06/02 20:52:43 [info] [application] [Forced] No new migration(s) found for the plugin Embedder. Your system is up-to-date.
2018/06/02 20:52:43 [info] [application] [Forced] Taking the site out of maintenance mode.
2018/06/02 20:52:43 [info] [application] [Forced] The plugin "Embedder" is done updating the database.

******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Starting to clean up after the update.
2018/06/02 20:52:43 [info] [application] [Forced] Clearing the update cache.
2018/06/02 20:52:43 [info] [application] [Forced] Flushing update info from cache.
2018/06/02 20:52:43 [info] [application] [Forced] Finished Updater.
2018/06/02 20:52:43 [info] [application] [Forced] Finished cleaning up after the update.
</code></pre>

<p>Now I don't think this is related to those two plugins; I think either Craft is getting out of sync somehow, or something is up with our cloud database. </p>

<p>Has anyone run into this issue before? What would be forcing the plugin migrations to initiate again and again, to make updates to the same database?</p>

CC BY-SA 4.0
2018-06-04T22:30:20.017Z
Weird... the only time Craft will prompt to update a plugin is if the plugin's $schemaMigration value in the main plugin class file is higher than the schema version for that plugin in the plugins table in the database. Maybe some weird deployment or opcache issue on the server?
Brad Bell
CC BY-SA 4.0
2018-06-05T00:45:22.683Z
Thanks Brad. I'll take another look. The site is behind a load balancer with only one server on it; we think the error might be there. We just enabled logging on the LB (d'oh!) and will report back next time it goes down.
Rob Erskine
CC BY-SA 4.0
2018-06-05T01:25:07.303Z
Site hasn't gone down yet.. but been doing a bunch of digging. Neither Geo nor Embedder have a schema version (default NULL) associated with them. 

- https://github.com/lukeholder/craft-geo
 - https://github.com/A-P/Embedder

Would a > value of null always throw a false?
Rob Erskine
CC BY-SA 4.0
2018-06-18T10:53:09.517Z
I had the same issue with the Donkeytails plugin, which didn't require any migrations to be run.
Diederik
CC BY-SA 4.0
2018-06-21T08:28:14.073Z
It happened again. :-) Using Craft 2.6.3017 by the way.
Diederik
<plugins><performance><migration>
Craft periodically goes down due to plugin migrations
# Craft periodically goes down due to plugin migrations

(Asked by: username_0 on 2018-06-02)

Our application seems to be crashing periodically, on a seemingly unknown cadence. Sometimes it goes down once every few days, and sometimes (like today, when I'm at the end of my rope) it goes down 30 times a day or so. 
When hitting the site on the frontend, the user gets a message saying that the site is unavailable; the maintenance mode error message. When we visit the admin panel, we are prompted to update two of our plugins, Geo and Embedder. After performing the updates the site comes back online.
In the craft logs before the site goes down, we're hit with a bunch of 404 errors:
Level       error
Category    exception.Craft\HttpException.404
Message     Craft\HttpException in /var/www/vhosts/production/craft/app/controllers/TemplatesController.php:72

these range from requests trying to hit /wp-admin and other random pages
Then it looks like the site goes down, because then we get hit with 503s:
Level       error
Category    exception.Craft\HttpException.503
Message     Craft\HttpException in /var/www/vhosts/production/craft/app/etc/web/WebApp.php:971

When we hit /admin, the logs show the following:
******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Preparing to update embedder.
2018/06/02 20:52:43 [info] [application] [Forced] Finished preparing to update embedder.

******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Starting to update the database.
2018/06/02 20:52:43 [info] [application] [Forced] The plugin "Embedder" wants to update the database.
2018/06/02 20:52:43 [info] [application] [Forced] Running migrations...
2018/06/02 20:52:43 [info] [application] [Forced] No new migration(s) found for the plugin Embedder. Your system is up-to-date.
2018/06/02 20:52:43 [info] [application] [Forced] Taking the site out of maintenance mode.
2018/06/02 20:52:43 [info] [application] [Forced] The plugin "Embedder" is done updating the database.

******************************************************************************************************
2018/06/02 20:52:43 [info] [application] [Forced] Starting to clean up after the update.
2018/06/02 20:52:43 [info] [application] [Forced] Clearing the update cache.
2018/06/02 20:52:43 [info] [application] [Forced] Flushing update info from cache.
2018/06/02 20:52:43 [info] [application] [Forced] Finished Updater.
2018/06/02 20:52:43 [info] [application] [Forced] Finished cleaning up after the update.

Now I don't think this is related to those two plugins; I think either Craft is getting out of sync somehow, or something is up with our cloud database. 
Has anyone run into this issue before? What would be forcing the plugin migrations to initiate again and again, to make updates to the same database?

**Tags:** plugins, performance, migration

> **Comments:**
> **username_1**: Weird... the only time Craft will prompt to update a plugin is if the plugin's $schemaMigration value in the main plugin class file is higher than the schema version for that plugin in the plugins table in the database. Maybe some weird deployment or opcache issue on the server?  
> **username_0**: Thanks Brad. I'll take another look. The site is behind a load balancer with only one server on it; we think the error might be there. We just enabled logging on the LB (d'oh!) and will report back next time it goes down.  
> **username_0**: Site hasn't gone down yet.. but been doing a bunch of digging. Neither Geo nor Embedder have a schema version (default NULL) associated with them.   - https://github.com/lukeholder/craft-geo  - https://github.com/A-P/Embedder  Would a > value of null always throw a false?  
> **username_2**: I had the same issue with the Donkeytails plugin, which didn't require any migrations to be run.  
> **username_2**: It happened again. :-) Using Craft 2.6.3017 by the way.  

---

## 1 answers

### Answer by username_0 on 2018-08-08. Score: 1

Okay so the site hasn't gone down in 2 days, so fingers crossed that we actually fixed this. 
Following Brad's initial comment, we noticed that the schemaVersion key was missing from that plugin's class file. We went ahead and added one:
/* this was there */
public function getVersion()
{
  return '1.0.0';
}

/* We went ahead and added this */
public function getSchemaVersion()
{
  return '1.0.0';
}

And now since the schema version === the current version, it no longer throws errors.


---

