Bug #4197 Server Dies when Full text search
Submitted: 18 Jun 2004 0:56 Modified: 18 Jun 2004 13:17
Reporter: Jose Avila Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:4.0.20-standard OS:Linux (Redhat Linux 9.0)
Assigned to: Assigned Account CPU Architecture:Any

[18 Jun 2004 0:56] Jose Avila
Description:
when doing the following query the server dies and restarts in my server its repeatable dont know if it will apply to other server or table structures this is the query

 COUNT(*) as total,
                  MAX(MATCH (BoardKeywords,BoardTitle) AGAINST (' \"joaquin phoenix')) as maxRelevance,
                  MAX(Board.BoardAvgVisit) as maxBoardAvgVisit,
                  MAX(Board.BoardAvgPost) as maxBoardAvgPost
                FROM
                  Board
                WHERE
                  MATCH (BoardKeywords,BoardTitle) AGAINST (' \"joaquin phoenix' IN BOOLEAN MODE)

the one thing that makes it go bad is when the user doesnt close the qoute on the search \"joaquin phoenix if \"joaquin phoenix\" is done then it works fine.

thread stack

Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfe3eb78, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x80720d4
0x8250d48
0x822b51d
0x822b6ea
0x822bd9d
0x822bb25
0x80caf34
0x80a0545
0x809f516
0x809f2b3
0x8097778
0x8095be6
0x807cfd2
0x8080935
0x807c113
0x807bb5e
0x807b388
0x824e4fc
0x828452a
New value of fp=(nil) failed sanity check, terminating stack trace!

I ran this through the stack trace and got this

0x80720d4 handle_segfault + 420
0x8250d48 pthread_sighandler + 184
0x822b51d _ftb_strstr + 61
0x822b6ea _ftb_climb_the_tree + 202
0x822bd9d ft_boolean_find_relevance + 509
0x822bb25 ft_boolean_read_next + 837
0x80caf34 ft_read__9ha_myisamPc + 52
0x80a0545 join_ft_read_first__FP13st_join_table + 53
0x809f516 sub_select__FP4JOINP13st_join_tableb + 86
0x809f2b3 do_select__FP4JOINPt4List1Z4ItemP8st_tableP9Procedure + 403
0x8097778 mysql_select__FP3THDP13st_table_listRt4List1Z4ItemP4ItemP8st_orderT4T3T4UlP13select_result + 7000
0x8095be6 handle_select__FP3THDP6st_lexP13select_result + 102
0x807cfd2 mysql_execute_command__Fv + 1026
0x8080935 mysql_parse__FP3THDPcUi + 149
0x807c113 dispatch_command__F19enum_server_commandP3THDPcUi + 1443
0x807bb5e do_command__FP3THD + 158
0x807b388 handle_one_connection + 648
0x824e4fc pthread_start_thread + 220
0x828452a thread_start + 4

How to repeat:
Table structure

CREATE TABLE Board_Category (
  Category_ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  Parent_ID INTEGER UNSIGNED NULL,
  CategoryName VARCHAR(25) NULL,
  OrderBy INTEGER UNSIGNED NULL,
  PRIMARY KEY(Category_ID),
  INDEX Board_Category_index5134(Parent_ID),
  INDEX Board_Category_index5135(CategoryName),
  INDEX Board_Category_index5144(OrderBy)
);

CREATE TABLE Board (
  Board_ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  BoardRegID INTEGER UNSIGNED NULL,
  BoardName VARCHAR(100) NULL,
  BoardTitle VARCHAR(50) NULL,
  BoardDescription TINYTEXT NULL,
  BoardKeywords TEXT NULL,
  BoardUrl VARCHAR(100) NULL,
  BoardIsGold INTEGER UNSIGNED NULL,
  BoardAvgVisit INTEGER UNSIGNED NULL,
  BoardAvgPost INTEGER UNSIGNED NULL,
  BoardTotVisit INTEGER UNSIGNED NULL,
  BoardTotPost INTEGER UNSIGNED NULL,
  BoardLastUpdate INTEGER(15) UNSIGNED NULL,
  PRIMARY KEY(Board_ID),
  FULLTEXT INDEX Board_index5126(BoardDescription),
  FULLTEXT INDEX Board_index5128(BoardKeywords),
  UNIQUE INDEX Board_index5130(BoardName),
  FULLTEXT INDEX Board_index5132(BoardTitle),
  FULLTEXT INDEX Board_index5146(BoardTitle, BoardKeywords)
);

CREATE TABLE `Board_has_Board_Category` (
  `Board_Board_ID` int(10) unsigned NOT NULL default '0',
  `Board_Category_Category_ID` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`Board_Board_ID`,`Board_Category_Category_ID`),
  KEY `board_has_Board_Category_FKIndex1` (`Board_Board_ID`),
  KEY `board_has_Board_Category_FKIndex2` (`Board_Category_Category_ID`)
) TYPE=MyISAM

the query 
SELECT
                  COUNT(*) as total,
                  MAX(MATCH (BoardKeywords,BoardTitle) AGAINST (' \"joaquin phoenix')) as maxRelevance,
                  MAX(Board.BoardAvgVisit) as maxBoardAvgVisit,
                  MAX(Board.BoardAvgPost) as maxBoardAvgPost
                FROM
                  Board
                WHERE
                  MATCH (BoardKeywords,BoardTitle) AGAINST (' \"joaquin phoenix' IN BOOLEAN MODE)

or any query that doesnt close the "
[18 Jun 2004 13:17] Sergei Golubchik
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

http://bugs.mysql.com/3870