-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled exceptions and infinite loop on mac #94
Comments
Another note: memory corruption seems a bit unlikely because the driver runs great when there is no exception. |
Could you paste a section of the corresponding Javascript code which causes this exception? I had the same C++ error ( I also notice that the section of code you quoted from |
Thanks a lot for the info. I'll update my fork and investigate further, with special attention to the destructor. |
I upgraded to the latest code but it did not make any difference. I tried to disable all the destructors but it did not make any difference either. Here is my test code: var oracle = require('oracle');
console.log("connecting ...");
oracle.connect(require('./testConfig.json'), function(err, cnx) {
if (err) throw err;
console.log("connected");
cnx.execute("create table FOO (BAR varchar(10))", [], function(err) {
if (err && !/^ORA-00955/.test(err.message)) throw err;
console.log("table created");
cnx.execute("insert into FOO (BAR) values (:1)", [undefined], function(err) {
if (err) throw err;
console.log("row inserted");
});
});
}) Note: code works if I replace |
Output is:
|
I experimented a bit more. I trimmed The exception is properly caught if I trim it down to: void ExecuteBaton::CopyValuesToBaton(ExecuteBaton* baton, v8::Local<v8::Array>* values) {
uint32_t len = (*values)->Length();
throw NodeOracleException("test");
for(uint32_t i=0; i<len; i++) {
}
} But I get the problem as soon as I move the void ExecuteBaton::CopyValuesToBaton(ExecuteBaton* baton, v8::Local<v8::Array>* values) {
uint32_t len = (*values)->Length();
for(uint32_t i=0; i<len; i++) {
throw NodeOracleException("test");
}
} It does not make much sense to me but that's how it is! |
I've managed to reproduce the problem with a simple addon which is independent from node-oracle and not linked to instantclient: https://gist.github.com/bjouhier/7307287 So this is not an oracle specific bug, rather an issue with addons on osx. I'm posting it as a node issue. |
@raztus @joeferner Node and V8 are compiled with This means that instantclient calls should be wrapped with I can restructure the driver code to fix this and submit a PR but I'd like to have your opinion before. |
@raymondfeng Might have better input than I do. I'm quite inexperienced with C++. Could you provide an example of where we are mixing v8/node calls and our own exceptions, and would you help me understand what the issue is? If I'm understanding correctly, you're talking about code like these lines from
But if that is an example of what you're referring to, I fail to understand the problem, since that looks acceptable to me. |
@raztus @raymondfeng Problem is with https://github.com/nearinfinity/node-oracle/blob/master/src/executeBaton.cpp#L133. The See comments in nodejs/node-v0.x-archive#6463 |
I'm not sure if that's true. First, the node-oracle addon is compiled and linked with exception handling enabled. Second, the code throwing the exception (https://github.com/nearinfinity/node-oracle/blob/master/src/executeBaton.cpp#L133) and catching the exception (https://github.com/nearinfinity/node-oracle/blob/master/src/connection.cpp#L60) are both from the addon itself. |
I'll look into https://gist.github.com/bjouhier/7307287 more. |
Yes, the throw and catch are both in the add-on but we don't know the assumptions that the compiler made when it compiled constructors and destructors for Note that my gist fails with gcc 4.7 but works ok with gcc 4.2. The gist compiles with both but |
I'm running into a strange bug on mac osx: exceptions are not caught properly in the C++ code. Instead I'm getting a
terminate called after throwing an instance of 'NodeOracleException'
message and the node process goes into an infinite loop (and it takes akill -9
to kill it).This occurs in several places. One example is with following stack:
If execution reaches the
throw
at then end ofCopyValuesToBaton
becauseval
is undefined then the exception should be caught by the following block inConnection::Execute
:But it is not!!
I'm suspecting either a problem with compiler options or a memory corruption.
I managed to get rid of the infinite loop by recompiling the driver without the
-Os
option: the exception is still not caught but I'm getting anabort trap 6
instead. But I did not manage to fix the problem by playing with the other options. I tried to remove the-fno-rtti
and add a-fexceptions
but had no luck.I'm running node 0.10.20 on OSX 10.8.5
The text was updated successfully, but these errors were encountered: