Support

Home Forums Event Espresso Premium Can't delete old events

Can't delete old events

Posted: December 29, 2023 at 11:14 am


Larry Hyde

December 29, 2023 at 11:14 am

Our database has become very large (over 2.5GB), so we’re trying to delete old events. It seems that the permanently deleting old events sometimes takes so long that even deleting a single event times out. How can we delete old events when even just one event causes an error? (See attached img)
EE error


Larry Hyde

December 29, 2023 at 11:14 am

https://drive.google.com/file/d/1h7X6J3uwOrIgAc7nwz0dYdClUjZxaI4j/view?usp=sharing


Tony

  • Support Staff

December 29, 2023 at 11:34 am

Hi there,

If you check your server error logs and look at the timestamps for around the time your getting the above error, does it show any errors?

The batch process is there to process 50 rows at a time which should prevent timeouts in most situations, so we’ll need to know the error being thrown on the request to troubleshoot this further.


Larry Hyde

December 29, 2023 at 1:19 pm

There are no errors in the log related to EE. And WPEngine says that they can’t increase the time limit for us. Is there another way we can accomplish this? It seems absurd that this database would be over 2.5GB…we’re going to need to find a way to address this. Thanks.


Tony

  • Support Staff

December 29, 2023 at 3:13 pm

There are no errors in the log related to EE.

So the server throws an error and just doesn’t log anything at all? That doesn’t sound right, PHP timeout errors (if that’s what you are running into) would still show in the error logs.

And WPEngine says that they can’t increase the time limit for us.

Which time limit? I didn’t ask you to increase any time limits?

Is there another way we can accomplish this?

No, using the built-in routines to delete an event ensures that all related is removed and nothing is left orphaned, so this is the the way to delete the data correctly.

It seems absurd that this database would be over 2.5GB…

The more registrations, the more data we need to store, having a 2.5GB database for an e-commerce site (which is what EE is) is relatively small.

we’re going to need to find a way to address this.

We don’t know what the above issue is yet to be able to address it.

Here is what I would do from this point to help troubleshoot.

First, enable WP_DEBUG_LOG using this snippet:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

You add that to your sites wp-config.php and the snippet replaces something like this:

define( 'WP_DEBUG', false );

It tells WordPress to store all errors within /wp-content/debug.log

Then, set yourself up to delete an event but right before you click to delete it open up dev tools on your browser and open the network tab.

Now your browser will log the ajax requests being sent to the server, to give an example, when you get to this point:

https://monosnap.com/file/4Iu7lIdA0BQw0HYmHf988og0f5Rg8F

Open Dev Tools (I’m using Chrome), then network tab:

https://monosnap.com/file/AlVcmTVjXrZObEVypl8pTdfQN5dp8A
(Side note, make sure ‘Preserver log’ is check, its to the right and down a little in my screenshot)

As the job processes, you’ll see multiple Ajax requests:

https://monosnap.com/file/veZZBldrIv0qlUVTBbYrpVglnSNr1R

When the process fails, that ajax may show you more details, click on it and view the headers tab and preview, any additional details there?


Larry Hyde

January 2, 2024 at 9:02 am

After using the “permanently delete” function, we had issues with data missing from events we had NOT deleted, and even had errors when trying to run backups (resulting in backup failure). We eventually had to revert to a backup made prior to the operation. So after wasting a handful of hours, I’m going to abandon this utility for the time being. But the size of our database is sure to become an issue again. We don’t have that many events, and we rarely have more than 200 registrants for an event, so the database size does seem excessive, and will have to be dealt with at some time in the future. We’re running on a very capable platform at WPEngine, so I would suggest there might be issues with the deletion function. It never did complete when working with events that had more than 100 registrations, and apparently caused other DB issues either when completing the function on smaller events–or when timing out on larger events.


Rio

  • Support Staff

January 3, 2024 at 12:02 am

Were you able to do what tony recommended? Do you have the screenshot of error logs and screenshots of the dev tools?

Thanks


Larry Hyde

January 3, 2024 at 6:15 am

There were no errors in the server log when we checked. And after having to restore our site from a backup, we can’t afford to risk using the tool again.


Rio

  • Support Staff

January 3, 2024 at 6:26 pm

Do you have staging site, where we can do this deletion?

If you do, please fill this form https://eventespresso.com/send-login-details/

thanks


Larry Hyde

January 3, 2024 at 7:40 pm

Ironically, we had to delete our Staging instance because of the size of the database. With 2.5GB in files plus a 2.6GB DB…when you double those to add a Staging environment, it exceeds the 10GB storage limit at WP Engine.


Tony

  • Support Staff

January 4, 2024 at 3:36 am

The problem is we need some kind of error to know what is happening, even when PHP hits a timeout it stores an error stating the timeout has been exceeded within the PHP error log, or if the limit is on the web server, the access logs should show ‘something’ (likely a 502).

WPEngine has a 60-second PHP timeout and anything running on the individual delete request(s) should be well and truly finished within that timeframe.

I run multiple different server types for testing (ranging from really cheap shared hosting to my own dedicated server) and the one I prefer testing on the most for issues like this is the cheapest shared hosting option I have (less than $3p/m but I still consider them ‘good’ in the shared hosting platform) simply because if it runs on that it’s likely to run on pretty much anything above it. So on that hosting I’ve just created an event and imported over 2000 registrations onto that event to then delete it without any errors.

My point here is not “it works for me so this is your problem” but rather to show that this isn’t simply a case of EE is deleting too much on a single request and needs to be changed. We already batch process the delete requests and each of those processes above finished within 1-2 seconds for me. If we were pushing the process too far then we’d be looking at being much closer to the timeout waiting for each request to complete, especially on cheap shared hosting.

