Bug #42275 Falcon hangs for any schedule set to " * * * * * "
Submitted: 22 Jan 2009 19:16 Modified: 15 May 2009 17:06
Reporter: Kevin Lewis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.9 OS:Any
Assigned to: Sergey Vojtovich
Tags: F_HANDLER
Triage: Triaged: D1 (Critical)

[22 Jan 2009 19:16] Kevin Lewis
Description:
If I set falcon-scavenge-schedule= * * * * *
with no values, then Falcon hangs in this loop

void Schedule::getNextEvent()
{
   . . .
   for (int cycles = 0;; ++cycles)
      {

with 'cycles increasing forever. 

This will happen for any schedule setting with no real values.

How to repeat:
Start Falcon with falcon-scavenge-schedule= * * * * *

Suggested fix:
Scheduled background threads MUST run sometime. It makes no sense to say they never run.  So assume this is an error.   The constructor of a Schedule object validates the schedule supplied and returns "Invalid schedule string "a * * * * *", for example, if you do not use numeric values, like this;  falcon-scavenge-schedule= a * * * * *

In the same function, return "Invalid schedule string "* * * * *"
[22 Jan 2009 19:21] Kevin Lewis
Sergey, This code change works in Falcon, but then the serve fails in sql_plugin.cc  at line 622;
if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))

the variable pi is null

In the following code, I also capitalized "Invalid schedule...
----------------------------
Schedule::Schedule(const char *scheduleString)
{
+	int elementsFound = 0;
	string = scheduleString;
	memset(elements, 0, sizeof (elements));
	const char *p = string;
	deleted = false;
	useCount = 1;

	for (int n = 0; *p && n < SCHEDULE_ELEMENTS; ++n)
		{
		while (*p == ' ' || *p == '\t' || *p == '"')
			++p;
		
		if (!*p)
			break;

		if (*p == '*')
			++p;
		else if (ISDIGIT (*p))
			{
			ASSERT (n >= 0 && n < SCHEDULE_ELEMENTS);
+			elementsFound++;
			elements [n] = new ScheduleElement (&p);
			int max = maxValues [n];
			
			if (n == WEEKDAY)
				max = 7;
				
			for (ScheduleElement *element = elements [n]; element; element = element->next)
				if (element->from >= max || element->to >= max)
					throw SQLEXCEPTION (RUNTIME_ERROR, "Invalid schedule string \"%s\"", (const char*) string);
			}
		else
			throw SQLEXCEPTION (RUNTIME_ERROR, "Invalid schedule string \"%s\"", (const char*) string);
		}

+	if (!elementsFound)
+		throw SQLEXCEPTION (RUNTIME_ERROR, "invalid schedule string \"%s\"", (const char*) string);

	getNextEvent();
}
[26 Jan 2009 10:27] Sergey Vojtovich
Reported another bug for the server issue, since it likely needs to be fixed in 5.1. See BUG#42345.
[2 Apr 2009 17:38] Bugs System
Pushed into 6.0.11-alpha (revid:hky@sun.com-20090402144811-yc5kp8g0rjnhz7vy) (version source revid:svoj@sun.com-20090306124708-7z0yg7acbqm5xeex) (merge vers: 6.0.11-alpha) (pib:6)
[15 May 2009 17:06] MC Brown
A note has been added to the 6.0.11 changelog: 

Using a falcon-scavenge-schedule of * * * * * would cause Falcon to never execute the required threads to operate.