Postponed (maintainer needs more info)
Project:
Decisions
Version:
5.x-1.1
Component:
User interface
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2009 at 21:08 UTC
Updated:
28 May 2010 at 02:45 UTC
Greetings:
We have an active, very high profile poll happening right now with Decisions and Drupal 6.
The poll open time is June 1st of this year, and the poll close time is June 5th. All yesterday, things were working very smoothly, and the same was happening this morning (the 2nd). Now the poll is randomly going from "Active" to "Closed", and I have not been able to replicate the issue in our test environment, which is a direct clone of our production environment. Has anyone else seen this behaviour, and has anyone got a suggested fix?... Quorum is set to 0 and 0, and the server date is correct.
Comments
Comment #1
ZaphoidYK commentedFound the issue after enabling logdump mode on MySQL...
The issue was (and still is) with cron.php, which whenever it was running was setting the state of "active" for the poll to 0.
mysql-bin.000001 356170 Query 1 356299 use `drupal`; DELETE FROM cache_form WHERE expire != 0 AND expire < 1243980901
mysql-bin.000001 356299 Query 1 356428 use `drupal`; DELETE FROM cache_menu WHERE expire != 0 AND expire < 1243980901
mysql-bin.000001 356428 Query 1 356538 use `drupal`; UPDATE decisions SET active = 0 WHERE nid=108
mysql-bin.000001 356538 Query 1 356669 use `drupal`; DELETE FROM cache_filter WHERE expire != 0 AND expire < 1243980901
Thoughts?...
Thanks.
Richard.
Comment #2
ZaphoidYK commentedComment #3
ZaphoidYK commentedGuess I'm answering my own questions as I go along here...
Found the issue. The Decisions cron hook function has an error in logic. The logic in the cron function expires the poll by adding the duration to the time of the CREATION timestamp for the node, NOT the time the poll "opens". So we created a poll last week, and left it unpublished until Monday, but with the cron job expiring based on the creation date, the poll was closing every time the CRON job was run.
I've taken this statement from decisions_cron in decisions.module:
$result = db_query('SELECT d.nid FROM {decisions} d INNER JOIN {node} n ON d.nid = n.nid WHERE (n.created + d.runtime) < '. time() .' AND d.active = 1 AND d.runtime <> 0');
...and updated it to...
$result = db_query('SELECT d.nid FROM {decisions} d INNER JOIN {node} n ON d.nid = n.nid WHERE (d.startdate + d.runtime) < '. time() .' AND d.active = 1 AND d.runtime <> 0');
I'm assuming that every poll will have a start date, or the start date will be set to the creation date where one is not specified...
Comment #4
jinjur commentedi was having the same problem the past few days with a test run for a site election - i'll be trying your fix, thank you!
Comment #5
anarcat commentedCould you provide a proper patch?
Comment #6
anarcat commentedComment #7
anarcat commentedCommitted a fix to CVS.
Comment #9
ppival commentedThis appears to be an issue in 5.x.1.1 as well. we're in the middle of a poll, so I haven't upgraded to 1.2 - I don't suppose this is fixed there?
Comment #10
ezra-g commentedCan you provide more info on how to reproduce this?
Have you cleared the Drupal page cache?
Comment #11
ppival commentedSorry, the poll's now officially closed, so can't do live testing, but I did recall that anytime we touched the poll question it would 1) change from open to closed, and 2) reset the closing date to January, so we had to make sure we corrected that if we went in to change a typo, for instance...