On 03.05.2017 o 09:28, [email protected] [firebird-support] wrote:
> ---In [email protected], <michkurc@...> wrote :
>   
>   Tested on FB 2.5.7 and 3.02 ubuntu_x64 14.04 (two different machines);
>   On windows fbx64 works ok.
>   
>   udf return integer by value.
>   
>   scenario:
>   more than 2 connections to db
>   sql : select count(*) from table where validfield(field) = 1 on each 
> connection
>   table with > 2 milions record
>   
>   udf written in object pascal ( no memory leaks and other problems)
>   
>   other implementation this udf in C++ works fine on linux and windows...
>   
>   stacktrace:
>   [Thread 0x7fa737789700 (LWP 28692) exited]
>   [New Thread 0x7fa737789700 (LWP 28693)]
>   [New Thread 0x7fa736dd7700 (LWP 28694)]
>   [New Thread 0x7fa73603f700 (LWP 28698)]
>   An unhandled exception occurred at $00007FA736178E2C:
>   EStackOverflow: Stack overflow
> 
> 
>    This is object pascal exception, not Firebird's one.
> 
>    Start isql, connect in embedded (aka local) mode, attach gdb to the 
> process and run
> query with problem UDF. It should help you to find a real reason of the issue.
> 
> Regards,
> Vlad

If Vlad's suggestion doesn't help (it definitely should, unless you're 
not familiar with gdb), the first thing I'd do is to extract the 
problematic function from the UDF, put it into a simple app and test 
with different inputs if it actually works (the stack overflow exception 
suggests there might be something wrong with the algorithm, like unbound 
recursion or an infinite loop; I know you wrote "no memory leaks and 
other problems", I would only add "that I'm aware of" ;) ). Also, 
assuming you're compiling the UDF with FPC (free pascal), take into 
account some multithreading specifics related to free pascal (take a 
look at
http://wiki.freepascal.org/Multithreaded_Application_Tutorial
), in particular remember to include cthreads and cmem units in your 
uses list on linux. Keep in mind that superserver and superclassic 
flavors of FB are multithreaded, so your UDF is in fact being loaded 
into a multithreaded process, even if the UDF doesn't do any 
multithreading itself.

have a good one
Tomasz

-- 
__--==============================--__
__--==     Tomasz Tyrakowski    ==--__
__--==        SOL-SYSTEM        ==--__
__--== http://www.sol-system.pl ==--__
__--==============================--__

Reply via email to