Category Archives: Stack Overflow

How to configure Java heap size for node.js JDBC module?

In my node.js application, I'm using JDBC to connect to a Oracle database. I need to increase my java heap space to prevent following error:

java.lang.OutOfMemoryError: Java heap space

I know that there is a terminal option for setting maximum Java heap size (-Xmx<size>) but the problem is, I don't explicitly run java, it happens inside my JDBC module (which depends on java module), so I can't use that terminal option.

So how java heap size can be configured in my case?

How to configure Java heap size for my node.js application?

In my node.js application, I'm using JDBC to connect to a Oracle database. I need to increase my java heap space to prevent following error:

java.lang.OutOfMemoryError: Java heap space

I know that there is a terminal option for setting maximum Java heap size (-Xmx<size>) but the problem is, I don't explicitly run java, it happens inside my JDBC module (which depends on java module), so I can't use that terminal option.

So how java heap size can be configured in my case?

Current Cygwin version is not supported by Clion, how to install an earlier version of it?

I am trying to get my Clion 1.1.1 to work with Cygwin. I've installed Cygwin using its setup-x86_64.exe installer. but when I set Cygwin path in Clion's toolchains dialog, it says:

Environment: Cygwin; current version is 2.2.1; supported version range is 1.7.32-2.0.x

On the Cygwin website there is a snapshots page, in which packages are sorted by date (not version) and in faq page it says:

If you are looking for the version number for the whole Cygwin release, there is none. Each package in the Cygwin release has its own version.

So, if there is no version number for whole Cygwin release, what is Clion complaining about?

and if there is, how can I install an earlier version?

Current Cygwin version is not supported by Clion, how to install an earlier version of it?

I am trying to get my Clion 1.1.1 to work with Cygwin. I've installed Cygwin using its setup-x86_64.exe installer. but when I set Cygwin path in Clion's toolchains dialog, it says:

Environment: Cygwin; current version is 2.2.1; supported version range is 1.7.32-2.0.x

On the Cygwin website there is a snapshots page, in which packages are sorted by date (not version) and in faq page it says:

If you are looking for the version number for the whole Cygwin release, there is none. Each package in the Cygwin release has its own version.

So, if there is no version number for whole Cygwin release, what is Clion complaining about?

and if there is, how can I install an earlier version?

When using node.js cluster, how to access a worker’s environment when it dies?

I'm using node.js cluster module to create worker processes. And I set a custom variable in each worker's environment as I fork it.

I need to read that custom variable when a worker dies, but when a worker dies, I can't access its environment object anymore.

This is what I tried so far:

var cluster = require('cluster'),
    os = require('os');

if (cluster.isMaster) {

    cluster.on('exit', function (worker, code, signal) {

        console.log('worker ' + worker.process.pid + ' died');

        var x = {
            workerId: worker.process.env.workerId // This is undefined.
        };
        cluster.fork(x);
    });

    for (var i = 0; i < os.cpus().length; i++) {
        var x = {
            workerId: i
        };
        cluster.fork(x);
    }

}
else {
    console.log("workerId: ", process.env.workerId);

    // simulate an exeption:
    throw "fakeError";

}

I know that's not gonna work, my question is: how to access to latest state of a worker's envoronment right before its death?

When using node.js cluster, how to access a worker’s environment when it dies?

I'm using node.js cluster module to create worker processes. And I set a custom variable in each worker's environment as I fork it.

I need to read that custom variable when a worker dies, but when a worker dies, I can't access its environment object anymore.

This is what I tried so far:

var cluster = require('cluster'),
    os = require('os');

if (cluster.isMaster) {

    cluster.on('exit', function (worker, code, signal) {

        console.log('worker ' + worker.process.pid + ' died');

        var x = {
            workerId: worker.process.env.workerId // This is undefined.
        };
        cluster.fork(x);
    });

    for (var i = 0; i < os.cpus().length; i++) {
        var x = {
            workerId: i
        };
        cluster.fork(x);
    }

}
else {
    console.log("workerId: ", process.env.workerId);

    // simulate an exeption:
    throw "fakeError";

}

I know that's not gonna work, my question is: how to access to latest state of a worker's envoronment right before its death?