Hi,

I wanted to create a UDF for MySQL that can use the ASpell engine to
generate a string of spelling suggestions, given a single word
parameter. Thus, select aspell('wrd') should return Aspell's suggested
spellings.

I don't know C very well at all, so I began using an existing UDF
function already written, called unprefix(). I changed the main
subroutine to open a pipe to aspell, and to read the output of the
pipe (aspell's suggestions). Because aspell sometimes returns
a suggestions string longer than 255 character I tried to use malloc()
to give the string a maximum headroom of 1024 characters.

When I compile and create this UDF, it seems to work. Queries to it
produce the correct results. No problems. However, in a live
production environment where tens of these queries are sent over a
few minutes, mysqld is repeatedly, seemingly randomly, crashing and
restarting itself. Checking the logs, I see it is only queries using
my new "aspell" UDF that cause the crash. However, it seems random
because 99% of aspell queries in the log do not cause a crash, and the
ones that do are not replicable (trying to repeat a UDF query that caused
the crash does not cause a crash again).

The more serious problem is that sometimes mysqld cannot restart
itself (error log shows that TCP/IP port is 'in use'). That's when the
server is effectively dead.

I retrieved the stack trace information that MySQL reports during each
crash. It is always the same stack trace info. If anyone has any hints for me as to 
what
this is saying, maybe I can pinpoint the source of the problem. As it
is now, I have no idea!

0x40073522 _end + 938017058
0x40139897 _end + 938828951
0x411cf9de _end + 956220894
0x8091dab val_str__17Item_func_udf_strP6String + 119
0x808a129 send__4ItemP6String + 73
0x80b5e8a send_data__11select_sendRt4List1Z4Item + 98
0x80dd236
mysql_select__FP3THDP13st_table_listRt4List1Z4ItemP4ItemRt4List1Z15Item_func_matchP8st_orderT5P4ItemT5UiP13select_result
 +
1830
0x80c3467 mysql_execute_command__Fv + 783
0x80c7523 mysql_parse__FP3THDPcUi + 199
0x80c2849 do_command__FP3THD + 1157
0x80c1ea6 handle_one_connection__FPv + 582

**crash!**

thanks!
Aaron Weiss ([EMAIL PROTECTED])
CTO, Wordsmyth Collaboratory
http://www.wordsmyth.net



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to