I noticed our key_value_expirable table growing and growing. The vast majority of entries were honeypot_time_restriction with an "expire" of "2147483647" the column default.
In honeypot.module, shouldn't the calls to
\Drupal::service('keyvalue.expirable')->get('honeypot_time_restriction')->set($identifier, REQUEST_TIME, 3600*24)
be
\Drupal::service('keyvalue.expirable')->get('honeypot_time_restriction')->setWithExpire($identifier, REQUEST_TIME, 3600*24)
??
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 2931611-12-honeypot-keyvalueexpire.patch | 1.4 KB | geerlingguy |
| #2 | 2931611-honeypot-keyvalueexpire.patch | 1.34 KB | krlucas |
Comments
Comment #2
krlucas commentedHere's a starting patch
...without tests nor any update hook to clean up the existing entries.
Comment #3
j.b commentedHello, this issue causes our database to keep growing in size considerably.
Comment #4
geerlingguy commentedLink to the docs for setWithExpire. This looks like a bit of an oversight when I converted the code from D7!
Comment #5
geerlingguy commentedComment #6
geerlingguy commentedJust noting for myself that the default value for
honeypot_expirein D7 was 300 seconds. The patch in #2 sets the expiry for one day... any thoughts on what the best sane default would be? 5 minutes is probably pretty short and many (most) sites don't even run cron every 5 minutes, so the keys wouldn't be expired then anyways...Comment #7
darkstartom commentedI'm having the same problem. Is it safe to manually remove the honeypot_time_restriction rows from the key_value_expire table?
Comment #8
nitnac23 commentedI have been emptying the key_value_expire table manually once a month to get rid of this issue. @DarkstarTom it is fine to empty the table it stores private and shared temp store. For example, you may lose unsaved changes to a view or form.
Comment #9
geerlingguy commentedIdeally I'd like a test added. Additionally, an update hook that clears out any existing entries, maybe?
Comment #10
nick_vhWe faced this issue with more than 3 million rows. Clearing the rows caused the database to completely fail and needed a reboot. I agree a update hook is required before this can go in. But that said, any new installs using this module are exposed to this bug. Therefor I suggest you get this in the dev version and work on 2 new issues, 1 is a test + 1 is a update hook.
Comment #11
j.b commentedI had 12 million of entries related to honeypot_time_restriction in my database and my website has been online for 1.5 years.
I had to put in place a batch process which gets executed at night for a total duration of 5 hours to clean up my database gradually over a period of 1 week.
Comment #12
geerlingguy commentedMakes sense; let's stop the bleeding, and then I'll open a follow-up ticket to add the update hook.
Comment #13
geerlingguy commentedHad to update the patch.
Comment #15
geerlingguy commentedComment #16
geerlingguy commentedCreated follow-up: #2997609: Provide ways to clean up old honeypot_time_restriction values.