Closed (fixed)
Project:
Date Reminder
Version:
6.x-1.0-beta1
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
9 Aug 2012 at 06:23 UTC
Updated:
24 Aug 2012 at 17:22 UTC
Jump to comment: Most recent file
It seems that my issue has gone in Drupal.org (but not in my system :( )
I uses poormanscron set to 60 minutes
I set at 8am 3 reminders for 8 pm, I set them to 11, 10 and 8 hours before this time
I got the following messages (the timing are rounded, as cron triggers when something happens on the site, so the actual time might be up to 30 minutes late):
- 3 at 9am
- 2 at 11 am
- 3 at 12 am
- 3 at 1 pm
- 3 at 2 pm
- 3 at 3 pm
- 2 at 4 pm
- 1 at 5 pm
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | datereminder.pdf | 208.72 KB | jvieille |
| #7 | datereminder_enable.pdf | 177.19 KB | jvieille |
Comments
Comment #1
dwillcox commentedOK, now, this is very strange. I wish I knew how to reproduce this.
First question: What do you have "Cron Frequency in minutes" set to? That's under admin/settings/datereminder.
Then, what can you tell me about poormanscron? (I take it you don't have the ability to use "real" cron to do regular processing?) I'm looking at the project page. You're using version 2.x, I hope?
Another question: Is this a one-time event, or repeating? How often does it repeat?
Do you know if poormancron guarantees that cron will only be invoked at most once each 60 minutes (say)? I suppose it's possible that if datereminder_cron() got called several times concurrently, it would probably break.
I also suppose it's possible that something funny is happening with timezones. Does your site use UTC? It shouldn't make a difference, but I don't know at this point.
I'll do some head scratching looking at code. Feel free to do the same.
One other thing: I'm a bit confused about your setup. Something doesn't seem to line up right. You say that you created an event at 8am to occur at 8am, and then created three reminders to go off before that? That doesn't sound right, unless it's a repeating event. Datereminder shouldn't let you schedule a reminder for after the event.
Could you perhaps dump out what you find at admin/settings/datereminder/view right after you scheduled your reminders, and then after each set of reminders goes out?
Comment #2
jvieille commentedThank you for taking care off this issue.
- Regarding the setup, it was 8pm, not 8am - no way to edit an issue after it is created...
- it is a one time event
- the cron frequency was kept to default 60 minutes
- I am using poormanscron-6.x-2.2 - I prefer this solution because it is simpler that setting a "true" cron for every site
- I am not sure, but poormanscron seems to trigger only if activities occur on the site - so the cron might be delayed beyond the setting if nothing happens. However, it is unlikely that cron will be invoked more times that expected. Thinking about it, it would be possible that the system crons multiple times concurrently due to the multitjhreading (I have a 4*2 cores CPU), but I don"t know how to check this.
- the Date setting is Europe/Paris
I'll make some more tests as suggested.
Comment #3
dwillcox commentedYou can't edit the issue? Isn't there an "Edit" button up under the title, next to "View?" I see that on issues I've submitted to other projects. But anyway, I corrected the time to avoid further confusion.
Well, I certainly want to take care of this issue. I just need to figure out what's going on. There are actually two puzzling behaviours here.
The first issue could be explained of
hook_cron()can be called several times concurrently. That's not an issue with multiple cores. Even on a uniprocessor, process scheduling can cause multiple processes to interleave time on the processor. The question is whether Drupal or poormanscron have logic to prevent multiple concurrent runs, or is a cron hook expected to deal with that? Research needed.The second issue, could, possibly, be due to "inconsistent" default values in the code. I think that in at least some releases, different routines had different defaults, assuming that the system administrator would actually set a value. That could lead to strange behavior. I thought that was fixed in beta1, but I'm not sure. Could you please check and be sure that the frequency is explicitly set to 60 in the admin menu?
And again, if you could report what you see in
admin/settings/datereminder/view, especially after the last reminder when you keep getting them, it would be a help.Comment #4
dwillcox commentedHmm. A couple of interesting things I found:
https://drupal.org/node/119094
http://drupal.org/node/361071
drupal_cron_run()Apparently, others have had similar problems in the past, but it's unclear to me what was fixed. Need to read more. But not now.
In particular, others had problems with concurrent calls to their cron hook when using
poormanscron. It appears thatdrupal_cron_run()is intended to eliminate the concurrent calls. What's unclear to me is whetherpoormanscronusesdrupal_cron_run().Comment #5
dwillcox commentedStudying history a bit more, it appears that poormanscron was chagned to use
drupal_cron_run()quite a while ago, and version 6.x-2.2 should definitely have that fix. So I'm guessing this may have something to do with computation of when reminders should next be sent rather than concurrent calls todatereminder_cron().So, we need to figure out what's "different" with your site.
Comment #6
dwillcox commentedI'm still wracking my brain over this. I just can't get it to break. Some possibilities, maybe you could check:
dateremindertable?I may just have to try using
poormanscroninstead of "real" cron, though I don't know how well that will work given that my site has pretty light traffic.Comment #7
jvieille commentedIa m running MySQL 5.1.58-1
Attached the structures of the 2 tables I found in the database
Thanks for taking care
Comment #8
dwillcox commentedRats. That all looks correct.
Well, maybe if you could dump the date
dateremindertable after you initially request the events, and after you get the first set of reminders (but expected only one), maybe that will tell something.Thanks for your help in diagnosing this.
I don't know if anyone else is actually using this, yet. It would be nice to know if others have seen this, or it's something peculiar to your setup.
Comment #9
dwillcox commentedThis isn't related to
poormanscron. (Though note thatpoormanscronwon't run more often than once per hour, and the timing is unpredictable unless your site has a lot of traffic. That's fine, as long as you understand that.Comment #10
dwillcox commentedAn update...
It sounds like this is related to tying Date Reminder to a "Date" field in the node instead of "DateTime" or "Datestamp." That makes sense; since "Date" stores only the date, Date Reminder will probably get confused about the time of the event. It's not quite as simple as saying that the field has no time, but there must be some difference in how the date APIs represent time. Date Reminder seems to know the time, but some of the calculations just don't work right.
Further study needed. But at least this is something I can try in my development environment. Possible solutions:
Figure out how to include time for "Date" CCK fields.
The preferred solution, but I don't know what it will take.
Restrict "lead times" to one day or more for Date fields.
If the above doesn't work, this is a reasonable fall-back.
Don't allow Date Reminder for Date-only fields.
I don't like this, but if nothing else works...
Comment #11
jvieille commentedAccording to the documentation http://drupal.org/node/262066 the 3 kinds of fields handle time as well.
Date seems to be the most portable format, and is probably used by most installations :
However, the date api should take care of the storage difference, maybe you are attempting to read the database directly?
Comment #12
dwillcox commentedAha. I think we're getting somewhere.
I notice that "Date" is format "YYYY-MM-DDTHH:MM:SS", but Datetime is in the database native format "YYYY-MM-DD HH:MM:SS". No, I don't access the database directly, but I do use the datefield data. It's probable that the "T" appears in the internal data structures.
And that could certainly confuse things when it comes to comparing date strings, for example in the routine that looks for the next event occurrence after a given datetime. That routine doesn't understand the two formats.
Unfortunately, as far as I know, there isn't an api function for something like "Give me the next instance of this repeating date after this given time." That's what's needed.
Comment #13
dwillcox commentedYes, I've confirmed that the problem is the "DDTHH" (Datetime) instead of "DD HH" (Date). It should be a relatively simple fix. But not tonight.
Comment #14
dwillcox commentedFix checked in. Working on making a dev release.
Comment #15
jvieille commentedResults of my tests :
Yesterday at noon, II set reminders for a date at 12 today:
Reminder setting | theoretical time | actual time
- 18H | 6 pm | 6:13 pm
- 16H | 8 pm | 7:38 pm
- 14H | 10 pm | 10:11 pm
- 12H | 12pm | 00:59/24
Then nothing
So I only get one notice per reminder, and they sopped as they should.
The last reminder was late certainly because my server does all backup at midnight, lasting about one hour
I just wonder why the 8pm reminder was early...
Comment #16
dwillcox commentedSo it sounds like (except for the below, a very separate issue) it now works for you. Thanks!
Since reminders can (theoretically) be scheduled for any time, but cron runs only periodically, Date Reminder can't guarantee that reminders will be sent exactly on time. Date Reminder tries to minimize the time error by sending any reminders that are pending between "now" and half way to the next anticipated cron run. That's why the setting is there to say how often cron runs.
So, for example, if cron is expected to run each hour, and it runs at 6:00, any reminders scheduled before 6:30 will be sent. (That might include reminders that were scheduled for 5:45, say.)
You're using Poormanscron, which doesn't run on a regular schedule. There will be at least an hour between cron runs, but it could be more depending on traffic.
It looks like, in this case, there was a cron run at about 6:13, and then about 7:38. At the 7:38 run, the 8:00 reminder was sent because that would be closer than the expected next run at 8:38.
With cron running regularly once/hour, the reminder times can be off by as much as a half hour. With Poormanscron adding extra delays, the variation can be even more.
So, basically, this is expected behavior, given the configuration.
Comment #17
dwillcox commentedComment #18
jvieille commentedPerfect,
Thanks
Comment #19
dwillcox commentedAnd thanks for bearing with me through all of this.
Comment #19.0
dwillcox commentedCorrected time of the event. Per submitter, event for 8pm was created at 8am.