[node-odbc]Error allocating or reallocating memory when fetching data. No ODBC error information available

438 Views Asked by At

My system

  • Database Version: 6.1.0
  • Database Name: Sybase
  • Node.js Version:12.18.3
  • node-odbc package Version: 2.4.1
  • Node.js OS: Windows 10 Pro

The bug

Launching the same query with a lot of data for many times odbc packet returns to me the following error "[odbc]Error allocating or reallocating memory when fetching data. No ODBC error information available". The heap fills up with each query despite the result being returned to the service response and the variable being cleaned. Trying to run the query with the parameter (cursor=true) and closing the cursor without data fetch there are no problems. The same problem occurs when I have longvarchar fields on the tables. Although I close the connections the db still displays them open.

Connection odbc

Expected behavior

I do not understand why the system goes out of memory despite the fact that the queries are executed one after the other. Running the query once does not cause the problem.

To Reproduce

Prepare table with 22 fields (2 varchar(32767)) and 5633 records. Call the service 15 times by pressing a key that open connection, executes the SELECT query on table, close connection and returns the result.

1

There are 1 best solutions below

0
On
EDIT 27/01/2023 ⇒ 2.4.7 released solve the problem

node-obdc v2.4.7 => https://github.com/markdirish/node-odbc/releases/tag/v2.4.7


We got the same issues here.

If we're talking about the same projects ⇒ https://github.com/markdirish/node-odbc

This is a known issue related to a memory leak during SELECT query on table https://github.com/markdirish/node-odbc/issues/304

Seems to appear on multiple drivers like: SQLite, HFSQL, etc....

Memory don't handle to free data and at least you get a memory heap limit into your program that cause the exit of it.

A merge request is about to solve this ⇒ https://github.com/markdirish/node-odbc/pull/306

If you need to read data with this solution, I can suggest an alternative solution, pending resolution...

https://github.com/wankdanker/node-odbc

A bit difficult to launch, but works like a charm afterward.