date format error can crash server
-
If a user enters (mistakenly or not) a date in the Begin field that does not conform to the YYYY-MM-DD standard, the date defaults to 1970-01-01. This can cause numerous errors as the plugin struggles to load events.
This error can be entered without throwing an immediate error. In our case, once entered the dates caused a series of errors that eventually crashed the server. Details are below, if you are interested.
We use the My Calendar plugin on more than 20 sites, and have for nearly a year, without any serious incidents. But regardless, even if events like this are rare, it would seem easy to avoid them altogether by adding some better validation to the date fields, so that mis-formatted dates are not accepted, or do not default to 1970-01-01.
When one of our servers crashed recently, we narrowed the problem down to the Linux function “gettimeofday,” which was being executed hundreds of thousands of times per minute. Some other processes or scripts – most likely PHP – were obviously calling this function in an infinite loop.
Some odd settings in our php.ini exacerbated the problem, and Apache was soon hogging CPU and killing processes to free up swap space. By examining the Apache error log files we were able to determine that the problem existed in a WordPress site using the My Calendar plugin, which had accumulated an error log more the 30GB large, mostly containing errors from my-calendar-output.php.
We deleted the error log and then dumped the tables associated with the calendar data. There were several calendar events (and associated recurrences) where the start dates were in the years 1970 to 197x. We deleted the events with dates beginning in the 1970s, and all normal functionality returned.
The topic ‘date format error can crash server’ is closed to new replies.