Closed (fixed)
Project:
Spam
Version:
4.6.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Oct 2005 at 19:39 UTC
Updated:
29 Oct 2007 at 14:51 UTC
I'm not sure even what the spam module thinks it's doing. I'm getting a fresh pair of entries with each cron pass:
trackback 0 2005-10-27 12:33 spam_delete_trackback: deleted trackback "". Anonymous details
trackback 321 2005-10-27 12:33 spam_cron: deleting trackback Anonymous details
However, there *is* no trackback 321. I have no idea where it's getting that number, or why it's stuck. Trackback #0 is of course complete nonsense. There is no further useful information in the details.
Comments
Comment #1
Zed Pobre commentedFound the source of the problem: I apparently have invalid entries in the spam_tracker table. There are 6 entries where id = 0 (all where source = 'list' and probability = 1 and all have the same hash). I've dropped those entries and will be checking back to see if the problem goes away.
This means that spam.module needs to have a sanity check in spam_cron() to make sure that results from the spam_tracker query actually exist in their respective tables, and if not, to clear the spam_tracker entry without going on to attempt to delete a nonexistent comment/trackback.
Comment #2
Zed Pobre commentedTo be complete, I also cleared the line with id = 321.
Comment #3
Zed Pobre commentedA few cron passes have gone by now, and the errors have disappeared. Those entries appear to have been the problem.
Comment #4
jeremy commentedIs that a typo that the source was 'list'? Did you mean to type 'trackback'?
Your suggested solution is easier said than done. What was showing up in the spam log? If it gets as far as spam_delete_trackback(), the spam_tracker entry should be automatically removed.
Comment #5
jeremy commentedIf I add an entry of type 'list', I get the following expected error when trying to run cron:
If I add a bogus entry of type 'trackback' (either with a positive id, or an id of 0) the bogus entry is quietly deleted when cron runs. The following logs show up in the spam log, and the entry is deleted from the spam_tracker table:
Comment #6
Zed Pobre commentedWell, I'm not sure how the entries got in there originally (though I do have a vague memory of having tampered with spam.module and lists some time ago), but they definitely weren't being removed. Those lines I posted at the start appeared in the logs at every single cron pass. I suspect that the trackback discrepancy may have come from my having deleted a trackback_received entry by hand (via psql) at one point, though I couldn't tell you for sure. Possibly it was a trackback that I deleted from inside Drupal during a time when I had spam.module disabled.
Comment #7
jeremy commentedBased on my own testing, I suspect it is either a problem you introduced in your earlier tweaking (I'm not sure what 'lists' you're referring to), or it is a problem specific to PostgreSQL. I am unable to duplicate it on my development server.
I'll leave this open for a couple of weeks, let me know if you have the problem again.
Comment #8
Zed Pobre commentedEh, well, now that I've dumped the corrupt entries, I'm pretty sure it *won't* happen again. I still think a sanity check on the spam_tracker table is a good idea, but it's obviously not a high priority. Changing priority to minor with this.
Comment #9
jeremy commentedI disagree. I don't see any need. In all my testing, the only way I could break something was by adding an entry to spam_tracker of a non-existent type. This will never happen unless someone is manually adding entries, in which case there are many other ways things can break, too.
Another thing is that the spam_tracker table isn't just used by the spam module. It's also used by third party modules via the Spam API.
If bad entries are getting into the spam_tracker table, that's a bug that should be fixed. I will leave this issue open for now as I'm interested in hearing if anyone else has run into a similar problem with the latest code.
Comment #10
Zed Pobre commentedI'm pretty sure I know how this is happening now. It happens when someone (so far, always a spammer) sends a trackback with a site, name, subject, url, or excerpt longer than the database constraints allow. The spam_tracker insert goes through fine, but then the trackback_received insert fails, leaving a spam_tracker entry pointing to a nonexistent trackback_received entry.
I *suspect* that this is a Postgresql-specific problem, and that MySQL is silently truncating the data to fit in the field. I haven't tested it with a MySQL system to be sure.
I created a view to track the problem more precisely with:
In MySQL, you'll probably have to perform the select fresh each time, adding a search for where trid is null, as I don't think it supports views. In Postgres, that shows the pattern of holes quite nicely. I'm up to over 10,000 holes now, not counting the ones I've manually deleted, just from the last four or so months.
I still think that a check at the delete stage for this problem (so that spam_tracker entries not associated with trackback_received entries can simply be automatically deleted) would be a good sanity check to have, because this is immensely hard and time consuming to fix with PostgreSQL 7.x. (8.x added a proprietary extension USING to the DELETE syntax which I could use combined with a view to take care of it periodically, but alas, I cannot upgrade at this time.)
Comment #11
jeremy commentedNo updates for a very long time. Marking as fixed as I assume it's no longer a problem.
The spam api will be much improved in the upcoming 5.x-2.x version of the module.
Comment #12
(not verified) commented