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

Enhance Error handling

Open dsn opened this issue 13 years ago • 0 comments

When I have an error connecting to Oracle I get a stack trace when the program exits. If I trap and exit the processes I get a segmentation fault.

oracle.js:378: Uncaught Error: Error: ORA-01017: invalid username/password; logon denied

Segmentation fault

If I do not exit the process and let node try to clean itself up I get the following errors followed by stack traces (trying multiple times generated multiple errors all seem related to the same thing releasing an object that doesn't appear to exist).

Uncaught Error: Error: ORA-01017: invalid username/password; logon denied

*** glibc detected *** node: free(): invalid pointer: 0x0a50e600 ***
*** glibc detected *** node: munmap_chunk(): invalid pointer: 0x0a7f2ae8 ***
*** glibc detected *** node: double free or corruption (out): 0x0892a998 ***

Sample Code


process.on('uncaughtException', function (err) {
  console.log('Caught exception: ' + err);
});

var oracle = require("oracle");

oracle.connect({ "hostname": "localhost", "user": "g", "password": "p", "database": "DB.FOO.BAR" }, function(err, connection) {
  if(err) {
    throw new Error(err);
    process.exit(1);
  }
  if(connection) { console.log(connection); }
});

I also get these errors when I run a simple select query

oracle.connect({ "hostname": "localhost", "user": "g", "password": "p", "database": "DB.FOO.BAR" }, function(err, connection) {
 function(err, connection) {
  if(err) {
    throw new Error(err);
  }
  if(connection) {
    connection.execute("select 1 from dual", [], function(err, results) {
      if(err) {
        throw new Error(err);
      }
      console.log(results);
      connection.close();
    });
  }
)};
*** glibc detected *** node: free(): invalid pointer: 0x091fa5a8 ***
======= Backtrace: =========
/lib/libc.so.6[0xbdc4a5]
/lib/libc.so.6(cfree+0x59)[0xbdc8e9]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x42f5c1]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZN9__gnu_cxx13new_allocatorIN6oracle4occi8MetaDataEE10deallocateEPS3_j+0x1d)[0x13c87f]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZNSt12_Vector_baseIN6oracle4occi8MetaDataESaIS2_EE13_M_deallocateEPS2_j+0x33)[0x13c8b9]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZNSt12_Vector_baseIN6oracle4occi8MetaDataESaIS2_EED2Ev+0x48)[0x13c908]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZNSt6vectorIN6oracle4occi8MetaDataESaIS2_EED1Ev+0x67)[0x13e2dd]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZN10Connection26CreateColumnsFromResultSetEPN6oracle4occi9ResultSetERSt6vectorIP8column_tSaIS6_EE+0x409)[0x138ff3]
/home/xxx/node_modules/oracle/build/Release/oracle_bindings.node(_ZN10Connection11EIO_ExecuteEP9uv_work_s+0x245)[0x13926d]
node[0x821736f]
/lib/libpthread.so.0[0x115852]
/lib/libc.so.6(clone+0x5e)[0xc46a8e]

I would try to tinker and see what I could do to help however my C skills are quite rusty. Thank you kindly for all the work you have done so far.

Node Version: 0.8.14 OS: RHEL 5.8

dsn avatar Nov 26 '12 11:11 dsn