IBM / nodejs-idb-connector

A JavaScript (Node.js) library for communicating with Db2 for IBM i, with support for queries, procedures, and much more. Uses traditional callback-style syntax
MIT License
38 stars 23 forks source link

Testing test/dataTypes.js leads to core dump #131

Closed abmusse closed 3 years ago

abmusse commented 3 years ago

Describe the bug

In the process of running the test suite I ran into a core dump:

$ npm test 

> idb-connector@1.2.10 test ~/nodejs-idb-connector
> ln -sf ./build-tmp-napi-v3 ./build && ./node_modules/mocha/bin/mocha --timeout 5s

...

  Data Type Test
    ✓ runs SQLExecute and to bind varbinary (1-D array)

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: fffffffffffb2d0
Trace/BPT trap (core dumped)
(gdb) bt
#0  uv_kill (pid=0, signum=5) at ../deps/uv/src/unix/process.c:583
#1  0x00000001013c6cb8 in node::Kill(v8::FunctionCallbackInfo<v8::Value> const&) ()
#2  0x000000010014824c in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
#3  0x0000000100147dc4 in v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) ()
#4  0x0000000100ed6228 in v8_Default_embedded_blob_data_ ()

To Reproduce Initial I ran into SQLSTATE=55019 SQLCODE=-7008 from test/dataTypes.js stating BLOBTEST, BINARYTEST, and VARBINTEST tables are not valid for operation

$ npm test 

> idb-connector@1.2.10 test ~/nodejs-idb-connector
> ln -sf ./build-tmp-napi-v3 ./build && ./node_modules/mocha/bin/mocha --timeout 5s

...

  86 passing (8s)
  9 failing

  1) Data Type Test
       runs SQLExecute and to bind varbinary (1-D array):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 VARBINTEST in SCHEMA not valid for operation.

  2) Data Type Test
       runs SQLExecute and to bind varbinary (bindParameters):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 VARBINTEST in SCHEMA not valid for operation.

  3) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind blob:
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BLOBTEST in SCHEMA not valid for operation.

  4) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind blob (1-D array):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BLOBTEST in SCHEMA not valid for operation.

  5) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind blob (bindParameters):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BLOBTEST in SCHEMA not valid for operation.

  6) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind binary:
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BINARYTEST in SCHEMA not valid for operation.

  7) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind binary (1-D array):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BINARYTEST in SCHEMA not valid for operation.

  8) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind binary (bindParameters):
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 BINARYTEST in SCHEMA not valid for operation.

  9) Data Type Test
       bind parameters blob/binary/varbinary
         runs SQLExecute and to bind varbinary:
     Uncaught Error: SQLSTATE=55019 SQLCODE=-7008 VARBINTEST in SCHEMA not valid for operation.

So I added with NC to each insert statement and re-ran the test cases

diff --git a/test/dataTypes.js b/test/dataTypes.js
--- a/test/dataTypes.js
+++ b/test/dataTypes.js
@@ -103,7 +103,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind blob', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(512k) Field
-      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -133,7 +133,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind blob (1-D array)', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(512k) Field
-      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -163,7 +163,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind blob (bindParameters)', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(512k) Field
-      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BLOBTEST(BLOB_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -193,7 +193,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind binary', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(10) Field
-      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -222,7 +222,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind binary (1-D array)', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(10) Field
-      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -251,7 +251,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind binary (bindParameters)', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one BLOB(10) Field
-      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.BINARYTEST(BINARY_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -280,7 +280,7 @@ describe('Data Type Test', () => {
     it('runs SQLExecute and to bind varbinary', (done) => {
       const user = (process.env.USER).toUpperCase();
       // Table which only contains one VARBINARY(10) Field
-      const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?)`;
+      const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?) with NC`;
       fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
         if (error) {
           throw error;
@@ -311,7 +311,7 @@ describe('Data Type Test', () => {
   it('runs SQLExecute and to bind varbinary (1-D array)', (done) => {
     const user = (process.env.USER).toUpperCase();
     // Table which only contains one VARBINARY(10) Field
-    const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?)`;
+    const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?) with NC`;
     fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
       if (error) {
         throw error;
@@ -340,7 +340,7 @@ describe('Data Type Test', () => {
   it('runs SQLExecute and to bind varbinary (bindParameters)', (done) => {
     const user = (process.env.USER).toUpperCase();
     // Table which only contains one VARBINARY(10) Field
-    const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?)`;
+    const sql = `INSERT INTO ${user}.VARBINTEST(VARBINARY_COLUMN) VALUES(?) with NC`;
     fs.readFile(`${__dirname}/../README.md`, (error, buffer) => {
       if (error) {
         throw error;
$ npm test 

> idb-connector@1.2.10 test ~/nodejs-idb-connector
> ln -sf ./build-tmp-napi-v3 ./build && ./node_modules/mocha/bin/mocha --timeout 5s

...

  Data Type Test
    ✓ runs SQLExecute and to bind varbinary (1-D array)

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: fffffffffffb2d0
Trace/BPT trap (core dumped)

In the process of running the insert into binary types table we get a core dump shown above

Did a search of the error message and found https://github.com/nodejs/node/issues/32463. Maybe this could be related.

Expected behavior Test suite should run successfully

@dmabupt

Have you encountered this before?

dmabupt commented 3 years ago

I have skipped these tests. We can reopen it until we got a V8 fix for them. b02cd36