Skip to content
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

Child process exit with 3221225477 code when we call connection.release #947

Closed
Chinmoy-globalIds opened this issue Jul 19, 2018 · 4 comments
Labels

Comments

@Chinmoy-globalIds
Copy link

Chinmoy-globalIds commented Jul 19, 2018

We have clustered our application into one parent process(p) and two child process(c1,c2). We connect to oracle database from c2 process.To get the data from oracle db we used query stream. When we close the connection in end event of query stream, c2 process exit with 3221225477 code.

function dbProcess () {

     var con = oracledb.getConnection({
        "user": conOpt.userId,
        "password": conOpt.pwd,
        "connectString": `${conOpt.host}:${conOpt.port}/${conOpt.dbName}`,
        "acquireTimeout": super.acquireTimeoutForTest
    }, function(err, con) {
        if (err) {
            con && con.release();
            return;
        }
        var resMetadata;
        con.queryStream(query)
            .on('error', function(err) {
                con && con.release();
                return;
            })
            .on('metadata', function(metadata) {
                resMetadata = metadata;
            })
            .on('data', function(rowData) {
                console.log(rowData);
            })
            .on('end', function() {
                con && con.release();
                dbProcess();
            });
    });
} 
@dmcghan
Copy link

dmcghan commented Jul 19, 2018

@Chinmoy-globalIds A few things before I get to your question...

  • acquireTimeout is not a valid option for getConnection. Also, you should probably create a pool and get the connection from the pool. See queueTimeout if you go that route.
  • The checks on con before calling release aren't needed and you don't need to release the con if getConnection fails (you should probably throw the error there).
  • You seem to be calling dbProcess recursively, is that intentional?

Are you running on Windows? Could you please answer the template questions that appear in new issues?

A quick search on your error code revealed an interesting hit. They had to downgrade their compiler for Windows (though that was a couple years ago).

@Chinmoy-globalIds
Copy link
Author

Chinmoy-globalIds commented Jul 20, 2018

@dmcghan

  1. What is your Node.js version?
    v8.11.1 64 bit.
  2. What is your node-oracledb version?
    2.2.0
  3. What is your Oracle client (e.g. Instant Client) version? Is it 64-bit or 32-bit? How was it installed? Where is it installed?
    I do not install oracle client in my machine. I used oci.dll, oraociicus11.dll file for instant client. It is 64 bit.
  4. What is your Oracle Database version?
    12c
  5. What is your OS and version?
    windows 7 professional service pack 1.
  6. You seem to be calling dbProcess recursively, is that intentional?
    Yes
  7. Are you running on Windows?
    windows
    If I remove acquireTimeout option still issue is arise.

@dmcghan
Copy link

dmcghan commented Jul 26, 2018

@Chinmoy-globalIds Please try this version:

async function dbProcess () {
  let conn;
  const dbConfig = {
    user: conOpt.userId,
    password: conOpt.pwd,
    connectString: `${conOpt.host}:${conOpt.port}/${conOpt.dbName}`
  };

  try {
    conn = await oracledb.getConnection(dbConfig);

    let resMetadata;

    conn.queryStream(query)
      .on('error', async function(err) {
        await conn.close();
      })
      .on('metadata', function(metadata) {
        resMetadata = metadata;
      })
      .on('data', function(rowData) {
        console.log(rowData);
      })
      .on('end', async function() {
        await conn.close();
        dbProcess();
      });
  } catch (err) {
    console.log(err);
  } finally {
    if (conn) {
      try {
        await conn.close();
      } catch (err) {
        console.log(err);
      }
    }
  }
}

Here's another version that uses a result set:

async function dbProcess () {
  let conn;
  let result;
  const dbConfig = {
    user: conOpt.userId,
    password: conOpt.pwd,
    connectString: `${conOpt.host}:${conOpt.port}/${conOpt.dbName}`
  };

  try {
    conn = await oracledb.getConnection(dbConfig);

    result = await conn.execute(
      query,
      [], // no binds
      {
        resultSet: true
      }
    );

    console.log(result.metaData);

    let row;

    while (row = await result.resultSet.getRow()) {
      console.log(row);
    }
  } catch (err) {
    console.log(err);
  } finally {
    if (result && result.resultSet) {
      try {
        await result.resultSet.close();
      } catch (err) {
        console.error(err);
      }
    }

    if (conn) {
      try {
        await conn.close();
      } catch (err) {
        console.error(err);
      }
    }
  }
}

@cjbj cjbj added the question label Aug 3, 2018
@cjbj
Copy link
Member

cjbj commented Sep 4, 2018

Closing due to lack of activity.

From https://blogs.msdn.microsoft.com/joshpoley/2011/06/13/common-process-termination-values/

0xC0000005 (==3221225477) is an Access violation.

@cjbj cjbj closed this as completed Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants