oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Error: NJS-500: connection to the Oracle Database was broken #1616

Closed yakov-rs closed 6 months ago

yakov-rs commented 8 months ago
  1. What versions are you using?

"oracledb": "^6.2.0"

Oracle XE 18

  1. Is it an error or a hang or a crash? crash

  2. What error(s) or behavior you are seeing?

    ORA-00600: internal error code, arguments: [kodpunp1], [600], [], [], [], [], [], [], [], [], [], []
    ORA-00600: internal error code, arguments: [kopp2ucoll233], [], [], [], [], [], [], [], [], [], [], []
    Help: https://docs.oracle.com/error-help/db/ora-00600/
    at Protocol._processMessage (node_modules\oracledb\lib\thin\protocol\protocol.js:172:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ThinConnectionImpl._execute (node_modules\oracledb\lib\thin\connection.js:189:7)
    at async ThinConnectionImpl.execute (node_modules\oracledb\lib\thin\connection.js:927:14)
    at async Connection.execute (node_modules\oracledb\lib\connection.js:861:16)
    at async Connection.<anonymous> (node_modules\oracledb\lib\util.js:165:14)
    at async executePLSQL (index.js:13:3) {
    offset: 0,
    errorNum: 600,
    code: 'NJS-500'
    }
  3. Include a runnable Node.js script that shows the problem.

oracle scripts

create table test_insert_string(id number(19),str varchar2(256 char));

create or replace type test_insert_rec is object (
  id   number(19),
  str1 varchar2(256 char),
  str2 varchar2(256 char),
  str3 varchar2(256 char),
  str4 varchar2(256 char)
);

create or replace type test_insert_tab is table of test_insert_rec;

create or replace procedure saveString(p_strings test_insert_tab)
as
begin
  insert into test_insert_string(id, str)
  select
    id,
    str1
  from
    table(p_strings);
end;

node js

const oracledb = require('oracledb');

async function executePLSQL() {
    let connection;

    try {
        connection = await oracledb.getConnection({
            user: "user",
            password: 'password',
            connectString: "connect string"
        });

        await connection.execute(`begin saveString(:p_strings); end;`,
            {
                p_strings: {
                    dir: oracledb.BIND_IN,
                    val: [1,2,3,4,5,6].map(() => ({
                        ID: 1,
                        STR1: JSON.stringify({
                            message_id: 11111111111111,
                            from: {
                                id: 22222222,
                                bool: false,
                                text1: "aaaaaa",
                                text23:"qqqqqq1"
                            },
                            chat: {data: '1sa12wug12iwt1i2et1i2egi12uegi12u3ti123t'},
                            date: 1697533373,
                            text: '11111111111111111111111111111111111111111111111111'
                        })
                    })),
                    type: `TEST_INSERT_TAB`
                }
            },
            {
                autoCommit: true
            });

    } catch (err) {
        console.error(err);
    } finally {
        if (connection) {
            try {
                await connection.close();
            } catch (err) {
                console.error(err);
            }
        }
    }

}

executePLSQL();

works fine if:

create or replace type test_insert_rec is object (
  id   number(19),
  str1 varchar2(256 char),
  str2 varchar2(256 char),
  str3 varchar2(256 char)
);

or

text23:"qqqqqq" // shorten by 1 symbol

or

"oracledb": "^5.5.0"
sharadraju commented 8 months ago

Please test this with Oracle 19c or Oracle 21c Database. What is the platform, where your application is running?

yakov-rs commented 8 months ago

Please test this with Oracle 19c or Oracle 21c Database.

I don't have those options.

What is the platform, where your application is running?

server: Oracle 18XE (centos7) client: oracle instantclient_19_14 (windows 10) nodejs: v16.19.1

yakov-rs commented 8 months ago

any updates?

sharadraju commented 8 months ago

Hi @yakov-rs. We are looking into it. In the meantime, can you try using the Thick mode with node-oracledb 6.2? You can enable Thick mode as described here

yakov-rs commented 8 months ago

Hi @yakov-rs. We are looking into it. In the meantime, can you try using the Thick mode with node-oracledb 6.2? You can enable Thick mode as described here

I tried. works without errors.

sudarshan12s commented 8 months ago

Hi @yakov-rs. We are looking into it. In the meantime, can you try using the Thick mode with node-oracledb 6.2? You can enable Thick mode as described here

I tried. works without errors.

Thanks for confirming. We are able to reproduce the issue and will update.

sharadraju commented 8 months ago

@yakov-rs The patch is available here

sharadraju commented 6 months ago

This has been fixed as part of the 6.3 release.