All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Please read about the changes to BoldMinded add-on licensing.

Ticket: Extreme number of records in exp_snaptcha table

Status Resolved
Add-on / Version Snaptcha 3.3.1
Severity
EE Version 7.4.10

Brett P

Jun 12, 2024

Description of the problem While applying updates to the site recently I noticed an extremely large number of records in the ‘exp_snaptcha’ table. That table has over 3.5 million records. There does not seem to be any issues on either the front end or back end, but that number of records bloats the size of the database (300+ MiB). There are no errors in log files. Uninstalling Snaptcha addon removes the ‘exp_snaptcha’ table, but the large number of records being added begins immediately after re-installing. Unfortunately, I cannot say when this first began occurring.

Screen shots of the database table and records (first and last page only), and other installed addons are attached.

EE Pro v7.4.10

Database server Server: db174.pair.com via TCP/IP Server type: MySQL Server connection: SSL is not being used Documentation Server version: 8.0.36 - Source distribution Protocol version: 10 User: swet2_11@209.68.5.46 Server charset: UTF-8 Unicode (utf8mb4)

Web server Apache/2.4.59 Database client version: libmysql - mysqlnd 7.4.33 PHP extension: mysqli Documentation curl Documentation mbstring Documentation PHP version: 7.4.33

How To Reproduce Issue begins immediately after installing addon.

Error Messages None

Screenshots / Videos / Template Code Screen shots of the database table and records (first and last page only), and other installed addons are attached.

Environment Details: Database server Server: db174.pair.com via TCP/IP Server type: MySQL Server connection: SSL is not being used Documentation Server version: 8.0.36 - Source distribution Protocol version: 10 User: swet2_11@209.68.5.46 Server charset: UTF-8 Unicode (utf8mb4)

Web server Apache/2.4.59 Database client version: libmysql - mysqlnd 7.4.33 PHP extension: mysqli Documentation curl Documentation mbstring Documentation PHP version: 7.4.33

Possible Solution ???

Additional context None

#1

BoldMinded (Brian)

How big is your site? How many visitors do you get a month? It sounds like something is polling your site causing it to insert a new row each page load. Do you have a form on every page of the site? You said “but the large number of records being added begins immediately after re-installing” - what sort of time frame and how many rows are inserted in that timeframe?

For the time being your best bet is to just delete the rows manually until I can get a fix in place, but it sounds like something is just hammering your site.

#2

BoldMinded (Brian)

Comment has been marked private.

#3

Brett P

Comment has been marked private.

#4

BoldMinded (Brian)

Yeah there is something weird going on here. I know Snaptcha is installed on larger sites and I haven’t seen similar reports. Two things you can do:

1) have you checked or replicate this in a non-production environment? 2000 monthly visitors isn’t that many, you should be able to run the site locally and navigate the pages for a few minutes and see what it does to the snaptcha table.

2) check your server logs to see if anything is excessively loading pages, which could cause new entries to be entered into the table.

#5

Brett P

The fix of pruning old rows works, but it looks like there are still a lot of records being generated. Currently just under 40,000 records, but the id of the last row is 2906940, suggesting there have been almost 3 million in the past few days… One other issue we are seeing is that form submissions are being blocked for no apparent reason since v3.3.2. This happening on several different forms, some created via Freeform, others not, like these two: https://swet.jp/contact (Freeform) https://swet.jp/members/login (exp:member:login_form) Same thing is still happening when I uninstall v3.3.2 and re-install v3.3.1. Not sure if this was occurring after first upgrading to v3.3.1. I’ve re-installed the previous version we were using, 3.2.2, and the forms are now working correctly.

Unfortunately I’m not able to do too much follow-up like creating an off-line copy of the site and testing there. I’m doing this for a client and they have requested that if troubleshooting this issue is going to take too much time and result in additional costs, they would prefer to simply remove the addon and go back to using the built-in reCaptcha for forms. I will follow up with the server host to see if they have insights on why there are so many hits on the forms.

#6

BoldMinded (Brian)

Can you share more info about your site? What kind of page is the form on? The screenshots show all of the records with the exact same timestamp in the database. There is no loop in the Snaptcha code that could do that, so it seems to me like maybe a single page has multiple instances of the same form and snaptcha field on it?

Can you share a url to where one of these forms appears perhaps?

#7

Brett P

Thanks for following up.

There is one section that shows a list of members, and visitors can contact a member via the form under the member’s profile. https://swet.jp/members/ A form is generated for each member, so yes, on those pages (6 pages) there are multiple forms (40 per page) with Snaptcha fields. I had thought that those forms were only added to the page when the visitor is logged in, but that doesn’t seem to be the case at the moment. So can see how those pages would quickly contribute to the number of records. I guess I could modify those to show a single form, and fill the form contact info via javascript.

Any ideas on why the new versions of the addon would be blocking form submissions though? Best to create a separate ticket for that if we wanted to pursue it further?

Thanks again.

#8

BoldMinded (Brian)

On line 118 of ext.snaptcha.php, change this line:

$this->cleanup($name);

to this and see if it fixes it.

$this->cleanup();
#9

Brett P

I tried your suggestion and changed that line of code, but still saw 3000+ records in a few minutes (the time it took to test a couple of forms). That was after uninstalling v3.2.2 and then installing the modified v3.3.2, but as I mentioned earlier in the thread, with v3.3.1 or v3.3.2 installed, form submissions are failing so I have reverted to the last known working version I have, which is v3.2.2.

#10

BoldMinded (Brian)

What does the actual form tag look like in your template? Have you tried re-creating this issue in a new clean EE environment with just Snaptcha and a form to test with? You said submissions are failing… are submission failing in the clean environment as well? Have you considered refactoring your pages so there aren’t as many forms loaded onto the page at a single time? For example when the user clicks a button the form is loaded into the page via Ajax, that way only forms that someone intends to submit are actually on the page.

#11

BoldMinded (Brian)

I’m going to close this ticket because it seems like an issue on your side. Snaptcha has a couple of cleanup routines to keep that table small enough, and there isn’t much else I can do beyond that.

Login to reply