Bug #10341 queryBrowser fails to start with Assertion failed! error
Submitted: 3 May 2005 16:26 Modified: 27 Jun 2005 9:55
Reporter: Tony Black Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.7 OS:Windows (Win XP)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any

[3 May 2005 16:26] Tony Black
Description:
Appears to be identicle to #8542, however that bug looks to be closed with a no feedback status.

Assertion failed!
Program: ...\MySQLQueryBrowser.exe
File: .\source\myx_xml_history.c
Line: 596
Expression: strlen(iso_date) >=10

If I hit ignore I see a indication of a memory access
violation error in libmysqlqb.dll. At this point the query results frame does
not update. If I select a query and execute it, the page gets the data from the
database. When it has displayed the data the same error window is displayed.

How to repeat:
start application
[3 May 2005 17:19] MySQL Verification Team
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.
[4 May 2005 14:48] Tony Black
It appears that this is the offending procedure in the myx_xml_history.c file:

static void split_iso8601_date(const char* iso_date, int *year, int *month,
                               int *day, int *hour, int *min, int *sec)
{
  assert(strlen(iso_date) >= 10);

  *year= (iso_date[0]-'0') * 1000 + (iso_date[1]-'0') * 100 + (iso_date[2]-'0') * 10 +
    (iso_date[3]-'0');
  *month= (iso_date[5]-'0') * 10 + (iso_date[6]-'0');
  *day= (iso_date[8]-'0') * 10 + (iso_date[9]-'0');

  if (strlen(iso_date) < 19)
  {
    //old file
    *hour= *min= *sec= 0;
    return;
  }

  *hour= (iso_date[11]-'0') * 10 + (iso_date[12]-'0');
  *min= (iso_date[14]-'0') * 10 + (iso_date[15]-'0');
  *sec= (iso_date[17]-'0') * 10 + (iso_date[18]-'0');
}

I only see it referenced in the myx_xml_history.c file. In that file it is referenced 5 times. 

43:static void split_iso8601_date(const char* iso_date, int *year, int *month, 
219:    split_iso8601_date(history->entries[i].date_last_access, &year, &month, &day,
508:  split_iso8601_date(a->date_last_access, &a_year, &a_month, &a_day,
510:  split_iso8601_date(b->date_last_access, &b_year, &b_month, &b_day,
554:  split_iso8601_date(a->date_last_access, &a_year, &a_month, &a_day,
556:  split_iso8601_date(b->date_last_access, &b_year, &b_month, &b_day,
593:static void split_iso8601_date(const char* iso_date, int *year, int *month, 

It looks to me that the call that is having the problem is the one on line 219 here:

  for (i=0; i < history->entries_num; i++)
  {
    GDate tmp_date;
    //MYX_HISTORY_INTERVAL *last;
    //int found;
    int year, month, day, hour, min, sec;
    int diff_days;

    /* put each history_entry into
    * the appropriate category/group
    */

    split_iso8601_date(history->entries[i].date_last_access, &year, &month, &day,
      &hour, &min, &sec);
    g_date_set_dmy(&tmp_date, day, month, year);

After looking at this I fixed the problem in my application by clearing the clearing the history in the query browser. 

To do this hit ignore until the browser comes up (~14 times in my case) go to the history tab, right click and select clear history.

If it happens again I will follow up with the contents of the mysqlqb_history.xml file. What other information would be helpful?
[4 May 2005 18:22] Tony Black
Error occurred again, the following is the mysqlqb_history.xml file. There appears to be corruption through out. At the time of this corruption I was deleting entries in the DB listed in the history, these entries being deleted ran from 3 to 3000. During this time I was seeing memory access errors and had to kill/restart the application several times. I will follow up with the details of these access violations. here is the history xml file.

Because of the workaround (clearing history) I am lowering the severity to 2.

<history>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_5_archive` t</sql>
<query_type>0</query_type>
<date_last_access>X}_</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql/>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:27:06Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>ma</schema>
<sql>SELECT * FROM `run_data` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:50:40Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data_archive` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:51:36Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:51:54Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data_archive` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:52:07Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data_release` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:52:08Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tb_detail` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:52:28Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>ma</schema>
<sql>SELECT * FROM `run_data_release` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:52:30Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:53:57Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data_archive` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:53:58Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `run_data_release` r</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:54:00Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_3` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:54:02Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_4` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:55:38Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_4_archive` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:56:06Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_4_release` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:56:20Z</date_last_access>
</history_entry>
-
	<history_entry>
<catalog/>
<schema>max</schema>
<sql>SELECT * FROM `tc_data_5` t</sql>
<query_type>0</query_type>
<date_last_access>2005-05-04T17:56:34Z</date_last_access>
</history_entry>
</history>
[27 Jun 2005 9:55] Vladimir Kolesnikov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html