joeferner / node-oracle

node.js driver to connect with an oracle database.
MIT License
271 stars 99 forks source link

Invalid pointer crash on CentOS 6 #86

Open Althenar opened 10 years ago

Althenar commented 10 years ago

I'm trying to run node-oracle on CentOS 6.4, however it crashes on executing even a very simple query. My test program is:

var oracle = require('oracle');

var connString = "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx)(PORT=1521))(CONNECT_DATA=(SID=xxx)))";
var connectData = { "tns": connString, "user": "xxx", "password": "xxx" };

oracle.connect(connectData, function(err, connection) {
        if ( err ) {
                console.error(err);
                process.exit(1);
        }
        connection.execute("SELECT 1 FROM dual", [], function(err, results) {
                if (err) {
                        console.log(err);
                } else {
                        console.log(results);
                }
        });
});

If I only establish the connection, the program runs fine, however when I add the query, the result is:

*** glibc detected *** node: free(): invalid pointer: 0x00007f5c28001070 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x76126)[0x7f5c3e7c0126]
/home/app/node_modules/oracle/build/Release/oracle_bindings.node(_ZN10Connection26CreateColumnsFromResultSetEPN6oracle4occi9ResultSetERSt6vectorIP8column_tSaIS6_EE+0x5ae)[0x7f5c3b96832e]
/home/app/node_modules/oracle/build/Release/oracle_bindings.node(_ZN10Connection11EIO_ExecuteEP9uv_work_s+0x504)[0x7f5c3b969d34]
/usr/lib64/libuv.so.0.10(+0x106c6)[0x7f5c4047b6c6]
/usr/lib64/libuv.so.0.10(+0x6f3f)[0x7f5c40471f3f]
/lib64/libpthread.so.0(+0x7851)[0x7f5c3eae4851]
/lib64/libc.so.6(clone+0x6d)[0x7f5c3e83294d]
======= Memory map: ========
00400000-0054c000 r-xp 00000000 fc:01 403485                             /usr/bin/node
0074c000-0074d000 r--p 0014c000 fc:01 403485                             /usr/bin/node
0074d000-00750000 rw-p 0014d000 fc:01 403485                             /usr/bin/node
00750000-00751000 rw-p 00000000 00:00 0
01f02000-0213a000 rw-p 00000000 00:00 0                                  [heap]
201d04b5000-201d0500000 ---p 00000000 00:00 0
201d0500000-201d0505000 rw-p 00000000 00:00 0
201d0505000-201d0506000 ---p 00000000 00:00 0
201d0506000-201d05ff000 rwxp 00000000 00:00 0
201d05ff000-201d0600000 ---p 00000000 00:00 0
201d0600000-201d0605000 rw-p 00000000 00:00 0
201d0605000-201d0606000 ---p 00000000 00:00 0
201d0606000-201d06ff000 rwxp 00000000 00:00 0
201d06ff000-201f04b5000 ---p 00000000 00:00 0
462a8000000-462a8f00000 ---p 00000000 00:00 0
462a8f00000-462a9000000 rw-p 00000000 00:00 0
462a9000000-462aa000000 ---p 00000000 00:00 0
8b15a000000-8b15a085000 rw-p 00000000 00:00 0
c88bfdbf000-c88bfdc0000 r-xp 00000000 00:00 0
19611cdb4000-19611cdb5000 r-xp 00000000 00:00 0
1b73e0cb7000-1b73e0cb8000 r-xp 00000000 00:00 0
1e56dbc00000-1e56dbc35000 rw-p 00000000 00:00 0
22a508ac1000-22a508ac2000 r-xp 00000000 00:00 0
23857b278000-23857b279000 r-xp 00000000 00:00 0
290674dbd000-290674dbe000 rw-p 00000000 00:00 0
290674dbe000-290674fbd000 ---p 00000000 00:00 0
2ac7ec000000-2ac7ec025000 rw-p 00000000 00:00 0
30fcc55ef000-30fcc5600000 ---p 00000000 00:00 0
30fcc5600000-30fcc5620000 rw-p 00000000 00:00 0
30fcc5620000-30fcc564f000 ---p 00000000 00:00 0
3d21dd200000-3d21dd225000 rw-p 00000000 00:00 0
7f5c20000000-7f5c20021000 rw-p 00000000 00:00 0
7f5c20021000-7f5c24000000 ---p 00000000 00:00 0
7f5c28000000-7f5c28083000 rw-p 00000000 00:00 0
7f5c28083000-7f5c2c000000 ---p 00000000 00:00 0
7f5c2e5ad000-7f5c2e5ae000 ---p 00000000 00:00 0
7f5c2e5ae000-7f5c2efae000 rwxp 00000000 00:00 0
7f5c2efae000-7f5c2efaf000 ---p 00000000 00:00 0
7f5c2efaf000-7f5c2f9af000 rwxp 00000000 00:00 0
7f5c2f9af000-7f5c33eff000 r-xp 00000000 fd:01 1059742                    /opt/oracleinstantclient/libociei.so
7f5c33eff000-7f5c33ffe000 ---p 04550000 fd:01 1059742                    /opt/oracleinstantclient/libociei.so
7f5c33ffe000-7f5c34000000 rw-p 0454f000 fd:01 1059742                    /opt/oracleinstantclient/libociei.so
7f5c34000000-7f5c34021000 rw-p 00000000 00:00 0
7f5c34021000-7f5c38000000 ---p 00000000 00:00 0
7f5c38179000-7f5c3817e000 r-xp 00000000 fc:01 130093                     /lib64/libnss_dns-2.12.so
7f5c3817e000-7f5c3837d000 ---p 00005000 fc:01 130093                     /lib64/libnss_dns-2.12.so
7f5c3837d000-7f5c3837e000 r--p 00004000 fc:01 130093                     /lib64/libnss_dns-2.12.so
7f5c3837e000-7f5c3837f000 rw-p 00005000 fc:01 130093                     /lib64/libnss_dns-2.12.so
7f5c3837f000-7f5c3838b000 r-xp 00000000 fc:01 130095                     /lib64/libnss_files-2.12.so
7f5c3838b000-7f5c3858b000 ---p 0000c000 fc:01 130095                     /lib64/libnss_files-2.12.so
7f5c3858b000-7f5c3858c000 r--p 0000c000 fc:01 130095                     /lib64/libnss_files-2.12.so
7f5c3858c000-7f5c3858d000 rw-p 0000d000 fc:01 130095                     /lib64/libnss_files-2.12.so
7f5c3858d000-7f5c3858e000 ---p 00000000 00:00 0
7f5c3858e000-7f5c38f8e000 rwxp 00000000 00:00 0
7f5c38f8e000-7f5c38f8f000 ---p 00000000 00:00 0
7f5c38f8f000-7f5c3998f000 rwxp 00000000 00:00 0
7f5c3998f000-7f5c399a5000 r-xp 00000000 fc:01 130089                     /lib64/libnsl-2.12.so
7f5c399a5000-7f5c39ba4000 ---p 00016000 fc:01 130089                     /lib64/libnsl-2.12.so
7f5c39ba4000-7f5c39ba5000 r--p 00015000 fc:01 130089                     /lib64/libnsl-2.12.so
7f5c39ba5000-7f5c39ba6000 rw-p 00016000 fc:01 130089                     /lib64/libnsl-2.12.so
7f5c39ba6000-7f5c39ba8000 rw-p 00000000 00:00 0
7f5c39ba8000-7f5c39c69000 r-xp 00000000 fc:01 405907                     /usr/lib64/libstdc++.so.5.0.7
7f5c39c69000-7f5c39e69000 ---p 000c1000 fc:01 405907                     /usr/lib64/libstdc++.so.5.0.7
7f5c39e69000-7f5c39e72000 rw-p 000c1000 fc:01 405907                     /usr/lib64/libstdc++.so.5.0.7
7f5c39e72000-7f5c39e83000 rw-p 00000000 00:00 0
7f5c39e83000-7f5c3a173000 r-xp 00000000 fd:01 1059741                    /opt/oracleinstantclient/libnnz10.so
7f5c3a173000-7f5c3a272000 ---p 002f0000 fd:01 1059741                    /opt/oracleinstantclient/libnnz10.so
7f5c3a272000-7f5c3a322000 rw-p 002ef000 fd:01 1059741                    /opt/oracleinstantclient/libnnz10.so
7f5c3a322000-7f5c3a324000 rw-p 00000000 00:00 0
7f5c3a324000-7f5c3b574000 r-xp 00000000 fd:01 1059747                    /opt/oracleinstantclient/libclntsh.so.10.1
7f5c3b574000-7f5c3b674000 ---p 01250000 fd:01 1059747                    /opt/oracleinstantclient/libclntsh.so.10.1
7f5c3b674000-7f5c3b71a000 rw-p 01250000 fd:01 1059747                    /opt/oracleinstantclient/libclntsh.so.10.1
7f5c3b71a000-7f5c3b736000 rw-p 00000000 00:00 0
7f5c3b736000-7f5c3b832000 r-xp 00000000 fd:01 1059732                    /opt/oracleinstantclient/libocci.so.10.1
7f5c3b832000-7f5c3b932000 ---p 000fc000 fd:01 1059732                    /opt/oracleinstantclient/libocci.so.10.1
7f5c3b932000-7f5c3b95f000 rw-p 000fc000 fd:01 1059732                    /opt/oracleinstantclient/libocci.so.10.1
7f5c3b95f000-7f5c3b973000 r-xp 00000000 fd:03 526075                     /home/app/node_modules/oracle/build/Release/oracle_bindings.node
7f5c3b973000-7f5c3bb73000 ---p 00014000 fd:03 526075                     /home/app/node_modules/oracle/build/Release/oracle_bindings.node
7f5c3bb73000-7f5c3bb74000 rw-p 00014000 fd:03 526075                     /home/app/node_modules/oracle/build/Release/oracle_bindings.node
7f5c3bb74000-7f5c3bb91000 r-xp 00000000 fc:01 133777                     /lib64/libselinux.so.1
7f5c3bb91000-7f5c3bd90000 ---p 0001d000 fc:01 133777                     /lib64/libselinux.so.1Aborted

