UDF: Multi-valued scalar UDF with clob/blob cores sqlci with SIGSEGV
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
In Progress
|
High
|
Suresh Subbiah |
Bug Description
While a single-valued scalar UDF works fine with the clob or blob data type. A multi-valued scalar UDF cores sqlci with SIGSEGV even with just 2 clob or blob output values.
Since clob and blob data types require large buffers, I am assuming this type of scalar UDF is stressing the heap used internally somewhere. But a core is always bad. If there is a limit on how clob and blob can be handled in a scalar UDF, a check should be put in place and an error should be returned more gracefully.
This is seen on the v0407 build installed on a workstation. To reproduce it:
(1) Download the attached tar file and untar it to get the 3 files in there. Put the files in any directory <mydir>.
(2) Make sure that you have run ./sqenv.sh of your Trafodion instance first as building UDF needs $MY_SQROOT for the header files.
(3) run build.sh
(4) Change the line “create library qa_udf_lib file '<mydir>
(5) From sqlci, obey mytest.sql
-------
Here is the execution output:
>>create schema mytest;
--- SQL operation complete.
>>set schema mytest;
--- SQL operation complete.
>>
>>create library qa_udf_lib file '<mydir>/myudf.so';
--- SQL operation complete.
>>
>>create function qa_udf_clob
+>(INVAL clob)
+>returns (c_clob clob)
+>language c
+>parameter style sql
+>external name 'qa_func_vcstruct'
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create function qa_udf_blob
+>(INVAL blob)
+>returns (c_blob blob)
+>language c
+>parameter style sql
+>external name 'qa_func_vcstruct'
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create function qa_udf_clob_mvf
+>(INVAL clob)
+>returns (c_clob1 clob, c_clob2 clob)
+>language c
+>parameter style sql
+>external name 'qa_func_
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create function qa_udf_blob_mvf
+>(INVAL blob)
+>returns (c_blob1 blob, c_blob2 blob)
+>language c
+>parameter style sql
+>external name 'qa_func_
+>library qa_udf_lib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>create table mytable (c_clob clob, c_blob blob);
--- SQL operation complete.
>>insert into mytable values ('CLOB_1', 'BLOB_1');
--- 1 row(s) inserted.
>>
>>select
+>cast(
+>cast(
+>from mytable;
(EXPR) (EXPR)
---------- ----------
CLOB_1 BLOB_1
--- 1 row(s) selected.
>>
>>select qa_udf_
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007ffff4
#
# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libexecutor.
#
# Core dump written. Default location: <mydir>/core or core.18680
#
# An error report file with more information is saved as:
# <mydir>
#
# If you would like to submit a bug report, please visit:
# http://
#
Aborted (core dumped)
-------
Here is the stack trace of the core.
(gdb) bt
#0 0x00000039e28328a5 in raise () from /lib64/libc.so.6
#1 0x00000039e283400d in abort () from /lib64/libc.so.6
#2 0x00007ffff7120a55 in os::abort(bool) ()
from /opt/home/
#3 0x00007ffff72a0f87 in VMError:
from /opt/home/
#4 0x00007ffff72a150e in crash_handler(int, siginfo*, void*) ()
from /opt/home/
#5 0x00007ffff711fbf2 in os::Linux:
from /opt/home/
#6 0x00007ffff71258d6 in JVM_handle_
from /opt/home/
#7 <signal handler called>
#8 0x00007ffff7140ce9 in ParallelScaveng
() from /opt/home/
#9 0x00007ffff71182b0 in os::print_
from /opt/home/
#10 0x00007ffff71252bb in os::print_
from /opt/home/
#11 0x00007ffff729f57c in VMError:
from /opt/home/
#12 0x00007ffff72a0b8a in VMError:
from /opt/home/
#13 0x00007ffff712596f in JVM_handle_
from /opt/home/
#14 <signal handler called>
#15 init (this=0x7fffe97
#16 init (this=0x7fffe97
at ../executor/
#17 ExSimpleSQLBuff
at ../executor/
#18 0x00007ffff4c5bbc9 in ExSimpleSQLBuff
this=<value optimized out>, numberTuples=18432, tupleSize=200016,
heap=
#19 0x00007ffff4c4774f in ExProbeCacheTcb
this=
at ../executor/
#20 0x00007ffff4c47af6 in ExProbeCacheTdb
glob=<value optimized out>) at ../executor/
#21 0x00007ffff4b6c831 in ExOnljTdb::build (this=0x7fffd57
glob=
#22 0x00007ffff4b75171 in ex_root_tdb::build (this=0x7fffd57
cliGlobals=
#23 0x00007ffff5fa7295 in CliStatement::fixup (this=0x7fffe96
cliGlobals=
doSimCheck=
donePrepare=0) at ../cli/
#24 0x00007ffff5fac0e1 in CliStatement:
cliGlobals=
diagsArea=
fixupOnly=0, cliflags=0) at ../cli/
#25 0x00007ffff5f5425c in SQLCLI_
statement_
num_
input_
#26 0x00007ffff5f54f92 in SQLCLI_
cliGlobals=
input_
num_
ptr_
#27 0x00007ffff5fbb27b in SQL_EXEC_Exec (statement_
input_
#28 0x00007ffff79cc81b in SqlCmd::doExec (sqlci_
prep_
unnamedPara
unnamedPara
at ../sqlci/
#29 0x00007ffff79cd212 in SqlCmd::do_execute (sqlci_
prep_
unnamedPara
#30 0x00007ffff79cd93d in DML::process (this=0x223f860, sqlci_env=0xb830f0)
at ../sqlci/
#31 0x00007ffff79b37f4 in Obey::process (this=0xb85460,
sqlci_
#32 0x00007ffff79bbfd4 in SqlciEnv::run (this=0xb830f0,
in_
at ../sqlci/
#33 0x00000000004019c2 in main (argc=3, argv=0x7fffffff
at ../bin/
Changed in trafodion: | |
assignee: | nobody → Suresh Subbiah (suresh-subbiah) |
milestone: | r1.1 → r1.2 |
Changed in trafodion: | |
status: | New → In Progress |