node-oracle icon indicating copy to clipboard operation
node-oracle copied to clipboard

core dump when doing many queries on same connection or when opening many connections.

Open sagiegurari opened this issue 12 years ago • 3 comments

We have an issue on all platforms (Linux, mac and windows) when running the npm oracle and doing many queries on same connection. This test queries a simple table with 2 columns (varchar and clob) with little data and it has only 1 row. The test breaks on different platforms after some queries (on Linux the fastest). Any help would be much appreciated.

thanks.

var oracle = require('oracle'); var connectData = { "tns": "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.20.30.148)(PORT=1521))(CONNECT_DATA=(SID=SOMESID)))", "user": "ABC", "password": "123" };

var loops = 200; var i; var done = 0; var connected = 0;

oracle.connect(connectData, function (error, connection) { if (error) { console.error('error connecting'); } else { connected++; console.log('connected', connected);

    for (i = 0; i < loops; i++) {
        console.log('querying', i);
        var statement = connection.prepare('SELECT JSON FROM MY_TABLE');
        statement.execute([], function (errorObject2, result) {
            if (errorObject2) {
                console.error('error connecting');
            } else {
                done++;
                console.log('query done.....', done);
            }
        });
    }
}

});

setInterval(function () { console.log('test'); }, 10000);

sagiegurari avatar Nov 03 '14 10:11 sagiegurari

I ran gdb and I see the following. It fails only after many queries are fired (around 100), and not for example if i run only 10 queries. it is as if the memory gets corrupted or something and that response vector is not valid anymore. since it happens in all platforms, i believe there is some unsafe handling of the response.

#0 0x00007fff8fd5bc7e in __kill () (gdb) bt #0 0x00007fff8fd5bc7e in __kill () #1 0x00000001063aceed in skgesigOSCrash () #2 0x00000001063e28b6 in kpeDbgSignalHandler () #3 0x00000001063ad63f in skgesig_sigactionHandler () #4 #5 0x0000000100c97134 in __normal_iterator (this=0x7fff5fbf6798, __i=@0x0) at stl_iterator.h:653 #6 0x0000000100c9710d in __normal_iterator (this=0x7fff5fbf6798, __i=@0x0) at stl_iterator.h:653 #7 0x0000000100c95154 in std::vector<output_t*, std::allocator<output_t*> >::begin (this=0x0) at stl_vector.h:331 #8 0x0000000100c92b78 in Connection::handleResult (baton=0x100d17d50, argv=@0x7fff5fbf7210) at ../src/connection.cpp:775 #9 0x0000000100ca4dd6 in Statement::EIO_AfterExecute (req=0x100d17e50, status=0) at ../src/statement.cpp:107 #10 0x00000001001319d2 in uv__work_done () #11 0x0000000100128a28 in uv__async_event () #12 0x0000000100128b99 in uv__async_io () #13 0x000000010013525d in uv__io_poll () #14 0x0000000100128fc3 in uv_run ()

sagiegurari avatar Nov 03 '14 16:11 sagiegurari

Made a pull requests that solves the issue https://github.com/joeferner/node-oracle/pull/233

barakedry avatar Nov 06 '14 14:11 barakedry

#233 fixes the issue.

sagiegurari avatar Nov 30 '14 18:11 sagiegurari