hgourvest / node-firebird

Pure javascript and asynchronous Firebird client for Node.js.
Mozilla Public License 2.0
256 stars 127 forks source link

App freezing on sequentially queries #92

Open asaelko opened 8 years ago

asaelko commented 8 years ago

Application freezing on sequentially select when it reaches end of data

db.sequentially('\
               SELECT * FROM RECORDS\
               WHERE DATE_START IS NULL
               ORDER BY CREATED ASC\
        ', function (row, index) {
                getRecordInfo(row, cb);
        }, function (err) {
                if (typeof err === 'undefined') // we reached the end
                     console.log('All records loaded');
                else
                     console.log('Error', err);
    });

Console shows 'All records loaded', but then all queries to db from other places in code stack in queue without any error and processing. If we make request that returns zero records at start (select first 1 skip 100 from table, where record count < 100), we get the same malfunction.

Some debug: in

self._socket.on('data', function(data) {

js catch error on string

obj = decodeResponse(xdr, cb, self.db);

exception message:

Unexpected: 0

ghost commented 8 years ago

I stumbled upon the same error(decodeResponse Unexpected: 0) when i tried to insert multiple rows with a foreign key asynchronously. Problem gone away when i used batching to insert 1 row at a time for the same foreign key.

sdnetwork commented 7 years ago

can you try with this please

https://github.com/sdnetwork/node-firebird

it should fix te problem