Skip to content

segfault after garbage collection #70

Description

@vschoettke

The connection (result from oracle.connect) does not retain the oracle client so if the garbage collector (Mark-sweep) is run it will collect the client even if a connection is still open (OracleClient destructor is called) and the next call to a client function that depends on m_environment will crash.

I added a simple example for reproduction. you have to run it with node --expose-gc crash.js.

crash.js content:

var connectData = {
    host: '127.0.0.1',
    database: 'XE',
    user: 'user',
    password: 'password'
};

oracle.connect(connectData, function (err, connection) {
    // var oracle2 = oracle; // will work if comment is removed
    if (err) {
        throw new Error(err);
    }

    global.gc();

    var execResult = connection.executeSync(
        'SELECT 1 from DUAL',
        []
    );
    console.log("RESULT", execResult);

    connection.close();
});

If the comment-out code is reinserted oracle (OracleClient) will not be garbage collected because it's used inside the function.

FWIW: This was tested with occi 12.1.0.1.0 and 12.1.0.2.0 with Linux and node 4 and 6.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions