Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

#12276 closed defect (fixed)

IntegrityError: duplicate key value violates unique constraint "spamfilter_bayes_pkey"

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version:
Severity: normal Keywords:
Cc: Dirk Stöcker Branch:
Release Notes:

Prevent multiple form submits for submit buttons on Spam Filtering: Monitoring page.

API Changes:
Internal Changes:

Description

Saw an IntegrityError today when deleting spam > 90%. I guess it could probably be solved by preventing multiple submits, as in #12263.

2015-12-14 01:09:08,463 Trac[filtersystem] WARNING: Training <tracspamfilter.filters.bayes.BayesianFilterStrategy object at 0x8152f12c> took 12 seconds to complete.
2015-12-14 01:09:18,154 Trac[bayes] WARNING: Reset SPAM count from 30692 to 30693 due to keyword 'x-mailer:none'.
2015-12-14 01:09:19,728 Trac[filtersystem] WARNING: Training <tracspamfilter.filters.bayes.BayesianFilterStrategy object at 0x8152f12c> took 8 seconds to complete.
2015-12-14 01:09:30,726 Trac[filtersystem] WARNING: Training <tracspamfilter.filters.bayes.BayesianFilterStrategy object at 0x8152f12c> took 7 seconds to complete.
2015-12-14 01:09:49,966 Trac[stopforumspam] WARNING: StopForumSpam request failed (HTTP Error 503: Service Unavailable)
2015-12-14 01:09:54,230 Trac[stopforumspam] WARNING: StopForumSpam request faile
d (HTTP Error 503: Service Unavailable)
2015-12-14 01:09:54,597 Trac[bayes] WARNING: Reset SPAM count from 30702 to 3070
3 due to keyword 'x-mailer:none'.
2015-12-14 01:09:54,689 Trac[bayes] WARNING: Reset SPAM count from 30702 to 30703 due to keyword 'reply-to:none'.
2015-12-14 01:09:57,028 Trac[stopforumspam] WARNING: StopForumSpam request failed (HTTP Error 503: Service Unavailable)
2015-12-14 01:09:58,114 Trac[bayes] WARNING: Reset SPAM count from 30704 to 30705 due to keyword 'x-mailer:none'.
2015-12-14 01:09:58,817 Trac[main] ERROR: Internal Server Error: <RequestWithSession "POST '/admin/spamfilter/monitor?num=50&page=1'">, referrer 'https://trac-hacks.org/admin/spamfilter/monitor?num=50&page=1'
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 554, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/trac/admin/web_ui.py", line 119, in process_request
    path_info)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/admin.py", line 95, in render_admin_panel
    if self._process_monitoring_panel(req):
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/admin.py", line 311, in _process_monitoring_panel
    filtersys.train(req, entries, spam=spam, delete=delete)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filtersystem.py", line 344, in train
    entry.content, entry.ipnr, spam=spam)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filters/bayes.py", line 90, in train
    hammie.train(testcontent.encode('utf-8','ignore'), spam)
  File "/usr/lib/python2.6/dist-packages/spambayes/hammie.py", line 162, in train
    self.bayes.learn(tokenize(msg), is_spam)
  File "/usr/lib/python2.6/dist-packages/spambayes/classifier.py", line 273, in learn
    self._add_msg(wordstream, is_spam)
  File "/usr/lib/python2.6/dist-packages/spambayes/classifier.py", line 384, in _add_msg
    self._wordinfoset(word, record)
  File "/usr/lib/python2.6/dist-packages/spambayes/storage.py", line 434, in _wordinfoset
    self._set_row(word, record.spamcount, record.hamcount)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filters/bayes.py", line 160, in _set_row
    "VALUES (%s,%s,%s)", (word, nspam, nham))
  File "build/bdist.linux-i686/egg/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "build/bdist.linux-i686/egg/trac/db/util.py", line 72, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
IntegrityError: duplicate key value violates unique constraint "spamfilter_bayes_pkey"
IntegrityError: duplicate key value violates unique constraint "spamfilter_bayes_pkey"

Attachments (0)

Change History (1)

comment:1 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [14376].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.