I'm guessing it's an issue with my system libraries, however I have no idea what to do about it. The instantclient installation is fine, as I'm able to run queries through sqlplus. Any help would be appreciated.

tungv commented 10 years ago

I have the same problem, too

sksadri commented 10 years ago

I have the same issue on fedora 20

flummoxed commented 10 years ago

There appear to be at least one earlier thread relating to this (e.g., #13)

After changing the buildenv to Debug and rebuilding, narrowed the issue down to the getString() method in connection.cpp:

col->name = metadata.getString(oracle::occi::MetaData::ATTR_NAME);

A cursory Google search establishes that this is a known occi issue based on compiler migration during the 10 environment:

https://community.oracle.com/thread/572397?start=0&tstart=0 https://community.oracle.com/message/1396811

Subsequently downloaded the 10.2.0.5 occi libraries from Oracle via:

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

however, the embedded .so continues to have a dependence on libstdc++.so.5:

$ ldd libocci.so.10.1

linux-vdso.so.1 =>  (0x00007fff71bff000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00007f55b30a4000)
libm.so.6 => /lib/libm.so.6 (0x00007f55b2e21000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f55b2c09000)
libc.so.6 => /lib/libc.so.6 (0x00007f55b2882000)
/lib64/ld-linux-x86-64.so.2 (0x00007f55b35cc000)

Another thread seems to suggest that the x86_64 based on gcc3.4.3 exists in the 10.2.0.4 patch

https://community.oracle.com/message/4543974

However, after downloading the patch and resetting the symbolic link, the .so in the patch is likewise not x86_64:

ln -s libocci10_343.so.10.1 libocci.so.10.1 Error: libocci.so.10.1: wrong ELF class: ELFCLASS32

The next possible approach is to locate and recompile occi for _64 via:

http://docs.oracle.com/cd/B19306_01/install.102/b25400/post_inst_task.htm

Does anyone have an existing x86_64 occi.so for gcc3.4.3?