Status changing from Active to Closed randomly.
ZaphoidYK - June 2, 2009 - 21:08
| Project: | Decisions |
| Version: | 6.x-0.1-beta3 |
| Component: | User interface |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
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.

#1
Found 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.
#2
#3
Guess 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...
#4
i 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!
#5
Could you provide a proper patch?
#6
#7
Committed a fix to CVS.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.