
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
cluster fork and restart easy way.
uncaughtException
eventnpm install cfork
import util from 'node:util';
import { cfork } from 'cfork';
const clusterWorker = cfork({
exec: '/your/app/worker.js',
// slaves: ['/your/app/slave.js'],
// count: require('os').cpus().length,
}).on('fork', worker => {
console.warn('[%s] [worker:%d] new worker start', Date(), worker.process.pid);
})
.on('disconnect', worker => {
console.warn('[%s] [master:%s] wroker:%s disconnect, exitedAfterDisconnect: %s, state: %s.',
Date(), process.pid, worker.process.pid, worker.exitedAfterDisconnect, worker.state);
})
.on('exit', (worker, code, signal) => {
const exitCode = worker.process.exitCode;
const err = new Error(util.format('worker %s died (code: %s, signal: %s, exitedAfterDisconnect: %s, state: %s)',
worker.process.pid, exitCode, signal, worker.exitedAfterDisconnect, worker.state));
err.name = 'WorkerDiedError';
console.error('[%s] [master:%s] wroker exit: %s', Date(), process.pid, err.stack);
})
// if you do not listen to this event
// cfork will output this message to stderr
.on('unexpectedExit', (worker, code, signal) => {
// logger what you want
})
// emit when reach refork times limit
.on('reachReforkLimit', () => {
// do what you want
});
// if you do not listen to this event
// cfork will listen it and output the error message to stderr
process.on('uncaughtException', err => {
// do what you want
});
// if you want to dynamically disable refork, you can call the setDisableRefork, priority over the refork parameter
cfork.setDisableRefork(clusterWorker, true);
const { cfork } = require('cfork');
os.cpus().length
true
duration
, default is 60
60000
, one minute (so, the refork times
< limit / duration
)running_under_istanbul
env set, default is false
Made with contributors-img.
FAQs
cluster fork and restart easy way
The npm package cfork receives a total of 21,120 weekly downloads. As such, cfork popularity was classified as popular.
We found that cfork demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.