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 DPI-1019 in version 6.0.0 #1560

Closed okamototomoyuki closed 1 year ago

okamototomoyuki commented 1 year ago
  1. What versions are you using?

OS: windows 11
node.js: v18.8.0
node-oracledb: 6.0.0

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

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

The following error occurs after upgrading node-oracledb from 5.5.0 to 6.0.0.
The table name and path are hidden for the convenience of my company.

QueryFailedError: DPI-1019: buffer size of 7 is too small
    at OracleQueryRunner.query (D:\repository\APP\node_modules\typeorm\driver\oracle\OracleQueryRunner.js:190:19)
    at async InsertQueryBuilder.execute (D:\repository\APP\node_modules\typeorm\query-builder\InsertQueryBuilder.js:106:33)
    at async #insertOrUpdate (D:/repository/APP/src/lib/core/db/DbSystem.ts:82:15)
    at async ProjectDb.insert (D:/repository/APP/src/lib/core/db/DbSystem.ts:56:5)
    at async MenuService.save (D:/repository/APP/src/lib/app/service/MenuService.ts:82:5)
    at async eval (D:/repository/APP/src/routes/edit-menu/api/+server.ts:14:5)
    at async DiContainer.resolve (D:/repository/APP/src/lib/app/container/DiContainer.ts:33:7)
    at async POST (D:/repository/APP/src/routes/edit-menu/api/+server.ts:12:3)
    at async Module.render_endpoint (D:/repository/APP/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js:47:18)
    at async resolve (D:/repository/APP/node_modules/@sveltejs/kit/src/runtime/server/respond.js:403:17) {
  query: 'INSERT INTO "TABLE_NAME"("ENT_USER_ID", "ENT_DTM", "ENT_PGM_ID", "UPD_USER_ID", "UPD_DTM", "UPD_PGM_ID", "ID", "NAME", "NODE_TYPE", "URL", "IS_AUTH_ONLY", "MENU_CODE", "IS_DISABLED") VALUES (:1, :2, :3, DEFAULT, DEFAULT, DEFAULT, :4, :5, :6, :7, :8, :9, :10)',
  parameters: [
    'NA',
    2023-05-29T04:49:40.654Z,
    'SYSNM',
    1,
    'MENU_NAME',
    2,
    null,
    0,
    null,
    0
  ],
  driverError: Error: DPI-1019: buffer size of 7 is too small
      at async OracleQueryRunner.query (D:\repository\APP\node_modules\typeorm\driver\oracle\OracleQueryRunner.js:153:25)
      at async InsertQueryBuilder.execute (D:\repository\APP\node_modules\typeorm\query-builder\InsertQueryBuilder.js:106:33)
      at async #insertOrUpdate (D:/repository/APP/src/lib/core/db/DbSystem.ts:82:15)
      at async ProjectDb.insert (D:/repository/APP/src/lib/core/db/DbSystem.ts:56:5)
      at async MenuService.save (D:/repository/APP/src/lib/app/service/MenuService.ts:82:5)
      at async eval (D:/repository/APP/src/routes/edit-menu/api/+server.ts:14:5)
      at async DiContainer.resolve (D:/repository/APP/src/lib/app/container/DiContainer.ts:33:7)
      at async POST (D:/repository/APP/src/routes/edit-menu/api/+server.ts:12:3)
      at async Module.render_endpoint (D:/repository/APP/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js:47:18)
      at async resolve (D:/repository/APP/node_modules/@sveltejs/kit/src/runtime/server/respond.js:403:17) {
    errorNum: 0,
    offset: 0,
    code: 'DPI-1019'
  },
  errorNum: 0,
  offset: 0,
  code: 'DPI-1019'
}
  1. Include a runnable Node.js script that shows the problem.

Oracle's connection is used internally by TypeORM.

sharadraju commented 1 year ago

@okamototomoyuki Can you provide us the Table schema for "TABLE NAME" with the column types? That will help us identify which bind variable is complaining and possibly enable us to replicate the issue.

It would be useful if you can provide a simple runnable Node.js script without TypeORM that replicates the problem.

YeisonKirax commented 1 year ago

In my case the reason for the error was that the sent text had tildes

cjbj commented 1 year ago

You could do worse than try the patch in https://github.com/oracle/node-oracledb/issues/1554

okamototomoyuki commented 1 year ago

@okamototomoyuki 「TABLE NAME」のテーブル スキーマと列の型を提供していただけますか? これは、問題を抱えているバインド変数を特定するのに役立ち、問題を再現できる可能性があります。

問題を再現する、TypeORM を使用せずに実行可能な単純な Node.js スクリプトを提供できれば便利です。

@sharadraju Thank you for your reply.
The table definition is below.

  CREATE TABLE "SCHEMA_NAME"."TABLE_NAME" 
   (    "ID" NUMBER(19,0) NOT NULL ENABLE, 
    "NAME" VARCHAR2(255 BYTE), 
    "NODE_TYPE" NUMBER(1,0), 
    "URL" VARCHAR2(255 BYTE), 
    "IS_AUTH_ONLY" NUMBER(1,0), 
    "MENU_CODE" VARCHAR2(5 BYTE), 
    "IS_DEFAULT" NUMBER(1,0), 
    "IS_DISABLED" NUMBER(1,0), 
    "ENT_USER_ID" VARCHAR2(20 BYTE) NOT NULL ENABLE, 
    "ENT_DTM" DATE DEFAULT current_timestamp NOT NULL ENABLE, 
    "ENT_PGM_ID" VARCHAR2(20 BYTE) NOT NULL ENABLE, 
    "UPD_USER_ID" VARCHAR2(20 BYTE), 
    "UPD_DTM" DATE, 
    "UPD_PGM_ID" VARCHAR2(20 BYTE), 
     CONSTRAINT "LGSTR_PTL_MENU_ITEM_PK" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS_DEV2"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS_DEV2" ;

Oracle Version: 12.1.0.1
DB Server OS: WindowsServer2016

I will post about "reproducing the error" later if I can reproduce it.

sharadraju commented 1 year ago

@okamototomoyuki You might want to try the patch in #1554 as @cjbj suggested as most of the columns seem to be byte-based.

sharadraju commented 1 year ago

Hi @okamototomoyuki, were you able to try the patch in #1554?

cjbj commented 1 year ago

This was fixed in 6.0.1

okamototomoyuki commented 1 year ago

@cjbj @sharadraju I am very sorry for the reply after closing. After upgrading to 6.0.1, the error disappeared.

cjbj commented 1 year ago

@okamototomoyuki no problem at all! We are very happy to have your confirmation.