Now, having said that I was wrong above with the batch size being 50 rows. The default value for batch processes is indeed 50 rows but deleting values from the database is ‘cheap’ and when you have the ID’s of the rows you want to delete (which we do at the time the request is run) is very quick. So we actually increase the batch size for deleting by 10, so 50 * 10 = 500 rows per request (again, the cheap hosting shows that is not very expensive to run on each request). The value is filtered so it is possible to reduce that and test by setting the default batch to say 10, meaning 100 rows per request.

We batch process the delete requests and show a preview of the data we found to be processed before we run them, that preview can actually be more ‘costly’ than the delete requests themselves (meaning if the preview works, the delete should work if it’s a resource issue).

With all that said, I’m more than happy to investigate this further and see if I can track down what is happening. However, to do that I’m going to need access to the site/DB in some form, you needed to delete your staging site due to file size so that’s not an option currently and I’m not running any testing on the live site.

Would you be ok with me installing a copy of the site locally to see if I can reproduce this there?


Larry Hyde

January 4, 2024 at 6:37 am

I really appreciate your thorough response and offer to help. We would obviously still like to address the DB size issue, if possible. In what form can I supply a backup for your local testing?


Larry Hyde

January 4, 2024 at 7:17 am

This reply has been marked as private.


Tony

  • Support Staff

January 4, 2024 at 7:54 am

Ok, so I have imported the DB locally but haven’t set it up as a site yet just had a look over the DB for anything that stood out first.

Event Espresso tables use the prefix esp_

Combine that with the WP table name prefix (often that prefix is just wp_ and the table names end up being something like:

wp_esp_{table-name}

The reason I’m telling you this is looking through your DB, Event Espresso takes up maybe 300MB in total. I haven’t gone through and totalled all of the tables but I organized by table size and esp_message (the table that stores the messages sent by event espresso is the largest at 203.6MB, after that is esp_extra_meta at 26.1MB).

The reason you have such a large database is not due to Event Espresso, the largest table you have is a diagnostic_log table at 1GB, the next is wpml_mails as 921.5MB, so there’s basically 2GB right of the bat in those 2 tables.

wpml_mails I assume is from the WP Mail logging plugin you have on the site?

diagnostic_log uses a different prefix wpml_mails, from the backup itself I have no where that is used.

So, the first question is do you need to store all of the emails sent by the site within WP Mail Logging?

Second, any idea what the other table is for?

https://monosnap.com/file/YvXRHWqyg1LYHLkMVNI5cxtsKVnndB


Tony

  • Support Staff

January 4, 2024 at 3:18 pm

The diagnostic_log table is from the MemberMouse plugin you have installed on the site, that’s logging all PHP errors/warnings/notices to the database on every request.

If there is an option to disable that within the plugin, I recommend doing so, and then clearing out that table.


Larry Hyde

January 4, 2024 at 6:58 pm

I guess that explains why the DB ballooned in size even further after the EE event deletions failed, since the DB size is due to error logs. The biggest irony is that nearly all the server errors are related to MemberMouse–it’s apparently logging itself (and the site) to death.

I’m curious about why the EE event deletion was failing–but it’s not very important to answer that now, since it appears that we won’t need to delete EE events.

I can’t thank you enough for digging into this and providing that helpful info. I have configured both plugins to delete logs older than 90 days, so hopefully we’ll see our database start to shrink. I feel bad for wasting your time with something that ultimately isn’t EE-related (other than the event deletion failing). Let me know how I can buy you a cup of coffee, or otherwise contribute to your cause. I’m grateful for your help. Thank you again!


Rio

  • Support Staff

January 4, 2024 at 7:01 pm

No worries, the tEEm is always here to help you.

have a wonderful day!

thanks


Tony

  • Support Staff

January 8, 2024 at 2:49 am

I guess that explains why the DB ballooned in size even further after the EE event deletions failed, since the DB size is due to error logs. The biggest irony is that nearly all the server errors are related to MemberMouse–it’s apparently logging itself (and the site) to death.

I’m not a fan of plugins that store the PHP notices to display within the admin. They do have their place and can be a useful tool but often they are forgotten about/not known about and do exactly what you are describing. Especially with PHP8 as there is often a bunch of PHP notices/warnings thrown across various plugins now all of those will be stored (there can be many per request). Event Espresso itself also throws deprecated notices with PHP8, we’ve fixed the majority of them in the next version but again those will all have been logged.

I’m curious about why the EE event deletion was failing–but it’s not very important to answer that now, since it appears that we won’t need to delete EE events.

It’s possible the logging was causing the failure (writing a bunch of data to the DB as we loop through the requests will take a LOT longer than the deletion normally takes), although that’s a little bit of a stretch with the way we do the deletes.

I have configured both plugins to delete logs older than 90 days

You haven’t asked for my advice on this, but I’ll give you my recommendation here.

For WP Mail Logging, rotating the logs out every 90 days is fine, there’s a valid reason to log the emails etc.

For the MM Diagnostic log, I’d be looking to disable that logging feature if possible. Writing every PHP Notice/Warning/Error to the DB is just a waste 99% of the time and WP Engine would usually log PHP errors anyway so they’ll be saved in the error logs. Those details are useful, for example, I asked for the error above because it is indeed needed to troubleshoot issues like this. But my take on logging errors is to do so as and when needed… Getting an error when you click on a button? Enable error logging and do it again to save the error, then disable it again and investigate the error from the log. Getting a bunch of notices? Log them for a couple of hours, disable it again and then investigate the notices and work through resolving them (90% of them will be the same thing logged over and over).

The support post ‘Can't delete old events’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso