[firebird-support] Re: UDF and server crashes on linux
Maybe it will be usefull: ProblemType: Crash Architecture: amd64 Date: Tue May 2 23:55:26 2017 DistroRelease: Ubuntu 14.04 ExecutablePath: /opt/firebird-debug/bin/.debug/firebird.debug ExecutableTimestamp: 1490087772 ProcCmdline: /opt/firebird-debug/bin/.debug/firebird.debug ProcCwd: /tmp ProcEnviron: SHELL=/bin/bash TERM=xterm PATH=(custom, no user) LANG=pl_PL.UTF-8 XDG_RUNTIME_DIR= ProcMaps: 0040-004b8000 r-xp fc:00 47583 /opt/firebird-debug/bin/.debug/firebird.debug 006b8000-006be000 rw-p 000b8000 fc:00 47583 /opt/firebird-debug/bin/.debug/firebird.debug 006be000-006c3000 rw-p 00:00 0 00e0e000-00e63000 rw-p 00:00 0 [heap] 2ba1de7d6000-2ba1de7d8000 rw-p 00:00 0 2ba1de7d8000-2ba1de7fb000 r-xp fc:00 46567 /lib/x86_64-linux-gnu/ld-2.19.so 2ba1de7fb000-2ba1de80 rw-p 00:00 0 2ba1de80-2ba1de802000 rw-s 08:06 1441797 /srv/oracle/fb/tmp/fb12_trace 2ba1de808000-2ba1de809000 rw-s 08:06 1441797 /srv/oracle/fb/tmp/fb12_trace 2ba1de80b000-2ba1de84e000 rw-p 00:00 0 2ba1de85-2ba1de857000 r--s fc:00 6233 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache 2ba1de857000-2ba1de8c7000 rw-p 00:00 0 2ba1de8c8000-2ba1de8c9000 rw-s 08:06 1441832 /srv/oracle/fb/tmp/fb_lock_00fc987a 2ba1de8cb000-2ba1de8cc000 rw-s 00013000 08:06 1441832 /srv/oracle/fb/tmp/fb_lock_00fc987a 2ba1de8cc000-2ba1de9a3000 rw-p 00:00 0 2ba1de9a8000-2ba1de9a9000 rw-s 08:06 1441833 /srv/oracle/fb/tmp/fb12_monitor_00fc987a 2ba1de9a9000-2ba1de9c9000 rw-p 00:00 0 2ba1de9cc000-2ba1de9ec000 rw-p 00:00 0 2ba1de9f8000-2ba1de9f9000 rw-s 08:06 1441831 /srv/oracle/fb/tmp/fb_user_mapping 2ba1de9fa000-2ba1de9fb000 r--p 00022000 fc:00 46567 /lib/x86_64-linux-gnu/ld-2.19.so 2ba1de9fb000-2ba1de9fc000 rw-p 00023000 fc:00 46567 /lib/x86_64-linux-gnu/ld-2.19.so 2ba1de9fc000-2ba1de9fd000 rw-p 00:00 0 2ba1dea0-2ba1deba r-xp fc:00 31479 /opt/firebird/lib/libfbclient.so.3.0.2 2ba1deba-2ba1deda ---p 001a fc:00 31479 /opt/firebird/lib/libfbclient.so.3.0.2 2ba1deda-2ba1dedbd000 rw-p 001a fc:00 31479 /opt/firebird/lib/libfbclient.so.3.0.2 2ba1dedbd000-2ba1dedcb000 rw-p 00:00 0 2ba1dedd-2ba1dedeb000 r-xp fc:00 31328 /usr/lib/libtommath.so.0.0.42 2ba1dedeb000-2ba1defea000 ---p 0001b000 fc:00 31328 /usr/lib/libtommath.so.0.0.42 2ba1defea000-2ba1defeb000 r--p 0001a000 fc:00 31328 /usr/lib/libtommath.so.0.0.42 2ba1defeb000-2ba1defec000 rw-p 0001b000 fc:00 31328 /usr/lib/libtommath.so.0.0.42 2ba1deff-2ba1deff7000 r-xp fc:00 46550 /lib/x86_64-linux-gnu/librt-2.19.so 2ba1deff7000-2ba1df1f6000 ---p 7000 fc:00 46550 /lib/x86_64-linux-gnu/librt-2.19.so 2ba1df1f6000-2ba1df1f7000 r--p 6000 fc:00 46550 /lib/x86_64-linux-gnu/librt-2.19.so 2ba1df1f7000-2ba1df1f8000 rw-p 7000 fc:00 46550 /lib/x86_64-linux-gnu/librt-2.19.so 2ba1df1f8000-2ba1df1fb000 r-xp fc:00 46569 /lib/x86_64-linux-gnu/libdl-2.19.so 2ba1df1fb000-2ba1df3fa000 ---p 3000 fc:00 46569 /lib/x86_64-linux-gnu/libdl-2.19.so 2ba1df3fa000-2ba1df3fb000 r--p 2000 fc:00 46569 /lib/x86_64-linux-gnu/libdl-2.19.so 2ba1df3fb000-2ba1df3fc000 rw-p 3000 fc:00 46569 /lib/x86_64-linux-gnu/libdl-2.19.so 2ba1df40-2ba1df422000 r-xp fc:00 315 /lib/x86_64-linux-gnu/libncurses.so.5.9 2ba1df422000-2ba1df621000 ---p 00022000 fc:00 315 /lib/x86_64-linux-gnu/libncurses.so.5.9 2ba1df621000-2ba1df622000 r--p 00021000 fc:00 315 /lib/x86_64-linux-gnu/libncurses.so.5.9 2ba1df622000-2ba1df623000 rw-p 00022000 fc:00 315 /lib/x86_64-linux-gnu/libncurses.so.5.9 2ba1df628000-2ba1df72e000 r-xp fc:00 4759 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 2ba1df72e000-2ba1df92d000 ---p 00106000 fc:00 4759 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 2ba1df92d000-2ba1df935000 r--p 00105000 fc:00 4759 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 2ba1df935000-2ba1df937000 rw-p 0010d000 fc:00 4759 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 2ba1df937000-2ba1df93a000 rw-p 00:00 0 2ba1df94-2ba1dfa45000 r-xp fc:00 46563 /lib/x86_64-linux-gnu/libm-2.19.so 2ba1dfa45000-2ba1dfc44000 ---p 00105000 fc:00 46563 /lib/x86_64-linux-gnu/libm-2.19.so 2ba1dfc44000-2ba1dfc45000 r--p 00104000 fc:00 46563 /lib/x86_64-linux-gnu/libm-2.19.so 2ba1dfc45000-2ba1dfc46000 rw-p 00105000 fc:00 46563 /lib/x86_64-linux-gnu/libm-2.19.so 2ba1dfc48000-2ba1dfc5e000 r-xp fc:00 40983 /lib/x86_64-linux-gnu/libgcc_s.so.1 2ba1dfc5e000-2ba1dfe5d000 ---p 00016000 fc:00 40983 /lib/x86_64-linux-gnu/libgcc_s.so.1 2ba1dfe5d000-2ba1dfe5e000 r--p 00015000 fc:00 40983 /lib/x86_64-linux-gnu/libgcc_s.so.1 2ba1df
[firebird-support] Re: UDF and server crashes on linux
---In firebird-support@yahoogroups.com, 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 $7FA736178E2C: 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
Re: [firebird-support] Re: UDF and server crashes on linux
On 03.05.2017 o 09:28, hv...@users.sourceforge.net [firebird-support] wrote: > ---In firebird-support@yahoogroups.com, 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 $7FA736178E2C: > 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 ==--__ __--==--__
Re: [firebird-support] Re: UDF and server crashes on linux
Problem solved. Strange behavior of lazarus 1.6.2 IDE for linux, project settings like "use ansistrings" are not correctly propagated ... I had to set it in custom fpc settings -Sh to fix this.. -- Regards, Michał Kurczabiński