You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When receiving SIGTERM, vsam APIs call back twice with one error not readable.
Reproduce Steps:
write a nodejs script to allocate one data set, write a record, and then update the record in the data set cyclically until it receives SIGTERM. To avoid core dump in Issue 6, close and reopen the data set before updating the record. In its SIGTERM handler, write a new record into the data set.
execute the script, and after several seconds send SIGTERM to it
<=== vsamObj.write() is called back twice, one is successful and the other reports error "[object Object]"
close and deallocate the data set to clean up environment. Change the nodejs script to close and deallocate the data set in its SIGTERM handler
execute the script again, and after several seconds send SIGTERM to it
<=== vsamObj.deallocate() is called back twice. No any error reported here, probably due to vasmObj.close() misses the error callback.
Logs:
For Step 2:
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node test_vsam.js &
[1] 50398990
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>New vsam dataset allocated: USRA.NODEJSAT.VSAMWKLD
Writing record done. Record key: 00001
Closed the vsam dataset.
Open the vsam dataset: USRA.NODEJSAT.VSAMWKLD
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node sigterm_send.js 50398990
Send SIGTERM to process: 50398990
Received SIGTERM.
Number of vsamUpdate loops not executed before SIGTERM: 797948
Error in writing Record. Record key: 00002
The error is: [object Object]
Writing record done. Record key: 00002
[1]+ Done node test_vsam.js
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>
For Step 4:
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node test_vsam.js &
[1] 83952921
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>New vsam dataset allocated: USRA.NODEJSAT.VSAMWKLD
Writing record done. Record key: 00001
Closed the vsam dataset.
Open the vsam dataset: USRA.NODEJSAT.VSAMWKLD
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node sigterm_send.js 83952921
Send SIGTERM to process: 83952921
Received SIGTERM.
Number of vsamUpdate loops not executed before SIGTERM: 796775
Closed the vsam dataset.
Deallocated the vsam dataset.
Deallocated the vsam dataset.
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>
Reference:
main code for Step 2:
// allocate a new VSAM dataset, write one record, close the dataset, open the dataset, find and update the record 1000000 times
vsamWorkload()
process.on('SIGTERM', function() {
console.log("Received SIGTERM.")
console.log("Number of vsamUpdate loops not executed before SIGTERM: " + loopCount)
var recordTemp ={"key": "00002", "name": "CICSUSRGHI", "gender": "MALEGROUP2"}
vsamObj.write(recordTemp, function(err) {
if (err !=null) {
console.log("Error in writing Record. Record key: " + recordTemp.key)
console.error("The error is: " + err)
}
else {
console.log("Writing record done. Record key: " + recordTemp.key)
}
})
})
main code for Step 4:
// allocate a new VSAM dataset, write one record, close the dataset, open the dataset, find and update the record 1000000 times
vsamWorkload()
process.on('SIGTERM', function() {
console.log("Received SIGTERM.")
console.log("Number of vsamUpdate loops not executed before SIGTERM: " + loopCount)
var recordTemp ={"key": "00002", "name": "CICSUSRGHI", "gender": "MALEGROUP2"}
vsamObj.close(function(err) {
if (err != null) {
// Note: vsam.js issue. No callback for vsamObj.close() even when there is error.
console.log("Error in closing vsam dataset.")
console.error("The error is: " + err)
}
else {
// Note: Probably vsam.js issue. No callback for vsamObj.close() when there is no error, different from other vsam.js APIs.
}
})
console.log("Closed the vsam dataset.")
vsamObj.dealloc(function (err) {
if (err != null) {
console.log("Error in deallocating vsam dataset.")
console.error("The error is: " + err)
}
else {
console.log("Deallocated the vsam dataset.")
}
})
})
Issue Description:
When receiving SIGTERM, vsam APIs call back twice with one error not readable.
Reproduce Steps:
<=== vsamObj.write() is called back twice, one is successful and the other reports error "[object Object]"
<=== vsamObj.deallocate() is called back twice. No any error reported here, probably due to vasmObj.close() misses the error callback.
Logs:
For Step 2:
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node test_vsam.js &
[1] 50398990
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>New vsam dataset allocated: USRA.NODEJSAT.VSAMWKLD
Writing record done. Record key: 00001
Closed the vsam dataset.
Open the vsam dataset: USRA.NODEJSAT.VSAMWKLD
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node sigterm_send.js 50398990
Send SIGTERM to process: 50398990
Received SIGTERM.
Number of vsamUpdate loops not executed before SIGTERM: 797948
Error in writing Record. Record key: 00002
The error is: [object Object]
Writing record done. Record key: 00002
[1]+ Done node test_vsam.js
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>
For Step 4:
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node test_vsam.js &
[1] 83952921
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>New vsam dataset allocated: USRA.NODEJSAT.VSAMWKLD
Writing record done. Record key: 00001
Closed the vsam dataset.
Open the vsam dataset: USRA.NODEJSAT.VSAMWKLD
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>node sigterm_send.js 83952921
Send SIGTERM to process: 83952921
Received SIGTERM.
Number of vsamUpdate loops not executed before SIGTERM: 796775
Closed the vsam dataset.
Deallocated the vsam dataset.
Deallocated the vsam dataset.
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts:>
Reference:
main code for Step 2:
main code for Step 4:
main code to send SIGTERM:
The text was updated successfully, but these errors were encountered: