oracle / node-oracledb

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

Error "NJS-112: internal error: read integer of length 19 when expecting integer of no more than length 4" when performing SELECT on large amount of rows #1565

Closed andersonzapaterra closed 1 year ago

andersonzapaterra commented 1 year ago

I am encountering an issue when using the node-oracledb library to perform a SELECT query on a large number of rows in my Oracle table. The error I'm getting is:

NJS-112: internal error: read integer of length 19 when expecting integer of no more than length 4

Here are the details:

Environment:

Node.js 18 node-oracledb version: 6.0.0

SQL Query: I'm executing the following SQL query:

SELECT * FROM PCCLIENT

Note: The error occurs when the query returns a large number of rows. If the query returns only a small number of rows, the error does not occur.

fetchArraySize setting: I've tested by changing the fetchArraySize setting, but the error still occurs when the number of rows is large.

Attempted resolutions:

I've tried changing the fetchArraySize, but the problem persists. I've also checked to see if there's enough memory space, and it seems that there is.

code:

const result = await connection.execute("SELECT * FROM PCCLIENT",{},{
            outFormat: oracledb.OUT_FORMAT_OBJECT,   // query result format
            extendedMetaData: false,               // get extra metadata
            fetchArraySize:   150,                 // internal buffer allocation size for tuning
            maxRows:1000
        });
sharadraju commented 1 year ago

@ertl Please provide us a reproducible test case and also let us know your OS platform and Oracle Database version details. Was it appearing with 6.0.2?

ertl commented 1 year ago

@sharadraju: Can't tell cause I'm struggeling with some ORA-01002: fetch out of sequence

With the db driver version 6.0.2 I get an ORA-01002 Error before I come to the NJS-112 part.

All Tests pass with the thick driver tought.

If you want to have a look on it, the error is reproduceable in the branch (https://github.com/ertl/typeorm/tree/feat-oracledb6) My OS: Windows 10 Enterprise Oracle DB: 18

Before you run the tests:

P.S: When I run the test npm test -- --grep="custom cache provider" I get an ORA-01002 Error. But when each testcase is executed individually no problem exists. With the thick driver though, everthing works fine. Not sure if this is also an issue with the thin driver. Would be nice to know, what your thoughts are about this.

sudarshan12s commented 1 year ago

Thanks @ertl for providing the details. It is very helpful. Yes I can reproduce the error ORA-01002 with cache providerand NJS 112 with generated columns

I see generated columns recreates the table typeorm_metadata and similarly cache provider recreates the table, mock-query-result-cache. I think with out re-create tests possibly would pass.

We are working on this and would share more details soon.

sharadraju commented 1 year ago

This is fixed in the 6.1 release and the patch was tested by @ertl as per the update here.