Closed jorgecolonconsulting closed 4 years ago
What's the SQL statement you are executing at the time? Or at least, can you give a description of the query (# of columns, column types and sizes, etc...)?
Here's some additional information. This happens when calling procedures with exec
after a certain amount of rows (around 750 in our case). Here's the description of the columns.
We switched over to using execute()
and fetch()
to fetch row-by-row. After doing that, the segfault doesn't happen anymore.
@dmabupt can you investigate this failure?
This seems to be some resource overflow issue? I may add some checks in the code to identify. Hello @2upmedia , Does the sync version API execSync() return the same error?
:wave: Hi! This issue has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed.
Did anyone ever investigate this issue any further? I seem to having the same issue here when I call executeSync I'm calling a stored proc and the results are inconsistent. Sometimes it works, sometimes I get the segmentation fault. I can call the below code 3 or 4 times and it's fine, but then other times I get the segmentation error. I'm not sure what the problem is?
My code:
let sql = "";
if (env == "DEV") {
sql = 'CALL PGX320CD.PGDR589B(?,?,?,?,?,?,?,?,?,?,?,?)';
} else if (env == "QA") {
sql = 'CALL PGX320CQ.PGDR589B(?,?,?,?,?,?,?,?,?,?,?,?)';
} else if (env == "PROD") {
sql = 'CALL PGX320CP.PGDR589B(?,?,?,?,?,?,?,?,?,?,?,?)';
};
// Set the Input Parms
let product = "";
let quantity1 = 0;
let cost1 = 0;
let quantity2 = 0;
let cost2 = 0;
let quantity3 = 0;
let cost3 = 0;
let quantity4 = 0;
let cost4 = 0;
let quantity5 = 0;
let cost5 = 0;
let messageOut = "";
product = jsonObj.product;
quantity1 = jsonObj.quantity.qty1;
cost1 = jsonObj.cost.cost1;
quantity2 = jsonObj.quantity.qty2;
cost2 = jsonObj.cost.cost2;
quantity3 = jsonObj.quantity.qty3;
cost3 = jsonObj.cost.cost3;
quantity4 = jsonObj.quantity.qty4;
cost4 = jsonObj.cost.cost4;
quantity5 = jsonObj.quantity.qty5;
cost5 = jsonObj.cost.cost5;
messageOut = "";
let params = [
product,
quantity1,
cost1,
quantity2,
cost2,
quantity3,
cost3,
quantity4,
cost4,
quantity5,
cost5,
messageOut
];
console.log(params);
statement.prepareSync(sql,(err)=>{
if (err) {
console.log(err);
};
});
statement.bindParametersSync(params, (err)=>{
if (err) {
console.log(err);
};
});
statement.executeSync((outputParams, err)=>{
if (err) {
console.log('PGDR589: ' + err);
} else {
console.log('Params = ' + outputParams);
statement.close();
connection.disconn();
connection.close();
callback(outputParams);
};
});`
My Stored Proc:
CREATE OR REPLACE PROCEDURE &LIB/PGDR589B (
IN PRODUCT VARCHAR(33),
IN QTY1 NUMERIC(15,3),
IN COST1 NUMERIC(17,4),
IN QTY2 NUMERIC(15,3),
IN COST2 NUMERIC(17,4),
IN QTY3 NUMERIC(15,3),
IN COST3 NUMERIC(17,4),
IN QTY4 NUMERIC(15,3),
IN COST4 NUMERIC(17,4),
IN QTY5 NUMERIC(15,3),
IN COST5 NUMERIC(17,4),
OUT MESSAGE VARCHAR(500)
)
LANGUAGE RPGLE
SPECIFIC &LIB/PGDR589B
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL NAME PGDR589B
PARAMETER STYLE GENERAL ;
COMMENT ON SPECIFIC PROCEDURE &LIB/PGDR589B
IS 'Purchase Price API' ;
the message:
Message . . . . : Space offset X'00000000' or X'69636520656E748A' is outs
current limit for object QP0ZSPWP MATTOJ 215693.
Cause . . . . . : A program tried to set a space pointer, tried to use
storage outside a space, or tried to use an unallocated page in teraspace
The space class is X'08'. The space class designates the type of space:
When I add the debugger, I can see that this happens after the execute function:
SQLExecute(0):
SQLNumResultsCols(0) Has Results
/nodejs/webapi/app.sh[21]: 19066 Segmentation fault(coredump)
Sometimes calling certain procedures via this custom method
executeStatement
as suchCALL PROCEDURE_NAME('val1');
will result in a segfault for node. It fails specifically atawait statement.exec(sqlStatement);
.The job log shows the following error:
Environment details: