List:General Discussion« Previous MessageNext Message »
From:Stefan Kuhn Date:November 5 2012 2:28pm
Subject:Aw: Re: UDF behaves non-deterministic
View as plain text  
Hi Dan,

thanks for your answer. The UDF only contains functions (the one called in sql plus two
functions called in it). There are no variables outside them and nothing is declared
static. All variables inside the functions are declared just like "double x=0;" etc. I am
not an expert on C, but my understanding is that these values are separate for each call
of the function and don't influence each other. Do you have a suggestion what I should
look for in my c code? Or do I need to make the code thread-safe in that sense that
concurrent executions are prevented by monitors or semaphors or so (no idea about what
this is called in c)?

>The first thing I would do is examine your UDF and ensure that it is
>thread-safe. No global variables, no static variables within functions,
>etc. Also make sure that any libc functions you call that are documented as
>non-threadsafe are wrapped by a mutex or otherwise protected against
>multiple simultaneous access.
>As for debugging, you should be able to write things to stderr which will
>show up in the mysql logfile, or you could open your own logfile and write
>to that.

Dan Nelson

Aw: Re: UDF behaves non-deterministicStefan Kuhn5 Nov
  • Re: Re: UDF behaves non-deterministicMichael Dykman5 Nov
    • Re: UDF behaves non-deterministicStefan Kuhn7 Nov