UDF In 4.1

UDF In 4.1

am 12.12.2003 00:29:55 von michael.schulman

I'm trying to create a Aggregate UDF. Everything works fine except for the
error handling. I return 1 from the init function and mysqld crashes with a
signal 11. Here is the code :

my_bool xopen_init( UDF_INIT* initid, UDF_ARGS* args, char* message ) {
fprintf(stderr ,"INIT \n");
if (args->arg_count != 1) {
fprintf(stderr ,"INIT BAD ARG COUNT\n");
strcpy( message, "wrong number of arguments: XOPEN() requires one
arguments");
fprintf(stderr, "wrong number of arguments: XOPEN() requires one
arguments\n");
return 1;
}
fprintf(stderr ,"INIT 2\n");
if ((args->arg_type[0] != INT_RESULT) && (args->arg_type[0] !=
REAL_RESULT) ) {
fprintf(stderr ,"INIT BAD ARGS\n");
strcpy(message, "wrong argument type: XOPEN() requires an INT or a REAL"
);
fprintf(stderr, "wrong argument type: XOPEN() requires an INT or a
REAL\n" );
return 1;
}
initid->maybe_null = 1; // The result may be null
initid->max_length = 20; // 6 digits + . + 10 decimals
initid->ptr = (char*)NULL;
fprintf(stderr ,"INIT 4\n");
return 0;
}

It runs fine when I pass in one int or real data type but as soon as I pass
in a string or two variables it crashes...

Here is the output from the error file :

INIT
INIT BAD ARG COUNT
wrong number of arguments: XOPEN() requires one arguments
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose
the problem, but since we have already crashed, something is definitely
wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
sort_buffer_size=2097144
max_used_connections=0
max_connections=100
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections =
225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x8831568
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=0xbe7fe7b8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x811e625
0x4002258b
0x40219680
0x401e9c68
0x40205ef3
0x82d42bd
0x80d8db5
0x80d4a71
0x81471e9
0x814bb14
0x814e6f0
0x814b8f2
0x812d287
0x8130720
0x812b8ea
0x812b299
0x812a949
0x4001efdf
0x4028199a
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/en/Using_stack_trace.html
and follow
instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8832270 = select xopen(b,c) from t
thd->thread_id=1

Successfully dumped variables, if you ran with --log, take a look at the
details of what thread 1 did to cause the crash. In some cases of really
bad corruption, the values shown above may be invalid.

The manual page at http://www.mysql.com/doc/C/r/Crashing.html
contains
information that should help you find out what is causing the crash.

Number of processes running now: 0
031211 18:15:34 mysqld restarted


Any help would be greatly appreciated,
Thanks,
Mike

------------------------------------------------------------ ------------------
This message is intended only for the personal and confidential use of the
designated recipient(s) named above. If you are not the intended recipient of
this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited. This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers. Email transmission cannot be guaranteed to be
secure or error-free. Therefore, we do not represent that this information is
complete or accurate and it should not be relied upon as such. All
information is subject to change without notice.


--
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

UDF In 4.1

am 13.12.2003 13:07:49 von Jani Tolonen

Hi Michael,

Schulman, Michael writes:
> I'm trying to create a Aggregate UDF. Everything works fine except for the
> error handling. I return 1 from the init function and mysqld crashes with a
> signal 11. Here is the code :
>
> my_bool xopen_init( UDF_INIT* initid, UDF_ARGS* args, char* message ) {
> fprintf(stderr ,"INIT \n");
> if (args->arg_count != 1) {
> fprintf(stderr ,"INIT BAD ARG COUNT\n");
> strcpy( message, "wrong number of arguments: XOPEN() requires one
> arguments");
> fprintf(stderr, "wrong number of arguments: XOPEN() requires one
> arguments\n");
> return 1;
> }
> fprintf(stderr ,"INIT 2\n");
> if ((args->arg_type[0] != INT_RESULT) && (args->arg_type[0] !=
> REAL_RESULT) ) {
> fprintf(stderr ,"INIT BAD ARGS\n");
> strcpy(message, "wrong argument type: XOPEN() requires an INT or a REAL"
> );
> fprintf(stderr, "wrong argument type: XOPEN() requires an INT or a
> REAL\n" );
> return 1;
> }
> initid->maybe_null = 1; // The result may be null
> initid->max_length = 20; // 6 digits + . + 10 decimals
> initid->ptr = (char*)NULL;
> fprintf(stderr ,"INIT 4\n");
> return 0;
> }
>
> It runs fine when I pass in one int or real data type but as soon as I pass
> in a string or two variables it crashes...
>
> Here is the output from the error file :

Can you please try to resolve the backtrace.

Section:

E.1.4 Using a Stack Trace

in the manual describes how to do this.

Also, if you have compiled mysqld with debugging enabled, you
can start mysqld under gdb, and when it crashes, please run:

backtrace
info local
up
info local
up
info local

This should give us more information about the place and reason of the
crash.

Regards,

- Jani

For technical support contracts, visit https://order.mysql.com/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Jani Tolonen
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Helsinki, Finland
<___/ 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