fulltextsearch causes infinitive loop in mysqld

fulltextsearch causes infinitive loop in mysqld

am 15.10.2003 11:27:26 von hurle

Hi!

I think I found a bug in mysql using version 4.0.15:
Using any database with or without fulltext indexes the mysqld seems to
get in a infinit loop when I query something like:

select * from where match() against('T* A* B*
T*' in boolean mode);

the second "T*" seems to produce the problem but only if it is the 4th
or a later searchstring:
This works fine:
select * from where match() against('T* A* T*'
in boolean mode);

Another problem, which might have to do with the first one is, any
searchstring after the 3rd doesn't produce any results:

select * from where match() against('T* A* D*'
in boolean mode);

==> all rows with beginning with "T" or "A" or "D"

select * from where match() against('T* A* D*
F*' in boolean mode);

==> all rows with beginning with "T" or "A" or "D" but NO
rows beginning with "F".


I tried it on two machines running Linux with mysql 4.0.14 and Windows2k
with mysql 4.0.15. The second machine (nearly) crashed because mysqld-nt
used all CPU-resources and couldn't be stopped, so this might be a nice
DOS-Attack against Windows based mysql databases ;-).


Greets
hurle


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: fulltextsearch causes infinitive loop in mysqld

am 15.10.2003 13:36:32 von Sergei Golubchik

Hi!

On Oct 15, hurle wrote:
> Hi!
>
> I think I found a bug in mysql using version 4.0.15:
> Using any database with or without fulltext indexes the mysqld seems to
> get in a infinit loop when I query something like:
>
> select * from where match() against('T* A* B*
> T*' in boolean mode);
>
> select * from where match() against('T* A* D*
> F*' in boolean mode);
>
> ==> all rows with beginning with "T" or "A" or "D" but NO
> rows beginning with "F".

I don't think it's an infinite loop.
Most probably your query matches huge number of rows and MySQL gets very
busy removing duplicates (rows that match both e.g. 'T*' and 'A*').

But let's get some numbers.
What are the results for queries:

SELECT COUNT(*) from ;
SELECT COUNT(*) from where
match() against('T*' in boolean mode);
SELECT COUNT(*) from where
match() against('A*' in boolean mode);
SELECT COUNT(*) from where
match() against('D*' in boolean mode);
SELECT COUNT(*) from where
match() against('F*' in boolean mode);

Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: fulltextsearch causes infinitive loop in mysqld

am 15.10.2003 14:52:36 von hurle

Sergei Golubchik wrote:
> Hi!
>
> On Oct 15, hurle wrote:
>
>>Hi!
>>
>>I think I found a bug in mysql using version 4.0.15:
>>Using any database with or without fulltext indexes the mysqld seems to
>>get in a infinit loop when I query something like:
>>
>>select * from where match() against('T* A* B*
>>T*' in boolean mode);
>>
>>select * from where match() against('T* A* D*
>>F*' in boolean mode);
>>
>>==> all rows with beginning with "T" or "A" or "D" but NO
>>rows beginning with "F".
>
>
> I don't think it's an infinite loop.
> Most probably your query matches huge number of rows and MySQL gets very
> busy removing duplicates (rows that match both e.g. 'T*' and 'A*').

Well, I tried it with a very small database...
I just created a very small testdb:
create table test (id integer primary key not null, lastname varchar(100));
INSERT INTO `test` (`id`, `lastname`) VALUES (0, 'Anders');
INSERT INTO `test` (`id`, `lastname`) VALUES (1, 'Tricky');
INSERT INTO `test` (`id`, `lastname`) VALUES (2, 'Tron');
INSERT INTO `test` (`id`, `lastname`) VALUES (3, 'Dickens');
INSERT INTO `test` (`id`, `lastname`) VALUES (4, 'Digger');
INSERT INTO `test` (`id`, `lastname`) VALUES (5, 'Duck');
INSERT INTO `test` (`id`, `lastname`) VALUES (6, 'Font');
INSERT INTO `test` (`id`, `lastname`) VALUES (7, 'Find');
INSERT INTO `test` (`id`, `lastname`) VALUES (8, 'Zone');
INSERT INTO `test` (`id`, `lastname`) VALUES (9, 'Xtra');
INSERT INTO `test` (`id`, `lastname`) VALUES (10, 'Yps');

>
> But let's get some numbers.
> What are the results for queries:
>
> SELECT COUNT(*) from ;
11
> SELECT COUNT(*) from where
> match() against('T*' in boolean mode);
2
> SELECT COUNT(*) from where
> match() against('A*' in boolean mode);
1
> SELECT COUNT(*) from where
> match() against('D*' in boolean mode);
3
> SELECT COUNT(*) from where
> match() against('F*' in boolean mode);
2

additional information:
SELECT COUNT(*) from where
match() against('T* A* D* F*' in boolean mode);
6

but the entries in only contain single words without any
whitespace characters, commas, points, etc.
so the last query should return 8 (2+1+3+2=8)

another very interesting thing:
SELECT COUNT(*) from where
match() against('T* A* D* T*' in boolean mode);
6

*BUT*

SELECT COUNT(*) from where
match() against('A* T* D* A*' in boolean mode);
mysqld is still running...


On another table the last query succeded but
SELECT COUNT(*) from where
match() against('A* T* D* Y* A*' in boolean mode);
lead to the loop (or a very very long query time)

Regards,
hurle

>
> Regards,
> Sergei
>


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: fulltextsearch causes infinitive loop in mysqld

am 03.11.2003 23:00:59 von Sergei Golubchik

Hi!

Fixed!
Thanks for a great test case!

On Oct 15, hurle wrote:
>
>
> Sergei Golubchik wrote:
> >Hi!
> >
> >On Oct 15, hurle wrote:
> >
> >>Hi!
> >>
> >>I think I found a bug in mysql using version 4.0.15:
> >>Using any database with or without fulltext indexes the mysqld seems to
> >>get in a infinit loop when I query something like:
> >>
> >>select * from where match() against('T* A* B*
> >>T*' in boolean mode);
> >>
> >>select * from where match() against('T* A* D*
> >>F*' in boolean mode);
> >>
> >>==> all rows with beginning with "T" or "A" or "D" but NO
> >>rows beginning with "F".
> >
> >I don't think it's an infinite loop.
> >Most probably your query matches huge number of rows and MySQL gets very
> >busy removing duplicates (rows that match both e.g. 'T*' and 'A*').
>
> Well, I tried it with a very small database...
> I just created a very small testdb:
> create table test (id integer primary key not null, lastname varchar(100));
> INSERT INTO `test` (`id`, `lastname`) VALUES (0, 'Anders');
> INSERT INTO `test` (`id`, `lastname`) VALUES (1, 'Tricky');
> INSERT INTO `test` (`id`, `lastname`) VALUES (2, 'Tron');
> INSERT INTO `test` (`id`, `lastname`) VALUES (3, 'Dickens');
> INSERT INTO `test` (`id`, `lastname`) VALUES (4, 'Digger');
> INSERT INTO `test` (`id`, `lastname`) VALUES (5, 'Duck');
> INSERT INTO `test` (`id`, `lastname`) VALUES (6, 'Font');
> INSERT INTO `test` (`id`, `lastname`) VALUES (7, 'Find');
> INSERT INTO `test` (`id`, `lastname`) VALUES (8, 'Zone');
> INSERT INTO `test` (`id`, `lastname`) VALUES (9, 'Xtra');
> INSERT INTO `test` (`id`, `lastname`) VALUES (10, 'Yps');
>
Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org